Sign in to follow this  

HLSL semantics

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

This might be a stupid question, but I've been using FX Composer and RenderMonkey to experiment with some shaders. For simple constants like the World matrix, or View matrix, can these be set in a shader by specifying : float4x4 matWorld : WORLD; float4x4 matView: VIEW; or do you have to set them manually with the ID3DXEffect's SetMatrix() function? debugging into my program, it looks like the semantics have been set in the effect's ParamDescriptions, but the shader will not work correctly until I set them myself. Is there a way around this? Thanks a lot!

Share this post


Link to post
Share on other sites
The effect does not know the world and view matrices automatically. You'll have to set them yourself.

I haven't got a lot of experience, but if I understand the documentation correctly (see HLSL Semantics), the "WORLD" and "VIEW" semantics are just arbitrary strings. The system does not interpret them or automatically set these values.
You can, however, use that semantics to access matWorld and matView in your application.

Share this post


Link to post
Share on other sites
You can write into your effect something like this
uniform extern float4x4 matWVP;
and then you set the value manually with the ID3DXEffect's SetMatrix() function;

Share this post


Link to post
Share on other sites
"WORLD" and "VIEW" are just ways for the programs you use (RenderMonkey...) to find which variables to set in the shader. They would then use SetMatrix for them, like you would do. They have no meaning for Direct3D itself.

Share this post


Link to post
Share on other sites

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