op.rwbuffer.access.hlsl 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Run: %dxc -T ps_6_0 -E main
  2. // CHECK: OpCapability ImageBuffer
  3. RWBuffer<int> intbuf;
  4. RWBuffer<uint> uintbuf;
  5. RWBuffer<float> floatbuf;
  6. RWBuffer<int3> int3buf;
  7. RWBuffer<uint3> uint3buf;
  8. RWBuffer<float3> float3buf;
  9. // CHECK: [[int_1_2_3:%\d+]] = OpConstantComposite %v3int %int_1 %int_2 %int_3
  10. // CHECK: [[uint_4_5_6:%\d+]] = OpConstantComposite %v3uint %uint_4 %uint_5 %uint_6
  11. // CHECK: [[float_7_8_9:%\d+]] = OpConstantComposite %v3float %float_7 %float_8 %float_9
  12. void main() {
  13. // CHECK: [[img1:%\d+]] = OpLoad %type_buffer_image %intbuf
  14. // CHECK-NEXT: OpImageWrite [[img1]] %uint_1 %int_1
  15. intbuf[1] = int(1);
  16. // CHECK: [[img2:%\d+]] = OpLoad %type_buffer_image_0 %uintbuf
  17. // CHECK-NEXT: OpImageWrite [[img2]] %uint_2 %uint_2
  18. uintbuf[2] = uint(2);
  19. // CHECK: [[img3:%\d+]] = OpLoad %type_buffer_image_1 %floatbuf
  20. // CHECK-NEXT: OpImageWrite [[img3]] %uint_3 %float_3
  21. floatbuf[3] = float(3);
  22. // CHECK: [[img7:%\d+]] = OpLoad %type_buffer_image_2 %int3buf
  23. // CHECK-NEXT: OpImageWrite [[img7]] %uint_7 [[int_1_2_3]]
  24. int3buf[7] = int3(1,2,3);
  25. // CHECK: [[img8:%\d+]] = OpLoad %type_buffer_image_3 %uint3buf
  26. // CHECK-NEXT: OpImageWrite [[img8]] %uint_8 [[uint_4_5_6]]
  27. uint3buf[8] = uint3(4,5,6);
  28. // CHECK: [[img9:%\d+]] = OpLoad %type_buffer_image_4 %float3buf
  29. // CHECK-NEXT: OpImageWrite [[img9]] %uint_9 [[float_7_8_9]]
  30. float3buf[9] = float3(7,8,9);
  31. }