• entries
422
1540
• views
489219

# Lets play a game...

149 views

Had an idea this morning (yes, it does happen...)

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?

Quote:
 Sound like something you'd be interested in?
Yeah it does sound interesting. Smart way to use an imposter device in my opinion. I'm not sure I'd have much time to play with it at the moment though. I like the new avatar. I was getting sick of looking at that car. [grin]

Quote:
 Smart way to use an imposter device in my opinion.
I thought it was fairly neat... it effectively sets things up as a sort of simulator without actually having any "proper" D3D attachements.

Quote:
 I like the new avatar. I was getting sick of looking at that car.
hehe, might take to changing it on a more regular basis. I noticed another mod had an animated avatar the other day, so I wonder if I can as well (the one I've got is also in a day/night cycle screensaver).

Lemon Jelly > *

Jack

DO IT.

Heh, I'll be gone for the next two weeks, but I'll be sure to give it a go afterwards.

## Create an account

Register a new account