Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBuraCULa

Posted 16 March 2012 - 10:09 AM

Hi. I am trying to implement deferred shading technique.I am encoding my normals into a render target in pixel shader.Then i am bounding shader resource view of this resource to the compute shader.In PIX, i can see that the surface is bounded to CS so everything works fine but when i try to sample any normal data it just returns "0". Here is my simple code but it doesn't work.As you can guess it is just filling surface with blue.
#define TILE_SIZE 16
RWTexture2D<float4> gOutTexture  : register(u0);
Texture2D<float2> gInputTexture  : register(t0);
/*---------------------
COMPUTE SHADER FUNC
----------------------*/
[numthreads(TILE_SIZE,TILE_SIZE,1)]
void DeferredShadingCS(uint3 groupId   : SV_GroupID,
						 uint3 dispatchThreadId : SV_DispatchThreadID,
						 uint3 groupThreadId : SV_GroupThreadID
						 )
{
float2 data = gInputTexture.Load(uint3(dispatchThreadId.xy,0));
gOutTexture[dispatchThreadId.xy] = float4(data,1,1);
}

#1BuraCULa

Posted 16 March 2012 - 10:08 AM

Hi. I am trying to implement deferred shading technique.I am encoding my normals into a render target in pixel shader.Then i am bounding shader resource view of this resource to the compute shader.In PIX, i can see that the surface is bounded to CS so everything works fine but when i try to sample any normal data it just returns "0". Here is my simple code but it doesn't work.As you can guess it just fills surface with blue.
#define TILE_SIZE 16
RWTexture2D<float4> gOutTexture  : register(u0);
Texture2D<float2> gInputTexture  : register(t0);
/*---------------------
COMPUTE SHADER FUNC
----------------------*/
[numthreads(TILE_SIZE,TILE_SIZE,1)]
void DeferredShadingCS(uint3 groupId   : SV_GroupID,
						 uint3 dispatchThreadId : SV_DispatchThreadID,
						 uint3 groupThreadId : SV_GroupThreadID
						 )
{
float2 data = gInputTexture.Load(uint3(dispatchThreadId.xy,0));
gOutTexture[dispatchThreadId.xy] = float4(data,1,1);
}

PARTNERS