150.geom 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #version 150 core
  2. in fromVertex {
  3. in vec3 color;
  4. } fromV[];
  5. out toFragment {
  6. out vec3 color;
  7. } toF;
  8. out fromVertex { // okay to reuse a block name for another block name
  9. vec3 color;
  10. };
  11. out fooB {
  12. vec2 color;
  13. } fromVertex; // ERROR, cannot reuse block name as block instance
  14. int fromVertex; // ERROR, cannot reuse a block name for something else
  15. out fooC {
  16. vec2 color;
  17. } fooC; // ERROR, cannot have same name for block and instance name
  18. void main()
  19. {
  20. EmitVertex();
  21. EndPrimitive();
  22. EmitStreamVertex(1); // ERROR
  23. EndStreamPrimitive(0); // ERROR
  24. color = fromV[0].color;
  25. gl_ClipDistance[3] = gl_in[1].gl_ClipDistance[2];
  26. gl_Position = gl_in[0].gl_Position;
  27. gl_PointSize = gl_in[3].gl_PointSize;
  28. gl_PrimitiveID = gl_PrimitiveIDIn;
  29. gl_Layer = 2;
  30. }
  31. out vec4 ov0; // stream should be 0
  32. layout(stream = 4) out vec4 ov4;
  33. out vec4 o1v0; // stream should be 0
  34. layout(stream = 3) uniform; // ERROR
  35. layout(stream = 3) in; // ERROR
  36. layout(stream = 3) uniform int ua; // ERROR
  37. layout(stream = 3) uniform ubb { int ua; } ibb; // ERROR
  38. layout(line_strip, points, triangle_strip, stream = 3, points, triangle_strip) out; // just means "stream = 3, triangle_strip"
  39. layout(stream = 3, triangle_strip) out;
  40. out vec4 ov3; // stream should be 3
  41. layout(stream = 6) out ooutb { vec4 a; } ouuaa6;
  42. layout(stream = 6) out ooutb2 {
  43. layout(stream = 6) vec4 a;
  44. } ouua6;
  45. layout(stream = 7) out ooutb3 {
  46. layout(stream = 6) vec4 a; // ERROR
  47. } ouua7;
  48. out vec4 ov2s3; // stream should be 3
  49. layout(max_vertices = 200) out;
  50. layout(max_vertices = 300) out; // ERROR, too big
  51. void foo(layout(max_vertices = 4) int a) // ERROR
  52. {
  53. ouuaa6.a = vec4(1.0);
  54. }
  55. layout(line_strip, points, triangle_strip, stream = 3, points) out; // ERROR, changing output primitive
  56. layout(line_strip, points, stream = 3) out; // ERROR, changing output primitive
  57. layout(triangle_strip) in; // ERROR, not an input primitive
  58. layout(triangle_strip) uniform; // ERROR
  59. layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
  60. layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
  61. layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
  62. out outbn2 {
  63. layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
  64. layout(max_vertices = 3) int b; // ERROR, not on a block member
  65. layout(triangle_strip) int c; // ERROR, not on a block member
  66. } outbi;
  67. layout(lines) out; // ERROR, not on output
  68. layout(lines_adjacency) in;
  69. layout(triangles) in; // ERROR, can't change it
  70. layout(triangles_adjacency) in; // ERROR, can't change it
  71. layout(invocations = 4) in; // ERROR, not until 4.0
  72. in inbn {
  73. layout(stream = 2) int a; // ERROR, stream on input
  74. } inbi[];
  75. in sameName {
  76. int a15;
  77. } insn[];
  78. out sameName {
  79. float f15;
  80. };
  81. uniform sameName {
  82. bool b15;
  83. };
  84. float summ = gl_MaxVertexAttribs +
  85. gl_MaxVertexUniformComponents +
  86. gl_MaxVaryingFloats +
  87. gl_MaxVaryingComponents +
  88. gl_MaxVertexOutputComponents +
  89. gl_MaxGeometryInputComponents +
  90. gl_MaxGeometryOutputComponents +
  91. gl_MaxFragmentInputComponents +
  92. gl_MaxVertexTextureImageUnits +
  93. gl_MaxCombinedTextureImageUnits +
  94. gl_MaxTextureImageUnits +
  95. gl_MaxFragmentUniformComponents +
  96. gl_MaxDrawBuffers +
  97. gl_MaxClipDistances +
  98. gl_MaxGeometryTextureImageUnits +
  99. gl_MaxGeometryOutputVertices +
  100. gl_MaxGeometryTotalOutputComponents +
  101. gl_MaxGeometryUniformComponents +
  102. gl_MaxGeometryVaryingComponents;
  103. void fooe1()
  104. {
  105. gl_ViewportIndex = gl_MaxViewports - 1;
  106. }
  107. #extension GL_ARB_viewport_array : enable
  108. void fooe2()
  109. {
  110. gl_ViewportIndex = gl_MaxViewports - 1;
  111. }
  112. out int gl_ViewportIndex;