How can I get annotation of function parameter in vertex shader?
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!
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
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
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
hth
Jack
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:
Failed Case 2:
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";>;};
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement