330.frag 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #version 330 compatibility
  2. in vec4 inVar;
  3. layout(location=0, index=0) out vec4 outVar;
  4. varying vec4 varyingVar;
  5. void main()
  6. {
  7. gl_FragColor = varyingVar; // link ERROR: user output was used
  8. gl_FragData[1] = inVar; // link ERROR: user output was used
  9. int buffer = 4;
  10. }
  11. #extension GL_ARB_separate_shader_objects : enable
  12. in gl_PerFragment {
  13. vec4 gl_Color;
  14. };
  15. void foo()
  16. {
  17. vec4 c = gl_Color;
  18. outVar = inVar;
  19. }
  20. in gl_block { // ERROR
  21. int gl_i;
  22. } gl_name;
  23. in myBlock {
  24. int gl_i; // ERROR
  25. } gl_name; // ERROR
  26. in gl_PerVertex { // ERROR
  27. vec4 gl_FragCoord;
  28. } gl_in[];
  29. in gl_PerVertex { // ERROR
  30. vec4 gl_FragCoord;
  31. }; // ERROR
  32. const int start = 6;
  33. layout(location = -2) in vec4 v1; // ERROR
  34. layout(location = start + 2) in vec4 v2; // ERROR
  35. layout(location = 4.7e10) in vec4 v20; // ERROR
  36. layout(location = +60) in float v21; // ERROR
  37. layout(location = (2)) in float v22; // ERROR
  38. struct S {
  39. float f1;
  40. layout(location = 3) float f2; // ERROR
  41. };
  42. layout(location = 1) in inblock { // ERROR
  43. float f1;
  44. layout(location = 3) float f2; // ERROR
  45. };
  46. layout(location = 1) uniform ublock { // ERROR
  47. float f1;
  48. layout(location = 3) float f2; // ERROR
  49. } uinst;
  50. #extension GL_ARB_enhanced_layouts : enable
  51. layout(location = start) in vec4 v3;
  52. layout(location = -2) in vec4 v4; // ERROR
  53. layout(location = -start) in vec4 v5; // ERROR
  54. layout(location = start*start - 2 - 4) in vec4 v6;
  55. layout(location = +61) in float v23;
  56. layout(location = (62)) in float v24;
  57. struct S2 {
  58. float f1;
  59. layout(location = 3) float f2; // ERROR
  60. };
  61. layout(location = 28) in inblock2 {
  62. bool b1;
  63. float f1;
  64. layout(location = 25) float f2;
  65. vec4 f3;
  66. layout(location = 21) S2 s2;
  67. vec4 f4;
  68. vec4 f5;
  69. } ininst2;
  70. layout(location = 13) uniform ublock2 { // ERROR
  71. float f1;
  72. layout(location = 3) float f2; // ERROR
  73. } uinst2;
  74. in inblock3 { // ERROR, mix of location internal with no location external
  75. float f1;
  76. layout(location = 40) float f2;
  77. } in3;
  78. in ublock4 {
  79. layout(location = 50) float f1;
  80. layout(location = 51) float f2;
  81. } in4;
  82. layout(location = 33) in struct SS {
  83. vec3 a; // gets location 33
  84. mat2 b; // gets locations 34 and 35
  85. vec4 c[2]; // gets locations 36 and 37
  86. layout (location = 38) vec2 A; // ERROR, can't use on struct member
  87. } s;
  88. layout(location = 44) in block {
  89. vec4 d; // gets location 44
  90. vec4 e; // gets location 45
  91. layout(location = 47) vec4 f; // gets location 47
  92. vec4 g; // gets location 48
  93. layout (location = 41) vec4 h; // gets location 41
  94. vec4 i; // gets location 42
  95. vec4 j; // gets location 43
  96. vec4 k; // ERROR, location 44 already used
  97. };
  98. layout(index=0) out vec4 outVar2; // ERROR: missing explicit location
  99. layout(location=0, index=1) out vec4 outVar3; // no error even though location is overlapping
  100. layout(location=0, index=1) out vec4 outVar4; // ERROR overlapping
  101. layout(location=27, index=0) in vec4 indexIn; // ERROR, not on in
  102. layout(location=0, index=0) in; // ERROR, not just on in
  103. layout(location=0, index=0) out; // ERROR, need a variable
  104. layout(location=26, index=0) out indexBlock { int a; } indexBlockI; // ERROR, not on a block
  105. uniform sampler1D samp1D;
  106. uniform sampler2DShadow samp2Ds;
  107. void qlod()
  108. {
  109. vec2 lod;
  110. float pf;
  111. vec2 pf2;
  112. vec3 pf3;
  113. lod = textureQueryLod(samp1D, pf); // ERROR, not until 400
  114. lod = textureQueryLod(samp2Ds, pf2); // ERROR, not until 400
  115. }
  116. int precise; // okay, not a keyword yet
  117. struct SKeyMem { int precise; } KeyMem; // okay, not a keyword yet
  118. void fooKeyMem()
  119. {
  120. KeyMem.precise;
  121. }
  122. layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range