Skip to main content
GameDev.net gamedev.net
🔒 Locked

Load(HLSL Texture Object) error

Started by chenpan Jul 11, 2011 at 6:02 AM 0 replies 1k views
Original Post
chenpan
chenpan
In vertex shader, I am trying to load texels' value in the way showing below.

Texture2D<float4> g_Disparity;
MipMapPSInput CopyTextureVS(StereoVSInput input)
{
MipMapPSInput output;
uint width, height;
g_Disparity.GetDimensions(width, height);
output.pos.x = 2 * (float)input.pos.x / width - 1;
output.pos.y = 1 - 2 * (float)input.pos.y / height;
output.pos.z = 0.0f;
output.pos.w = 1.0f;
float4 color = g_Disparity.Load(int3(input.pos.x, input.pos.y,0));
output.color = color.x;
return output;
}

In PIX, when I debug the vertex shader.
After float4 color = g_Disparity.Load(int3(input.pos.x, input.pos.y,0));
executed . Variable color's value was ( 0.000, _, _, _ ) .While the value in texture g_Disparity is (4.635, 0,0, 0).
How to get texel value correctly?
Thank you for your help.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.