summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_fs.cpp
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2013-02-22 16:40:41 -0800
committerPaul Berry <stereotype441@gmail.com>2013-03-19 16:56:58 -0700
commit995bbc22564b22de2ef6aac4e6881fd4c23e3162 (patch)
tree8300176d90ba31c1d3db84a06f95bd48c3f5fd2b /src/mesa/drivers/dri/i965/brw_fs.cpp
parentdb81d3b8f78d1f5a70ce909981807825d11fc6f3 (diff)
i965/fs: Avoid unnecessary recompiles due to POS bit of proj_attrib_mask.
Previous to this patch, when using fixed function fragment shading, bit VARYING_BIT_POS of brw_wm_prog_key::proj_attrib_mask was being set differently during precompiles and normal usage. During precompiles it was being set only if the fragment shader reads from window position (which it never does), so it was always being set to 0. During normal usage it was being set if the vertex shader writes to all 4 components of gl_Position (which it usually does), so it was usually being set to 1. As a result, we were almost always doing an extra recompile for the fixed function fragment shader. The recompile was totally unnecessary, though, because brw_wm_prog_key::proj_attrib_mask is only consulted for fs_visitor::emit_general_interpolation(), which isn't used for VARYING_SLOT_POS. This patch avoids the unnecessary recompile by always setting bit VARYING_BIT_POS of brw_wm_prog_key::proj_attrib_mask to 1. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index d0f5fea3d32..5a5bfeb7fca 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2987,6 +2987,12 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
if (prog->Name != 0)
key.proj_attrib_mask = ~(GLbitfield64) 0;
+ else {
+ /* Bit VARYING_BIT_POS of key.proj_attrib_mask is never used, so to
+ * avoid unnecessary recompiles, always set it to 1.
+ */
+ key.proj_attrib_mask |= VARYING_BIT_POS;
+ }
if (intel->gen < 6)
key.vp_outputs_written |= BITFIELD64_BIT(VARYING_SLOT_POS);