430scope.vert 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #version 430 core
  2. int f(int a, int b, int c)
  3. {
  4. int a = b; // ERROR, redefinition
  5. {
  6. float a = float(a) + 1.0; // okay
  7. }
  8. return a;
  9. }
  10. int f(int a, int b, int c); // okay to redeclare
  11. bool b;
  12. float b(int a); // ERROR: redefinition
  13. float c(int a);
  14. bool c; // ERROR: redefinition
  15. float f; // ERROR: redefinition
  16. float tan; // okay, hides built-in function
  17. float sin(float x); // okay, can redefine built-in functions
  18. float cos(float x) // okay, can redefine built-in functions
  19. {
  20. return 1.0;
  21. }
  22. bool radians(bool x) // okay, can overload built-in functions
  23. {
  24. return true;
  25. }
  26. invariant gl_Position;
  27. void main()
  28. {
  29. int g(); // okay
  30. g();
  31. float sin; // okay
  32. sin;
  33. sin(0.7); // ERROR, use of hidden function
  34. f(1,2,3);
  35. float f; // hides f()
  36. f = 3.0;
  37. gl_Position = vec4(f);
  38. for (int f = 0; f < 10; ++f)
  39. ++f;
  40. int x = 1;
  41. {
  42. float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
  43. int z = z; // ERROR: z not previously defined.
  44. }
  45. {
  46. int x = x; // x is initialized to '1'
  47. }
  48. struct S
  49. {
  50. int x;
  51. };
  52. {
  53. S S = S(0); // 'S' is only visible as a struct and constructor
  54. S.x; // 'S' is now visible as a variable
  55. }
  56. int degrees;
  57. degrees(3.2); // ERROR, use of hidden built-in function
  58. }