phi.hlsl 919 B

123456789101112131415161718192021222324252627
  1. // RUN: %dxc -E main -T ps_6_0 %s -Od | FileCheck %s
  2. // CHECK: Offsets to texture access operations must be immediate values
  3. // Regression test that DxilValueCache (DVC) isn't so over-zealous.
  4. // There was a bug where DVC decides for a PHI node, the predecessor that is
  5. // always reachable must always be the block that branched to it, and could
  6. // therefore take on its incoming value (assuming the value dominates the PHI
  7. // node)
  8. // In the case below, the value of 'x' at the sample statement is not decidable
  9. // at compile time. This test makes sure the compilation fails and displays the
  10. // correct message.
  11. Texture2D tex0 : register(t0);
  12. SamplerState samp0 : register(s0);
  13. [RootSignature("DescriptorTable(SRV(t0)), DescriptorTable(Sampler(s0))")]
  14. float4 main(float2 uv : TEXCOORD, int a : A, int b : B) : SV_Target {
  15. int x = 0;
  16. if (a > b) {
  17. x = 1;
  18. }
  19. return tex0.Sample(samp0, uv, int2(x,x));
  20. }