load.hlsl 671 B

12345678910111213141516171819202122232425262728
  1. // RUN: %dxc -E main -T ps_6_0 %s -Od | FileCheck %s
  2. Texture2D tex0 : register(t0);
  3. Texture2D tex1 : register(t42);
  4. const static float2 my_offsets[] = {
  5. float2(1,2),
  6. float2(3,4),
  7. float2(5,6),
  8. float2(7,8),
  9. };
  10. [RootSignature("DescriptorTable(SRV(t0), SRV(t42)), DescriptorTable(Sampler(s0))")]
  11. float4 main(uint2 uv : TEXCOORD) : SV_Target {
  12. // CHECK: %[[handle:.+]] = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 42
  13. int x = 0;
  14. int y = 0;
  15. float2 val = my_offsets[x+y+1];
  16. Texture2D tex = tex0;
  17. if (val.x > 0) {
  18. tex = tex1;
  19. }
  20. // CHECK: @dx.op.textureLoad.f32(i32 66, %dx.types.Handle %[[handle]]
  21. return tex.Load(0);
  22. }