summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_tgsi_emit.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-10-22 15:36:25 -0600
committerBrian Paul <[email protected]>2015-10-22 17:19:20 -0600
commit1082735bb69e9f64cb3991a52f0e270902917855 (patch)
tree6d7be9330902c673435dc050545953e22b773846 /src/gallium/drivers/svga/svga_tgsi_emit.h
parentdf0f817e311dbf9af110779086a27429905b1faf (diff)
svga: detect constant color writes in fragment shaders
Examine the fragment shader to try to detect TGSI shaders which use "MOV OUT[0], CONST[i]" to write a constant value for the fragment color. In this case, all fragments will have the same color (unless blending is enabled). This is a common case for OpenGL code such as: glColor(), glBegin(), glVertex(), ..., glEnd() when lighting/fog/etc are disabled. In this case, the Mesa/gallium state tracker actually generates a simple "MOV OUT[0], CONST[i]" fragment shader. This will be used by the next commit to avoid provoking vertex conversion (creating/rewriting an index buffer) when drawing flat-shaded primitives. Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_tgsi_emit.h')
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_emit.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h
index 0b82483ab2e..83f0c8bd4d0 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -84,6 +84,9 @@ struct svga_shader_emitter
int dynamic_branching_level;
+ unsigned num_output_writes;
+ boolean constant_color_output;
+
boolean in_main_func;
boolean created_common_immediate;