rawBufferStore.hlsl 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // RUN: %dxc -enable-16bit-types -Emain -Tcs_6_3 %s | %opt -S -hlsl-dxil-pix-shader-access-instrumentation,config=U0:2:10i0;.. | %FileCheck %s
  2. // Check that the expected PIX UAV read-tracking is emitted (the atomicBinOp "|= 1") followed by the expected raw read:
  3. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 24, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  4. // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32
  5. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 24, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  6. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  7. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 24, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  8. // CHECK: call %dx.types.ResRet.f16 @dx.op.rawBufferLoad.f16
  9. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 24, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  10. // CHECK: call %dx.types.ResRet.i16 @dx.op.rawBufferLoad.i16
  11. // Now the writes with atomicBinOp "|=2":
  12. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 28, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  13. // CHECK: call void @dx.op.rawBufferStore.f32
  14. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 28, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  15. // CHECK: call void @dx.op.rawBufferStore.i32
  16. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 28, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  17. // CHECK: call void @dx.op.rawBufferStore.f16
  18. // CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %PIX_CountUAV_Handle, i32 28, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i8 1)
  19. // CHECK: call void @dx.op.rawBufferStore.i16
  20. struct S
  21. {
  22. float4 f4;
  23. int4 i4;
  24. half hf;
  25. min16int hi;
  26. };
  27. RWStructuredBuffer<S> structuredUAV: register(u0);
  28. [RootSignature(
  29. "DescriptorTable(UAV(u0, numDescriptors = 1, space = 0, offset = DESCRIPTOR_RANGE_OFFSET_APPEND))"
  30. )]
  31. [numthreads(1, 1, 1)]
  32. void main()
  33. {
  34. S s = structuredUAV[0];
  35. s.f4 += float4(1, 1, 1, 1);
  36. s.i4 += int4(1, 1, 1, 1);
  37. s.hi += 2;
  38. s.hf += 3.;
  39. structuredUAV[0] = s;
  40. }