right_branch.hlsl 619 B

12345678910111213141516171819202122232425
  1. // RUN: %dxc -E main -T ps_6_0 %s -Od | FileCheck %s
  2. // Make sure DxilValueCache actually predicts the correct branch
  3. Texture2D tex0 : register(t0);
  4. Texture2D tex1 : register(t42);
  5. [RootSignature("DescriptorTable(SRV(t0), SRV(t42))")]
  6. float4 main() : SV_Target {
  7. // CHECK: %[[handle:.+]] = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 42
  8. float x = 10;
  9. float y = x + 5;
  10. float z = y * 2;
  11. float w = z / 0.5;
  12. Texture2D tex = tex0;
  13. if (w >= 0) {
  14. tex = tex1;
  15. }
  16. // CHECK: @dx.op.textureLoad.f32(i32 66, %dx.types.Handle %[[handle]]
  17. return tex.Load(0) + float4(x,y,z,w);
  18. }