res_select.hlsl 599 B

123456789101112131415161718192021222324252627282930
  1. // RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
  2. // Make sure resource select inside loop works.
  3. // CHECK: bufferLoad
  4. RWStructuredBuffer<float2x2> oA;
  5. RWStructuredBuffer<float2x2> oB;
  6. StructuredBuffer<float2x2> iA;
  7. StructuredBuffer<float2x2> iB;
  8. uint s;
  9. [numthreads(8,8,1)]
  10. void main( uint2 tid : SV_DispatchThreadID, uint2 gid : SV_GroupID, uint2 gtid : SV_GroupThreadID, uint gidx : SV_GroupIndex )
  11. {
  12. [unroll]
  13. for (uint i=0;i<4;i++) {
  14. RWStructuredBuffer<float2x2> o = oA;
  15. StructuredBuffer<float2x2> ibuf = iA;
  16. if (i > 2) {
  17. o = oB;
  18. ibuf = iB;
  19. }
  20. o[gid.x] = ibuf[gid.x];
  21. }
  22. }