440.vert 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #version 440
  2. // Note 'location' tests for enhanced layouts are in 330.frag
  3. layout(location = 2, component = 2) in vec2 a;
  4. layout(location = 2, component = 1) in float b;
  5. layout(location = 3, component = 2) in vec3 c; // ERROR: c overflows components 2 and 3
  6. layout(location = 0, component = 3) in float d[4];
  7. layout(location = 4, component = 0) in vec3 e[5];
  8. layout(location = 4, component = 3) in float f[5];
  9. layout(location = 9, component = 4) in float g[6]; // ERROR, component too big
  10. layout(location = 4, component = 2) in vec2 h; // component overlap okay for vertex in
  11. layout(location = 3, component = 2) out vec2 i;
  12. layout(location = 3, component = 0) out vec2 j;
  13. layout(location = 4, component = 2) out vec2 k;
  14. layout(location = 4, component = 2) out vec2 m; // ERROR, component overlap
  15. layout(location = 2, component = 2) out vec2 n;
  16. layout(location = 2, component = 0) out vec3 p; // ERROR, component overlap
  17. layout(location = 10, component = 3) out float q[6];
  18. layout(location = 10, component = 0) out vec3 r[6];
  19. layout(location = 15, component = 3) out float s; // ERROR, overlap
  20. layout(location = 10, component = 1) out float t; // ERROR, overlap
  21. layout(location = 20, component = 2) out float u;
  22. layout(location = 20, component = 0) out float v;
  23. layout(location = 20, component = 3) out float w;
  24. layout(location = 20, component = 1) out vec2 x; // ERROR, overlap
  25. layout(location = 30, component = 3) out vec2 y; // ERROR, goes to component 4
  26. layout(location = 31, component = 1) out vec4 z; // ERROR, goes to component 4
  27. layout(location = 32, component = 1) out mat4 ba; // ERROR
  28. layout(location = 33, component = 1) out struct S {int a;} Ss; // ERROR
  29. layout(location = 34, component = 1) out bn { int a;} bb; // ERROR
  30. layout(component = 1) out float bc; // ERROR, no location
  31. out blockname {
  32. layout(location = 40, component = 2) out float u;
  33. layout(location = 40, component = 0) out float v;
  34. layout(location = 40, component = 3) out float w;
  35. layout(location = 40, component = 1) out vec2 x; // ERROR, overlap
  36. layout(location = 41, component = 3) out vec2 y; // ERROR, goes to component 4
  37. layout(location = 42, component = 1) out vec4 z; // ERROR, goes to component 4
  38. layout(location = 42, component = 1) out mat4 ba; // ERROR
  39. layout(location = 43, component = 1) out S Ss; // ERROR
  40. } bd;
  41. layout(location = 1, component = 1) out; // ERROR, no global setting
  42. layout(location = 50, component = 3) out int be;
  43. layout(location = 50, component = 0) out vec3 bf;
  44. layout(location = 51, component = 1) out double dfo; // ERROR, odd component
  45. layout(location = 52, component = 2) out dvec2 dvo; // ERROR, overflow
  46. layout(location = 53) out double dfo2;
  47. layout(location = 53, component = 2) out vec2 ffv2; // okay, fits
  48. layout(location = 54) out dvec4 dvec4out; // uses up location 55 too
  49. layout(location = 55) out float overf; // ERROR, collides with previous dvec4
  50. layout(location = 56, component = 1) out vec2 df2o;
  51. layout(location = 56, component = 3) out float sf2o;
  52. layout(location = 57, component = 2) out vec2 dv3o;
  53. layout(location = 57, component = 3) out float sf4o; // ERROR, overlapping component
  54. layout(location=58) out flat dvec3 dv3o2; // uses part of location 59
  55. layout(location=59, component=2) out flat double dfo3; // okay, fits
  56. layout(location=59, component=0) out flat double dfo4; // ERROR, overlaps the dvec3 in starting in 58
  57. out bblck1 {
  58. vec4 bbv;
  59. } bbinst1;
  60. out bblck2 {
  61. layout(xfb_offset=64) vec4 bbv;
  62. } bbinst2;
  63. layout(xfb_buffer = 3, xfb_stride = 64) out; // default buffer is 3
  64. out bblck3 {
  65. layout(xfb_offset=16) vec4 bbv; // in xfb_buffer 3
  66. } bbinst3;
  67. uniform ubblck3 {
  68. layout(xfb_offset=16) vec4 bbv; // ERROR, not in a uniform
  69. } ubbinst3;
  70. layout(xfb_buffer=2, xfb_offset=48, xfb_stride=80) out vec4 bg;
  71. layout( xfb_offset=32, xfb_stride=64) out vec4 bh;
  72. layout(xfb_offset=48) out; // ERROR
  73. layout(xfb_stride=80, xfb_buffer=2, xfb_offset=16) out bblck4 {
  74. vec4 bbv1;
  75. vec4 bbv2;
  76. } bbinst4;
  77. out bblck5 {
  78. layout(xfb_offset=0) vec4 bbv1;
  79. layout(xfb_stride=64, xfb_buffer=3, xfb_offset=48) vec4 bbv2;
  80. layout(xfb_buffer=2) vec4 bbv3; // ERROR, wrong buffer
  81. } bbinst5;
  82. out layout(xfb_buffer=2) bblck6 {
  83. layout(xfb_offset=0) vec4 bbv1;
  84. layout(xfb_stride=64, xfb_buffer=3, xfb_offset=32) vec4 bbv2; // ERROR, overlap 32 from bh, and buffer contradiction
  85. layout(xfb_buffer=2, xfb_offset=0) vec4 bbv3; // ERROR, overlap 0 from bbinst5
  86. layout(xfb_buffer=2) vec4 bbv5;
  87. layout(xfb_offset=24) float bbf6; // ERROR, overlap 24 from bbv1 in bbinst4
  88. } bbinst6;
  89. layout(xfb_stride=48) out; // ERROR, stride of buffer 3
  90. layout(xfb_buffer=1) out; // default buffer is 1
  91. layout(xfb_offset=4) out float bj;
  92. layout(xfb_offset=0) out ivec2 bk; // ERROR, overlap 4
  93. layout(xfb_buffer=3, xfb_stride=48) out; // ERROR, stride of buffer 3 (default is now 3)
  94. layout(xfb_stride=48) out float bl; // ERROR, stride of buffer 3
  95. layout(xfb_stride=48) out bblck7 { // ERROR, stride of buffer 3
  96. layout(xfb_stride=64) vec4 bbv1;
  97. layout(xfb_stride=32) vec4 bbv2; // ERROR, stride of buffer 3
  98. } bbinst7;
  99. struct S5 {
  100. int i; // 4 bytes plus 4 byte hole
  101. double d; // 8 bytes
  102. float f; // 4 bytes
  103. }; // total size = 20
  104. struct T {
  105. bool b; // 4 plus 4 byte hole
  106. S5 s; // 20
  107. vec2 v2; // 8
  108. }; // total size = 36
  109. out layout(xfb_buffer=0, xfb_offset=0, xfb_stride=92) bblck8 { // ERROR, stride not multiple of 8
  110. bool b; // offset 0
  111. T t; // offset 8, size 40
  112. int i; // offset 40 + 4 = 48
  113. mat3x3 m3; // offset 52
  114. float f; // offset 52 + 9*4 = 88
  115. float g; // ERROR, overflow stride
  116. } bbinst8;
  117. out layout(xfb_buffer=4) bblck9 {
  118. layout(xfb_offset=1) bool b; // ERROR
  119. layout(xfb_offset=12) T t; // ERROR
  120. layout(xfb_offset=52) mat3x3 m3; // non-multiple of 8 okay
  121. layout(xfb_offset=90) int i; // ERROR
  122. layout(xfb_offset=98) double d; // ERROR
  123. layout(xfb_offset=108) S s; // non-multiple of 8 okay
  124. } bbinst9;
  125. layout(xfb_buffer=5, xfb_stride=6) out; // link ERROR, stride not multiple of 4
  126. layout(xfb_offset=0) out float bm;
  127. layout(xfb_buffer=6, xfb_stride=2000) out; // ERROR, stride too big
  128. out layout(xfb_buffer=7, xfb_offset=0) bblck10 { // link ERROR, implicit stride too big
  129. dmat4x4 m1;
  130. dmat4x4 m2;
  131. float f;
  132. } bbinst10;
  133. layout(xfb_buffer = 3) out;
  134. layout(xfb_offset = 32) out gl_PerVertex {
  135. layout(xfb_buffer = 2) float gl_PointSize; // ERROR, change in xfb_buffer
  136. vec4 gl_Position;
  137. };
  138. int drawParamsBad()
  139. {
  140. return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB; // ERROR, extension not requested
  141. }
  142. #extension GL_ARB_shader_draw_parameters: enable
  143. int drawParams()
  144. {
  145. return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB;
  146. gl_BaseVertexARB = 3; // ERROR, can't write to shader 'in'
  147. gl_BaseInstanceARB = 3; // ERROR, can't write to shader 'in'
  148. gl_DrawIDARB = 3; // ERROR, can't write to shader 'in'
  149. glBaseInstanceARB; // ERROR, not defined
  150. }