• Advertisement
Sign in to follow this  

Which function do I use by defining the float2 array in shader code

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

Which function do I use by defining the float2 array in shader code? In shader code,I define a array of float2 called SeedPos,as below: float2 SeedPos[10]; But I in the c++, I do not know which function should I use to send data to shader, SetVector or SetArray? SetVector is 4-dimensions SetFloatArray is One-dimension The float2 is 2-dimensions. [Edited by - akira32 on July 11, 2008 8:11:43 AM]

Share this post


Link to post
Share on other sites
Advertisement
You can use either. I think that float2 takes up 4 floats of storage anyway, or is at least aligned as such. When using SetVector it'll effectively just use the first two values. SetArray with a length of two works just as well.

Share this post


Link to post
Share on other sites
D3DXVECTOR2 sampleOffsets[MAX_SAMPLES];
g_pEffect->SetValue("g_sampleOffsets", sampleOffsets, sizeof(sampleOffsets));


Could I use the SetValue function to set the 2d-value array to shader?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement