DynamicResourceOutOfBounds.hlsl 963 B

12345678910111213141516171819
  1. // RUN: %dxc -EMain -Tcs_6_6 %s | %opt -S -hlsl-dxil-pix-shader-access-instrumentation,config=.256;272;1024. | %FileCheck %s
  2. static RWByteAddressBuffer DynamicBuffer = ResourceDescriptorHeap[1];
  3. [numthreads(1, 1, 1)]
  4. void Main()
  5. {
  6. uint val = DynamicBuffer.Load(0u);
  7. DynamicBuffer.Store(0u, val);
  8. }
  9. // check it's 6.6:
  10. // CHECK: call %dx.types.Handle @dx.op.createHandleFromBinding
  11. // The start of resource records has been passed in as 256. The limit of resource records is 272. 272-256 = 16.
  12. // 8 bytes per record means we have one record for out-of-bounds (that comes first), and one record for resource index 0.
  13. // The above HLSL references resource descriptor 1, so is out-of-bounds. Offset for out-of-bounds should thus be 256:
  14. // The large integer is encoded flags for the ResourceAccessStyle (an enumerated type in lib\DxilPIXPasses\DxilShaderAccessTracking.cpp) for this access
  15. // CHECK:i32 256, i32 undef, i32 1375731712
  16. // CHECK:rawBufferLoad