0

I got a problem about intelockeded in HLSL compute shader. Here is my Code

RWTexture2D<uint>  TileNum:register(u0);
 //Texture size is same with all group size(Context->Dispantch(x,y,z))
[numthreads(32, 32, 1)]//max 1024
 void main(uint3 TileIndex : SV_GROUPID)
 {
     uint src=0;
     InterlockedAdd(TileLightNum[TileIndex.xy],1,src);
 }

Then I read texture data to cpu. In fact,the number of thread of a group is 1024 (max).I suppose the every (x,y) coordinate value is 1024.But the value is 64(dedicated card) or 32(integrated card).can someone tell what happen in hlsl? Thank you so much!

F.Eazism
  • 43
  • 10

1 Answers1

0

OK. I have found it. It's all driver's fault. AMD R7 M256 newest driver! If read Texture with R32_UINT format. After copying resource from RwTexture I need do like this:

 for(UINT i=0; i < height; ++i)
   for(UINT j=0; j < width; ++j)
   {
     *p[i*2*width + j] //get value 
   }
SurvivalMachine
  • 7,946
  • 15
  • 57
  • 87
F.Eazism
  • 43
  • 10