Jump to content
  • Advertisement
Sign in to follow this  
beebs1

Vertex Formats

This topic is 3365 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hiya, I'm wondering if someone could give me some advice on my renderer design :) I'm loading mesh data from files, and the different HLSL shaders in my game need different vertex formats as input. I can see several ways of making the vertex formats match, but none seem ideal - I'm really hoping someone can lend their opinion. I could just stuff every conceivable vertex attribute into each mesh, so everything submitted to the renderer is in the same format. This seems very wasteful though, so it's not a great solution. I think another way would be to use a mechanism similar to Yann L's. I believe in his system every shader is implemented as a DLL, so the vertex formats required can just be hard-coded in. Each DLL will know what format it needs, and any missing attributes can be generated for each mesh as required. It seems like this would generate a huge amount of shader DLLs, and it doesn't seem too artist-friendly. A third way would be to determine the required format from the HLSL file itself, and then fill in the missing attributes. As far as I know this is only possible in D3D10 though (reflection?), and I need to target D3D9... I'm sure this must be a common problem. Can anyone say how they solve this? Thanks in advance for any help! Cheers, James

Share this post


Link to post
Share on other sites
Advertisement
In my engine I have a personal mesh format that stores its own vertex declaration inside itself. I think its the most efficient way. (If i'm correct the .x file format do the same...)

Share this post


Link to post
Share on other sites
I'd like to know how people do as well.

Here's how I tried to solve the problem, with dx9 : my fx files contain the input struct and a dummy global variable of that struct. You can't access the struct directly from your app, but you can access the global variable.
So in my app I can get a handle on the dummy var, use GetParameterDesc to know how many elements are in the struct. Then a loop to parse the struct members, giving the name, type, semantic, etc.

Share this post


Link to post
Share on other sites
Thanks.

So GetParameterDesc() lets you determine the input structure? Interesting, I'll have to have a look at that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!