310.geom 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #version 310 es
  2. #ifdef GL_EXT_geometry_shader
  3. #extension GL_EXT_geometry_shader : enable
  4. #else
  5. #error no GL_EXT_geometry_shader
  6. #endif
  7. #ifndef GL_OES_geometry_shader
  8. #error no GL_OES_geometry_shader
  9. #endif
  10. precision mediump float;
  11. in fromVertex {
  12. in vec3 color;
  13. } fromV[];
  14. in vec4 nonBlockUnsized[];
  15. out toFragment {
  16. out vec3 color;
  17. } toF;
  18. out fromVertex { // okay to reuse a block name for another block name
  19. vec3 color;
  20. };
  21. out fooB { // ERROR, cannot reuse block name as block instance
  22. vec2 color;
  23. } fromVertex;
  24. int fromVertex; // ERROR, cannot reuse a block name for something else
  25. out fooC { // ERROR, cannot have same name for block and instance name
  26. vec2 color;
  27. } fooC;
  28. void main()
  29. {
  30. EmitVertex();
  31. EndPrimitive();
  32. EmitStreamVertex(1); // ERROR
  33. EndStreamPrimitive(0); // ERROR
  34. color = fromV[0].color;
  35. gl_ClipDistance[3] = // ERROR, no ClipDistance
  36. gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance
  37. gl_Position = gl_in[0].gl_Position;
  38. gl_PrimitiveID = gl_PrimitiveIDIn;
  39. gl_Layer = 2;
  40. }
  41. layout(stream = 4) out vec4 ov4; // ERROR, no streams
  42. layout(line_strip, points, triangle_strip, points, triangle_strip) out; // just means triangle_strip"
  43. out ooutb { vec4 a; } ouuaa6;
  44. layout(max_vertices = 200) out;
  45. layout(max_vertices = 300) out; // ERROR, too big
  46. void foo(layout(max_vertices = 4) int a) // ERROR
  47. {
  48. ouuaa6.a = vec4(1.0);
  49. }
  50. layout(line_strip, points, triangle_strip, points) out; // ERROR, changing output primitive
  51. layout(line_strip, points) out; // ERROR, changing output primitive
  52. layout(triangle_strip) in; // ERROR, not an input primitive
  53. layout(triangle_strip) uniform; // ERROR
  54. layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
  55. layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
  56. layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
  57. out outbn2 {
  58. layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
  59. layout(max_vertices = 3) int b; // ERROR, not on a block member
  60. layout(triangle_strip) int c; // ERROR, not on a block member
  61. } outbi;
  62. layout(lines) out; // ERROR, not on output
  63. layout(lines_adjacency) in;
  64. layout(triangles) in; // ERROR, can't change it
  65. layout(triangles_adjacency) in; // ERROR, can't change it
  66. layout(invocations = 4) in;
  67. in sameName {
  68. int a15;
  69. } insn[];
  70. out sameName {
  71. float f15;
  72. };
  73. uniform sameName {
  74. bool b15;
  75. };
  76. const int summ = gl_MaxVertexAttribs +
  77. gl_MaxGeometryInputComponents +
  78. gl_MaxGeometryOutputComponents +
  79. gl_MaxGeometryImageUniforms +
  80. gl_MaxGeometryTextureImageUnits +
  81. gl_MaxGeometryOutputVertices +
  82. gl_MaxGeometryTotalOutputComponents +
  83. gl_MaxGeometryUniformComponents +
  84. gl_MaxGeometryAtomicCounters +
  85. gl_MaxGeometryAtomicCounterBuffers +
  86. gl_MaxVertexTextureImageUnits +
  87. gl_MaxCombinedTextureImageUnits +
  88. gl_MaxTextureImageUnits +
  89. gl_MaxDrawBuffers;
  90. void fooe1()
  91. {
  92. gl_ViewportIndex; // ERROR, not in ES
  93. gl_MaxViewports; // ERROR, not in ES
  94. insn.length(); // 4: lines_adjacency
  95. int inv = gl_InvocationID;
  96. }
  97. in vec4 explArray[4];
  98. in vec4 explArrayBad[5]; // ERROR, wrong size
  99. in vec4 nonArrayed; // ERROR, not an array
  100. flat out vec3 myColor1;
  101. centroid out vec3 myColor2;
  102. centroid in vec3 centr[];
  103. sample out vec4 perSampleColor; // ERROR without sample extensions
  104. layout(max_vertices = 200) out; // matching redecl
  105. layout(location = 7, component = 2) in float comp[]; // ERROR, es has no component
  106. void notHere()
  107. {
  108. gl_MaxGeometryVaryingComponents; // ERROR, not in ES
  109. gl_VerticesIn; // ERROR, not in ES
  110. }
  111. void pointSize1()
  112. {
  113. highp float ps = gl_in[3].gl_PointSize; // ERROR, need point_size extension
  114. gl_PointSize = ps; // ERROR, need point_size extension
  115. }
  116. #extension GL_OES_geometry_point_size : enable
  117. void pointSize2()
  118. {
  119. highp float ps = gl_in[3].gl_PointSize;
  120. gl_PointSize = ps;
  121. }