Jump to content
  • Advertisement
Sign in to follow this  
gsamour

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

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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by gsamour
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?


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

Share this post


Link to post
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.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!