summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorBryan Cain <[email protected]>2013-02-15 09:46:50 -0600
committerPaul Berry <[email protected]>2013-08-01 20:20:45 -0700
commit2548092ad80156a407281a124f833a6a93fbf2f3 (patch)
treee839a3d1c14eb45dbfe1362f5a8f4ce9afeb0c74 /src/glsl/ir.cpp
parent844bd71736dd59808e1ea4319800db042a7c4267 (diff)
glsl: support compilation of geometry shaders
This commit adds all of the parsing and semantics for GLSL 150 style geometry shaders. v2 (Paul Berry <[email protected]>): Add a few missing calls to get_pipeline_stage(). Fix some signed/unsigned comparison warnings. Fix handling of NULL consumer in assign_varying_locations(). v3 (Bryan Cain <[email protected]>): fix indexing order of 2D arrays. Also, allow interpolation qualifiers in geometry shaders. v4 (Paul Berry <[email protected]>): Eliminate get_pipeline_stage()--it is no longer needed thanks to 030ca23 (mesa: renumber shader indices according to their placement in pipeline). Remove 2D stuff. Move vertices_per_prim() to ir.h, so that it will be accessible from outside the linker. Remove inject_num_vertices_visitor. Rework for GLSL 1.50. Reviewed-by: Ian Romanick <[email protected]> v5 (Paul Berry <[email protected]>): Split out do_set_program_inouts() argument refactoring to a separate patch. Move geom_array_resizing_visitor to later in the series. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index dad58deeb97..99dceacf85f 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1778,3 +1778,24 @@ ir_rvalue::as_rvalue_to_saturate()
return NULL;
}
+
+
+unsigned
+vertices_per_prim(GLenum prim)
+{
+ switch (prim) {
+ case GL_POINTS:
+ return 1;
+ case GL_LINES:
+ return 2;
+ case GL_TRIANGLES:
+ return 3;
+ case GL_LINES_ADJACENCY:
+ return 4;
+ case GL_TRIANGLES_ADJACENCY:
+ return 6;
+ default:
+ assert(!"Bad primitive");
+ return 3;
+ }
+}