Sign in to follow this  
schupf

HLSL register

Recommended Posts

schupf    221
Hello!

I have 2 little questions about HLSL shader registers:

1. According to this site: http://en.wikipedia.org/wiki/High_Level_Shader_Language , VS 3.0 offers at least 256 constant registers. Does this number refer to the number of the float registers c0, c1 etc. or is this the sum of ALL registers (integer, float and bool registers)?

2. If I want to update a single float variable in my shader per SetVertexShaderConstantF, is the following code correct?
[code]
float foo = ... // This is the value I want to put in the shader variable
float data[4] = { foo, 0, 0, 0 };
device->SetVertexShaderConstant(0, data, 1);
[/code]
Is this code correct? I need this float array, don't I?

Share this post


Link to post
Share on other sites
MJP    19788
1. The number of registers is here: [url="http://msdn.microsoft.com/en-us/library/bb172963%28v=vs.85%29.aspx"]http://msdn.microsoft.com/en-us/library/bb172963%28v=vs.85%29.aspx[/url]

2. You'll need to pass a pointer to 4 floats minimum. So you can either use an array like that, or you can use a structure (like D3DXVECTOR4) that has 4 contiguous floats in memory.

Share this post


Link to post
Share on other sites

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