var.resource.array.hlsl 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Run: %dxc -T ps_6_0 -E main
  2. // CHECK: OpDecorate %MyBuffer DescriptorSet 0
  3. // CHECK: OpDecorate %MyBuffer Binding 0
  4. // CHECK: OpDecorate %MyRWBuffer DescriptorSet 0
  5. // CHECK: OpDecorate %MyRWBuffer Binding 1
  6. // CHECK: OpDecorate %MyTexture DescriptorSet 0
  7. // CHECK: OpDecorate %MyTexture Binding 2
  8. // CHECK: OpDecorate %MyRWTexture DescriptorSet 0
  9. // CHECK: OpDecorate %MyRWTexture Binding 3
  10. // CHECK: OpDecorate %MySamplers DescriptorSet 0
  11. // CHECK: OpDecorate %MySamplers Binding 4
  12. // CHECK: OpDecorate %MyCompSamplers DescriptorSet 0
  13. // CHECK: OpDecorate %MyCompSamplers Binding 5
  14. // CHECK: %type_buffer_image = OpTypeImage %float Buffer 2 0 0 1 Rgba32f
  15. // CHECK: %_arr_type_buffer_image_uint_1 = OpTypeArray %type_buffer_image %uint_1
  16. // CHECK: %type_buffer_image_0 = OpTypeImage %float Buffer 2 0 0 2 Rgba32f
  17. // CHECK: %_arr_type_buffer_image_0_uint_2 = OpTypeArray %type_buffer_image_0 %uint_2
  18. // CHECK: %type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown
  19. // CHECK: %_arr_type_2d_image_uint_3 = OpTypeArray %type_2d_image %uint_3
  20. // CHECK: %type_2d_image_0 = OpTypeImage %float 2D 2 0 0 2 Rgba32f
  21. // CHECK: %_arr_type_2d_image_0_uint_4 = OpTypeArray %type_2d_image_0 %uint_4
  22. // CHECK: %type_sampler = OpTypeSampler
  23. // CHECK: %_arr_type_sampler_uint_5 = OpTypeArray %type_sampler %uint_5
  24. // CHECK: %_arr_type_sampler_uint_6 = OpTypeArray %type_sampler %uint_6
  25. // CHECK: %MyBuffer = OpVariable %_ptr_UniformConstant__arr_type_buffer_image_uint_1 UniformConstant
  26. Buffer<float4> MyBuffer[1];
  27. // CHECK: %MyRWBuffer = OpVariable %_ptr_UniformConstant__arr_type_buffer_image_0_uint_2 UniformConstant
  28. RWBuffer<float4> MyRWBuffer[2];
  29. // CHECK: %MyTexture = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_3 UniformConstant
  30. Texture2D<float4> MyTexture[3];
  31. // CHECK: %MyRWTexture = OpVariable %_ptr_UniformConstant__arr_type_2d_image_0_uint_4 UniformConstant
  32. RWTexture2D<float4> MyRWTexture[4];
  33. // CHECK: %MySamplers = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_5 UniformConstant
  34. SamplerState MySamplers[5];
  35. // CHECK: %MyCompSamplers = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_6 UniformConstant
  36. SamplerComparisonState MyCompSamplers[6];
  37. // TODO: unsized arrays of resources
  38. float4 main() : SV_Target {
  39. // CHECK: [[MyBuffer:%\d+]] = OpAccessChain %_ptr_UniformConstant_type_buffer_image %MyBuffer %int_0
  40. // CHECK: {{%\d+}} = OpLoad %type_buffer_image [[MyBuffer]]
  41. return MyBuffer[0].Load(1) +
  42. // CHECK: [[MyRWBuffer:%\d+]] = OpAccessChain %_ptr_UniformConstant_type_buffer_image_0 %MyRWBuffer %int_1
  43. // CHECK: {{%\d+}} = OpLoad %type_buffer_image_0 [[MyRWBuffer]]
  44. MyRWBuffer[1][2] +
  45. // CHECK: [[MyTexture:%\d+]] = OpAccessChain %_ptr_UniformConstant_type_2d_image %MyTexture %int_2
  46. // CHECK: {{%\d+}} = OpLoad %type_2d_image [[MyTexture]]
  47. // CHECK: [[MySampler:%\d+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %MySamplers %int_3
  48. // CHECK: {{%\d+}} = OpLoad %type_sampler [[MySampler]]
  49. MyTexture[2].Sample(MySamplers[3], float2(0.1, 0.2));
  50. }