summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-08-18 20:59:37 -0700
committerPaul Berry <[email protected]>2013-09-11 11:16:35 -0700
commit1a33e0233ad5bfd0b7f62ae25811532c5784653f (patch)
treee6c63931eb027db76b12fee797285353368db246 /src/glsl/linker.cpp
parent79d9c6b7ffe32c146835d27431a66aaf413836fd (diff)
glsl: During linking, record whether a GS uses EndPrimitive().
This information will be useful in the i965 back end, since we can save some compilation effort if we know from the outset that the shader never calls EndPrimitive(). Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 65afc2e69b4..8a143fddfca 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -249,6 +249,33 @@ public:
};
+/**
+ * Visitor that determines whether or not a shader uses ir_end_primitive.
+ */
+class find_end_primitive_visitor : public ir_hierarchical_visitor {
+public:
+ find_end_primitive_visitor()
+ : found(false)
+ {
+ /* empty */
+ }
+
+ virtual ir_visitor_status visit(ir_end_primitive *)
+ {
+ found = true;
+ return visit_stop;
+ }
+
+ bool end_primitive_found()
+ {
+ return found;
+ }
+
+private:
+ bool found;
+};
+
+
void
linker_error(gl_shader_program *prog, const char *fmt, ...)
{
@@ -517,6 +544,10 @@ validate_geometry_shader_executable(struct gl_shader_program *prog,
analyze_clip_usage("geometry", prog, shader, &prog->Geom.UsesClipDistance,
&prog->Geom.ClipDistanceArraySize);
+
+ find_end_primitive_visitor end_primitive;
+ end_primitive.run(shader->ir);
+ prog->Geom.UsesEndPrimitive = end_primitive.end_primitive_found();
}