SetPixelShaderConstantI (setting register values to ints) is not working [solved]

This topic is 3265 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi, I'm trying to send integer values to my pixel shader using a call like the following: int values[4] = { 1, 2, 3, 4 }; pDXDevice->SetPixelShaderConstantI(4, values, 1); So I'm trying to set a vector4 of int values on register c4 (or starting at register c4). In my HLSL shader I have declared an int4 that corresponds to register c4. int4 testval : register(c4); When I debug a pixel with PIX for Windows, I check the value of "testval" (shows up as the register "c4") and it shows { 0.000, 0.000, 0.000, 0.000 }. Does anyone know why it doesn't receive the values I'm sending it (1,2,3,4) ? Maybe I'm not understanding what SetPixelShaderConstantI does... or how to call it... (but I do get an S_OK return value)... Any help is appreciated! Thanks [Edited by - gsamour on October 12, 2009 5:16:04 PM]

Share on other sites
Have you set dev->SetPixelShader() prior to the call?

Share on other sites
Yes, I'm calling SetPixelShader() before calling SetPixelShaderConstantI(). If I call SetPixelShaderConstantF() (the float4 version) it works... it's just the int4 version that doesn't work...

Share on other sites
I'm trying to find a list of gpu registers, but haven't been successful. If c1 is not an integer register, could you give me an example of an integer register?

Share on other sites
Quote:
 Original post by gsamourI'm trying to find a list of gpu registers, but haven't been successful. If c1 is not an integer register, could you give me an example of an integer register?

There's a list for each shader profile. The links I gave you came from the list of ps_3_0 registers.

Share on other sites
Thanks for the information! I tried using the "i%" registers before but got an HLSL compile error:

invalid register semantic 'i0', or variable must be bound to multiple register banks (c register binding required)

I didn't understand what it was before, and thought that "i%" registers didn't exist (which is why I tried with the c's) but after searching for the error I found that apparently integer registers can only be used for looping and not for arithmetic operations.

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
18
5. 5

• 9
• 33
• 13
• 13
• 10
• Forum Statistics

• Total Topics
632582
• Total Posts
3007216

×