Jump to content
  • Advertisement
Sign in to follow this  
coolhelix

How can I get annotation of function parameter in vertex shader?

This topic is 3676 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, guys, For some reason, I want to add some annotation to my vertex shader function. The code would something like this ...... VS_OUTPUT vs_main( float4 Position : POSITION0 <string Token = "ModelPosition";>) { ...... } The compiling is fine. My question is how to use D3D interface to get the annotation of "Token" here. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Normally you look for the ::GetAnnotation*() type functions on ID3DXEffect - they're pretty straight forward.

However, in your case I wouldn't expect it to work. Only in the latest shader models and compilers do functions truly exist and prior to this they were all inlined by the compiler such that they aren't visible on any public interface - you probably can't even see them in the ASM output except in debug/non-optimized modes.

Annotations are more for global constants or technique/pass descriptions, not for function parameters.

hth
Jack

Share this post


Link to post
Share on other sites
hmm, all that said you might want to try making calls to ID3DXEffect::GetParameter() using the D3DXHANDLE for the function (found via ID3DXEffect::GetFunction()). At the very least you should be able to annotate your VS_INPUT struct if you were to refactor your parameter list to that form...

hth
Jack

Share this post


Link to post
Share on other sites
Thanks.

Like you said, if I could add some annotations to the struct, that would be better.
I tried, but compiling was failed.

Failed Case 1:

struct VS_INPUT
{
float4 Position : POSITION0;
float Height: TEXCOORD0;
float2 TextureUV: TEXCOORD1;
}
<
string Notes1 = "Terrain Vertex";
string Notes2 = "Terrain Height";
string Notes3 = "Terrain Texture";
> ;


Failed Case 2:

struct VS_INPUT
{
float4 Position : POSITION0 <string Notes1 = "Terrain Vertex";> ;
float Height: TEXCOORD0 <string Notes2 = "Terrain Height";> ;
float2 TextureUV: TEXCOORD1 <string Notes3 = "Terrain Texture";>;
};

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!