op.buffer.access.hlsl 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Run: %dxc -T ps_6_0 -E main
  2. // CHECK: OpCapability ImageBuffer
  3. Buffer<int> intbuf;
  4. Buffer<uint> uintbuf;
  5. Buffer<float> floatbuf;
  6. RWBuffer<int2> int2buf;
  7. RWBuffer<uint2> uint2buf;
  8. RWBuffer<float2> float2buf;
  9. Buffer<int3> int3buf;
  10. Buffer<uint3> uint3buf;
  11. Buffer<float3> float3buf;
  12. RWBuffer<int4> int4buf;
  13. RWBuffer<uint4> uint4buf;
  14. RWBuffer<float4> float4buf;
  15. void main() {
  16. int address;
  17. // CHECK: [[img1:%\d+]] = OpLoad %type_buffer_image %intbuf
  18. // CHECK: [[f1:%\d+]] = OpImageFetch %v4int [[img1]] {{%\d+}} None
  19. // CHECK-NEXT: [[r1:%\d+]] = OpCompositeExtract %int [[f1]] 0
  20. // CHECK-NEXT: OpStore %int1 [[r1]]
  21. int int1 = intbuf[address];
  22. // CHECK: [[img2:%\d+]] = OpLoad %type_buffer_image_0 %uintbuf
  23. // CHECK: [[f2:%\d+]] = OpImageFetch %v4uint [[img2]] {{%\d+}} None
  24. // CHECK-NEXT: [[r2:%\d+]] = OpCompositeExtract %uint [[f2]] 0
  25. // CHECK-NEXT: OpStore %uint1 [[r2]]
  26. uint uint1 = uintbuf[address];
  27. // CHECK: [[img3:%\d+]] = OpLoad %type_buffer_image_1 %floatbuf
  28. // CHECK: [[f3:%\d+]] = OpImageFetch %v4float [[img3]] {{%\d+}} None
  29. // CHECK-NEXT: [[r3:%\d+]] = OpCompositeExtract %float [[f3]] 0
  30. // CHECK-NEXT: OpStore %float1 [[r3]]
  31. float float1 = floatbuf[address];
  32. // CHECK: [[img4:%\d+]] = OpLoad %type_buffer_image_2 %int2buf
  33. // CHECK: [[ret4:%\d+]] = OpImageRead %v4int [[img4]] {{%\d+}} None
  34. // CHECK-NEXT: [[r4:%\d+]] = OpVectorShuffle %v2int [[ret4]] [[ret4]] 0 1
  35. // CHECK-NEXT: OpStore %int2 [[r4]]
  36. int2 int2 = int2buf[address];
  37. // CHECK: [[img5:%\d+]] = OpLoad %type_buffer_image_3 %uint2buf
  38. // CHECK: [[ret5:%\d+]] = OpImageRead %v4uint [[img5]] {{%\d+}} None
  39. // CHECK-NEXT: [[r5:%\d+]] = OpVectorShuffle %v2uint [[ret5]] [[ret5]] 0 1
  40. // CHECK-NEXT: OpStore %uint2 [[r5]]
  41. uint2 uint2 = uint2buf[address];
  42. // CHECK: [[img6:%\d+]] = OpLoad %type_buffer_image_4 %float2buf
  43. // CHECK: [[ret6:%\d+]] = OpImageRead %v4float [[img6]] {{%\d+}} None
  44. // CHECK-NEXT: [[r6:%\d+]] = OpVectorShuffle %v2float [[ret6]] [[ret6]] 0 1
  45. // CHECK-NEXT: OpStore %float2 [[r6]]
  46. float2 float2 = float2buf[address];
  47. // CHECK: [[img7:%\d+]] = OpLoad %type_buffer_image_5 %int3buf
  48. // CHECK: [[f7:%\d+]] = OpImageFetch %v4int [[img7]] {{%\d+}} None
  49. // CHECK-NEXT: [[r7:%\d+]] = OpVectorShuffle %v3int [[f7]] [[f7]] 0 1 2
  50. // CHECK-NEXT: OpStore %int3 [[r7]]
  51. int3 int3 = int3buf[address];
  52. // CHECK: [[img8:%\d+]] = OpLoad %type_buffer_image_6 %uint3buf
  53. // CHECK: [[f8:%\d+]] = OpImageFetch %v4uint [[img8]] {{%\d+}} None
  54. // CHECK-NEXT: [[r8:%\d+]] = OpVectorShuffle %v3uint [[f8]] [[f8]] 0 1 2
  55. // CHECK-NEXT: OpStore %uint3 [[r8]]
  56. uint3 uint3 = uint3buf[address];
  57. // CHECK: [[img9:%\d+]] = OpLoad %type_buffer_image_7 %float3buf
  58. // CHECK: [[f9:%\d+]] = OpImageFetch %v4float [[img9]] {{%\d+}} None
  59. // CHECK-NEXT: [[r9:%\d+]] = OpVectorShuffle %v3float [[f9]] [[f9]] 0 1 2
  60. // CHECK-NEXT: OpStore %float3 [[r9]]
  61. float3 float3 = float3buf[address];
  62. // CHECK: [[img10:%\d+]] = OpLoad %type_buffer_image_8 %int4buf
  63. // CHECK: [[r10:%\d+]] = OpImageRead %v4int [[img10]] {{%\d+}} None
  64. // CHECK-NEXT: OpStore %int4 [[r10]]
  65. int4 int4 = int4buf[address];
  66. // CHECK: [[img11:%\d+]] = OpLoad %type_buffer_image_9 %uint4buf
  67. // CHECK: [[r11:%\d+]] = OpImageRead %v4uint [[img11]] {{%\d+}} None
  68. // CHECK-NEXT: OpStore %uint4 [[r11]]
  69. uint4 uint4 = uint4buf[address];
  70. // CHECK: [[img12:%\d+]] = OpLoad %type_buffer_image_10 %float4buf
  71. // CHECK: [[r12:%\d+]] = OpImageRead %v4float [[img12]] {{%\d+}} None
  72. // CHECK-NEXT: OpStore %float4 [[r12]]
  73. float4 float4 = float4buf[address];
  74. }