A Direct3D "architecture" challenge. Sticky thread in the DX forum, open to anyone who can be bothered.
Going through the FAQ and previous post listings I've noticed that the age old state-change reordering (or just generally reducing the number of state changes) crops up every now and then.
The general idea is that you need to use algorithms and data-structures to avoid making any redundant calls, and any calls that you must make are done in the best possible order.
For the purpose of a challenge that wouldn't require any Direct3D programming.
So I knocked up a simple prototype where you can provide it a function pointer to a custom "solution". This solution is given a mock IDevice interface where it can change the pipeline configuration (analagous to the normal IDirect3DDevice9) and a list of Object's. Its then upto the implementation to configure the pipeline and "render" each of these objects in the most efficient order.
I've knocked up a prototype and it seems to work fine. The IDevice keeps track of how many of which calls are made, and when the user-provided code returns the total cost is computed. Lower cost = better:
Function Name | Number of Objects | Sequence Time | Actual Time (microseconds)--------------------------------------------------------------+-------------------+---------------+---------------------------First Come First Served | 1000 | 2711000 | 113First Come First Served (With Redundant Call Filtering) | 1000 | 2806044 | 861Shortest Job First | 1000 | 2396238 | 45879Shortest Job First (Without individual VS/PS constant checks) | 1000 | 2408584 | 19680
("Sequence Time" = cost)
I put together this little framework so I could test out a few algorithms myself, but thought I could release it publicly. My thinking being that it might be useful to people, but more importantly, if its a sticky thread and people actually have a go AND post their solutions it might well be an interesting reference thread...
Sound like something you'd be interested in?