440.frag 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #version 440
  2. // Note 'location'-only tests for enhanced layouts are in 330.frag
  3. // Generic 'component' tests are in 440.vert
  4. // a consumes components 2 and 3 of location 4
  5. layout(location = 4, component = 2) in vec2 a;
  6. // b consumes component 1 of location 4
  7. layout(location = 4, component = 1) in float b;
  8. layout(location = 4, component = 2) in vec2 h; // ERROR, component overlap not okay for fragment in
  9. layout(location = 3, component = 2) in vec3 c; // ERROR: c overflows components 2 and 3
  10. // e consumes beginning (components 0, 1 and 2) of each of 6 slots
  11. layout(location = 20, component = 0) in vec3 e[6];
  12. // f consumes last component of the same 6 slots
  13. layout(location = 20, component = 3) in float f[6];
  14. layout(location = 30, component = 3) out int be;
  15. layout(location = 30, component = 0) out vec3 bf; // ERROR, not the same basic type
  16. writeonly uniform; // ERROR
  17. readonly in; // ERROR
  18. flat out; // ERROR
  19. mediump uniform;
  20. layout(offset=12) uniform; // ERROR
  21. layout(offset=12) in; // ERROR
  22. layout(offset=12) out; // ERROR
  23. layout(align=16) uniform; // ERROR
  24. layout(align=16) in; // ERROR
  25. layout(align=16) out; // ERROR
  26. layout(offset=12) uniform ubl1 { int a; } inst1; // ERROR
  27. layout(offset=12) in inbl2 { int a; } inst2; // ERROR
  28. layout(offset=12) out inbl3 { int a; } inst3; // ERROR
  29. layout(align=16, std140) uniform ubl4 { int a; } inst4;
  30. layout(align=16) uniform ubl8 { int a; } inst8; // ERROR, no packing
  31. layout(align=16) in inbl5 { int a; } inst5; // ERROR
  32. layout(align=16) out inbl6 { int a; } inst6; // ERROR
  33. layout(offset=12) uniform vec4 v1; // ERROR
  34. layout(offset=12) in vec4 v2; // ERROR
  35. layout(offset=12) out vec4 v3; // ERROR
  36. layout(align=16) uniform vec4 v4; // ERROR
  37. layout(align=16) in vec4 v5; // ERROR
  38. layout(align=16) out vec4 v6; // ERROR
  39. layout(std140) in; // ERROR
  40. layout(std140) uniform vec4 v7; // ERROR
  41. layout(align=48) uniform ubl7 { // ERROR, not power of 2
  42. layout(offset=12, align=4) float f; // ERROR, no packing
  43. } inst7;
  44. in ibl10 {
  45. layout(offset=12) float f; // ERROR
  46. layout(align=4) float g; // ERROR
  47. } inst10;
  48. layout(std430) uniform;
  49. layout(align=32) uniform ubl9 {
  50. float e;
  51. layout(offset=12, align=4) float f;
  52. layout(offset=20) float g;
  53. float h;
  54. } inst9;
  55. uniform ubl11 {
  56. layout(offset=12, align=4) float f;
  57. float g;
  58. } inst11;
  59. layout(std140) uniform block {
  60. vec4 a; // a takes offsets 0-15
  61. layout(offset = 32) vec3 b; // b takes offsets 32-43
  62. layout(offset = 40) vec2 c; // ERROR, lies within previous member
  63. layout(align = 6) double g; // ERROR, 6 is not a power of 2
  64. layout(offset=68) double h; // ERROR, offset not aligned
  65. } specExampleErrors;
  66. layout(std140) uniform block2 {
  67. vec4 a; // a takes offsets 0-15
  68. layout(offset = 32) vec3 b; // b takes offsets 32-43
  69. layout(offset = 48) vec2 d; // d takes offsets 48-55
  70. layout(align = 16) float e; // e takes offsets 64-67
  71. layout(align = 2) double f; // f takes offsets 72-79
  72. layout(offset = 80) float h; // h takes offsets 80-83
  73. layout(align = 64) dvec3 i; // i takes offsets 128-151
  74. layout(offset = 164, align = 8) float j; // j takes offsets 168-171
  75. } specExample;
  76. layout(std430) buffer block430 {
  77. vec4 a; // a takes offsets 0-15
  78. layout(offset = 32) vec3 b; // b takes offsets 32-43
  79. layout(offset = 40) vec2 c; // ERROR, lies within previous member
  80. layout(align = 6) double g; // ERROR, 6 is not a power of 2
  81. layout(offset=68) double h; // ERROR, offset not aligned
  82. layout(align = 0) double i; // ERROR, 0 not a power of 2
  83. } specExampleErrors430;
  84. layout(std430) buffer block2430 {
  85. vec4 a; // a takes offsets 0-15
  86. layout(offset = 32) vec3 b; // b takes offsets 32-43
  87. layout(offset = 48) vec2 d; // d takes offsets 48-55
  88. layout(align = 16) float e; // e takes offsets 64-67
  89. layout(align = 2) double f; // f takes offsets 72-79
  90. layout(offset = 80) float h; // h takes offsets 80-83
  91. layout(align = 64) dvec3 i; // i takes offsets 128-151
  92. layout(offset = 164, align = 8) float j; // j takes offsets 168-171
  93. } specExample430;
  94. layout(std430, align = 128) buffer block24300 {
  95. vec4 a;
  96. vec3 b;
  97. vec2 d;
  98. float e;
  99. double f;
  100. float h;
  101. dvec3 i;
  102. } specExample4300;
  103. layout(std430, align = 128) buffer block24301 {
  104. vec4 a;
  105. vec3 b;
  106. vec2 d;
  107. layout(offset=388) float e;
  108. layout(align=8) double f;
  109. float h;
  110. dvec3 i;
  111. } specExample4301;
  112. int aconst[gl_MaxTransformFeedbackBuffers];
  113. int bconst[gl_MaxTransformFeedbackInterleavedComponents];
  114. sample in vec3 sampInArray[4];
  115. void interp()
  116. {
  117. interpolateAtCentroid(sampInArray[2].xy);
  118. interpolateAtSample(sampInArray[2].x.x, 2);
  119. }
  120. int layer()
  121. {
  122. return gl_Layer;
  123. }