AccessTracking.hlsl 1004 B

1234567891011121314151617181920212223242526272829
  1. // RUN: %dxc -ECSMain -Tcs_6_0 %s | %opt -S -hlsl-dxil-pix-shader-access-instrumentation,config=S0:1:1i1;U0:2:10i0;.. | %FileCheck %s
  2. // Check we added the UAV:
  3. // CHECK: %PIX_CountUAV_Handle = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 1, i32 1, i32 0, i1 false)
  4. // check for correct out-of-bounds calculation
  5. // CHECK: CompareWithSlotLimit = icmp uge i32
  6. // CHECK: CompareWithSlotLimitAsUint = zext i1 %CompareWithSlotLimit to i32
  7. // CHECK: IsInBounds = sub i32 1, %CompareWithSlotLimitAsUint
  8. // CHECK: SlotDwordOffset = add i32
  9. // CHECK: SlotByteOffset = mul i32
  10. // CHECK: slotIndex = mul i32
  11. // Check for udpate of UAV:
  12. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle
  13. ByteAddressBuffer inBuffer : register(t0);
  14. RWByteAddressBuffer bufferArray[] : register(u0);
  15. [numthreads(1, 1, 1)]
  16. void CSMain()
  17. {
  18. // Simple read
  19. uint dynamicBufferIndex = inBuffer.Load(0);
  20. // Dynamically indexed write
  21. bufferArray[dynamicBufferIndex].Store(0, 1);
  22. }