Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Texture2D load problem in CS


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 BuraCULa   Members   -  Reputation: 105

Like
0Likes
Like

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 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);
}


Sponsor:

#2 MJP   Moderators   -  Reputation: 11736

Like
1Likes
Like

Posted 16 March 2012 - 01:16 PM

Do you still have the texture bound as a render target? You'll need to unset it as a render target before you bind it as a shader resource view for any pipeline stage, otherwise it will get set to NULL by the runtime. If you aren't already, you should create your device with the D3D11_CREATE_DEVICE_DEBUG flag. This will cause the runtime to output warning/error messages to the debug output that will tell you about problems like this.

#3 BuraCULa   Members   -  Reputation: 105

Like
0Likes
Like

Posted 17 March 2012 - 06:26 AM

Yes i didn't know i have to unset it before bounding it to CS.Now it is working well.Thank you MJP Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS