op.structured-buffer.access.hlsl 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Run: %dxc -T ps_6_0 -E main
  2. struct S {
  3. float f;
  4. };
  5. struct T {
  6. float a;
  7. float2 b[2];
  8. float3x4 c[3];
  9. S s[2];
  10. float t[4];
  11. };
  12. StructuredBuffer<T> MySbuffer;
  13. float4 main(uint index: A) : SV_Target {
  14. // CHECK: [[a:%\d+]] = OpAccessChain %_ptr_Uniform_float %MySbuffer %int_0 %uint_0 %int_0
  15. // CHECK-NEXT: {{%\d+}} = OpLoad %float [[a]]
  16. // CHECK: [[b1:%\d+]] = OpAccessChain %_ptr_Uniform_v2float %MySbuffer %int_0 %uint_1 %int_1 %int_1
  17. // CHECK-NEXT: [[x:%\d+]] = OpAccessChain %_ptr_Uniform_float [[b1]] %int_0
  18. // CHECK-NEXT: {{%\d+}} = OpLoad %float [[x]]
  19. // CHECK: [[c12:%\d+]] = OpAccessChain %_ptr_Uniform_float %MySbuffer %int_0 %uint_2 %int_2 %int_2 %uint_1 %uint_2
  20. // CHECK-NEXT: {{%\d+}} = OpLoad %float [[c12]]
  21. // CHECK: [[s:%\d+]] = OpAccessChain %_ptr_Uniform_float %MySbuffer %int_0 %uint_3 %int_3 %int_0 %int_0
  22. // CHECK-NEXT: {{%\d+}} = OpLoad %float [[s]]
  23. // CHECK: [[index:%\d+]] = OpLoad %uint %index
  24. // CHECK-NEXT: [[t:%\d+]] = OpAccessChain %_ptr_Uniform_float %MySbuffer %int_0 [[index]] %int_4 %int_3
  25. // CHECK-NEXT: {{%\d+}} = OpLoad %float [[t]]
  26. return MySbuffer[0].a + MySbuffer[1].b[1].x + MySbuffer[2].c[2][1][2] +
  27. MySbuffer[3].s[0].f + MySbuffer[index].t[3];
  28. }