Sign in to follow this  

Get vertex shader parameters

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

Hi, I am trying to create my vertex declaration by reading the parameters of the vertex shader. I am using the effect extension ID3DXEffect. I have been looking at GetPassDesc, GetFunctionDesc, GetVertexShader in some depth but i am still a bit unsure of how to extract only the vertex shader functions and parse the parameters to create my declaration. I am making an engine and i want to conseal the user from the vertex declarations. If i can determine what i need then i dont see why the user should have to supply that information. Do you agree? Any advice/help would be much appreciated. Regards

Share this post


Link to post
Share on other sites
You want to create the mesh's vertex declaration from what's in the shader? I see it as the other way around. You want to determine what effects the shader will support, and what vertex formats are necessary to support them. Then you can ensure that the vertex has the necessary components and even remove unnecessary ones. Your application code has more flexibility (can do a lot more and be larger) than the shader code.

So, if a mesh is supposed to be rendered with a texture and a normal map, you can makes sure it has normals, texture coords, tangents, and (optionally) binormals. Then you would use the appropriate technique, pass, or function to render it.

Share this post


Link to post
Share on other sites
Thanks for the input,

i think we are both looking at the problem from opposite ends.

I want my user to write a shader file, pass it in, pass in the vertices and the engine will take care of the vertex declaration.

you see it as, i write the shader and the declarations. The user says "I want this, this and this effect" and the engine selects the predefined declarations and shaders.

Am i right?

I want to have both of these ways but if i can simplify the process from the users end then i want to do that.

So my problem is still - how do i determine the parameters of a vertex shader of a technique of an effect/shader file.

Another benefit of this is I wont have to manually write vertex declarations (these give me a headache). It will be automated.

Surely the vertex declaration will always match the vertex shader parameters.

Share this post


Link to post
Share on other sites

This topic is 4198 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this