init_use.hlsl 385 B

123456789101112131415161718192021222324252627
  1. // RUN: %dxr -E main -remove-unused-globals %s | FileCheck %s
  2. // Make sure global used for init is not removed.
  3. // CHECK:float c;
  4. // CHECK:float a;
  5. // CHECK:float d;
  6. // CHECK:int e;
  7. float c;
  8. float a;
  9. struct S {
  10. float x;
  11. float b;
  12. };
  13. static S s = {c, a};
  14. float d;
  15. static uint cast = d;
  16. int e;
  17. static int init = e;
  18. float main() : SV_Target {
  19. return s.x + s.b + cast + init;
  20. }