Jump to content
  • Advertisement
Sign in to follow this  
liam_g

Vertex shader declaration macros, and SetVertexShaderConstantBFI (dx8.1 to 9.0c)

This topic is 4865 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

Hey, folks, I'm not getting any bites on my general question about porting from dx8.1 to 9.0c, so I thought I'd post some specific questions. My first one is about vertex shader declarations. I know the way vertex buffers & shaders is handled changed between version 8 and 9, but what I don't understand is what to do about it. ;) For example, macros such as D3DVSD_STREAM have disappeared. What I can't figure out is how to do what the macro in dx8.1 was doing, in dx9. This is also hampered by the fact that I'm new to this (as I mentioned in my previous thread), and don't really have a clear grasp of what shaders do anyway (I'm working on it ... but have sooo much other stuff to learn as well!!). So ... any tips, or links to info on what I need to do to duplicate what the old vertex shader declaration macros did, now that they've disappeared from the sdk??? Second question is regarding SetVertexShaderConstant. In our code, we're passing a D3DXMATRIX as the second argument under version 8.1. In version 9, the method no longer exists, as it has been replaced by three methods which append a type-specifying character at the end of the method name, F for float, B for bool, and I for int. You can't pass a matrix to any of these. ;) Or can I cast it?? I did find some code on a page where someone was passing a vector and casting it to a float * (or float** ... can't remember). Can I cast a matrix in the same way?? Thanks VERY much for any help, and for your patience with what must seem very simple questions. Respectfully,

Share this post


Link to post
Share on other sites
Advertisement
As far as the vertex declarations go, take a look at some of the sample applicaitons that come with the SDK. Specifically, the BasicHLSL sample has some simple code to do this. Although you are working with assembly shaders, vertex declarations are done the same way reguardless of if you're using assembly or HLSL shaders.

About setting a shader to use a matrix, you should be able to use SetVertexShaderConstantF. The D3DXMATRIX class has built in casting operators that will return a simple FLOAT* so you should be able to pass that into SetVertexShaderConstantF without a problem.

neneboricua

Share this post


Link to post
Share on other sites
Thanks for the reply ... I'll try SetVertexShaderConstantF, and will look at the hlsl sample you mentioned for some ideas.

Thanks!!!

Liam

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!