seenat-variables.azsl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. static int a; // global variable
  2. static const int b; // same genre & namespace but with different qualifiers
  3. class S
  4. {
  5. bool c; // member variable
  6. bool retc()
  7. {
  8. c = b; // ref to S::c and ::b
  9. return c; // ref to S::c
  10. }
  11. struct N
  12. {
  13. struct NN
  14. {
  15. struct NNN // super nested
  16. {
  17. bool d;
  18. } nnn;
  19. } nn;
  20. } n;
  21. };
  22. static S s; // of user defined type
  23. void func(S param)
  24. {
  25. bool c = param.c; // reference to func::param and S::c
  26. bool d = param.c && true && param.c; // disturb the MemberAccess/idExpression state machine (in the end there is none)
  27. }
  28. float4 main():SV_TARGET0
  29. {
  30. func(s); // reference to ::s
  31. int c; // local variable
  32. sampler s1{}, s2; // 2 vars on the same decl
  33. c = // reference to local var c
  34. a + b; // references to global ::a and ::b
  35. if (s.n.nn.nnn.d) // ref to nested d
  36. {
  37. }
  38. S::N::NN nn = s.n.nn;
  39. if (nn.nnn.d) // ref to nested d
  40. {
  41. Texture2D tex;
  42. ((Texture2D)tex).Sample(s1, float2(0,0)); // ref to tex and s1
  43. }
  44. Texture2D tex;
  45. return float4((float)(c), tex.Sample(s2, float2(0,0)).r, 0, 1); // ref to local c, ref to tex, ref to s2
  46. }
  47. // WARNING: be careful in these files, any change will disrupt line and column numbers as checked by the seenat.py test