cfg2.hlsl 905 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // RUN: %dxc -E main -T ps_6_0 -Od %s | FileCheck %s
  2. // Make sure unused resources are handled even when
  3. // they're arrays.
  4. // CHECK: @main
  5. static bool gG;
  6. static bool gG2;
  7. static bool gG3;
  8. Texture2D tex0 : register(t0);
  9. Texture2D tex1 : register(t42);
  10. Texture2D tex2 : register(t2);
  11. Texture2D tex3 : register(t3);
  12. Texture2D f(bool foo) {
  13. [branch]
  14. if (foo)
  15. return tex0;
  16. else
  17. return tex1;
  18. }
  19. Texture2D g(bool foo) {
  20. [branch]
  21. if (foo)
  22. return tex2;
  23. else
  24. return tex3;
  25. }
  26. Texture2D h(bool foo3) {
  27. return foo3 ? f(gG2) : g(gG3);
  28. }
  29. [RootSignature("DescriptorTable(SRV(t0, numDescriptors=4), SRV(t42))")]
  30. float4 main() : sv_target {
  31. // CHECK: %[[handle:.+]] = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 42
  32. gG = true;
  33. gG2 = false;
  34. gG3 = false;
  35. // CHECK: @dx.op.textureLoad.f32(i32 66, %dx.types.Handle %[[handle]]
  36. return h(gG).Load(0);
  37. };