structInBuffer2.hlsl 440 B

12345678910111213141516171819202122
  1. // RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
  2. // CHECK: @main
  3. struct Foo {
  4. int a[2];
  5. int d[2];
  6. };
  7. Buffer<Foo> inputs : register(t1);
  8. RWBuffer< int > g_Intensities : register(u1);
  9. groupshared Foo sharedData;
  10. [ numthreads( 64, 2, 2 ) ]
  11. void main( uint GI : SV_GroupIndex)
  12. {
  13. if (GI==0)
  14. sharedData = inputs[GI];
  15. int rtn;
  16. InterlockedAdd(sharedData.d[0], g_Intensities[GI], rtn);
  17. g_Intensities[GI] = rtn + sharedData.d[0];
  18. }