[Mesa-dev] [PATCH 10/15] i965/fs: Simplify computation of key.input_slots_valid during precompile.

Paul Berry stereotype441 at gmail.com
Tue Sep 3 16:18:22 PDT 2013


The for loop was rather silly.  In addition to checking brw->gen < 6
on each loop iteration, it took pains to exclude bits from
fp->Base.InputsRead that don't correspond to fragment shader inputs.
But those bits would never have been set in the first place, since the
only bits that are ever set in fp->Base.InputsRead are fragment shader
inputs.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 013dc29..7950d5f6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3150,17 +3150,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
    }
 
    if (brw->gen < 6)
-      key.input_slots_valid |= BITFIELD64_BIT(VARYING_SLOT_POS);
-
-   for (int i = 0; i < VARYING_SLOT_MAX; i++) {
-      if (!(fp->Base.InputsRead & BITFIELD64_BIT(i)))
-	 continue;
-
-      if (brw->gen < 6) {
-         if (_mesa_varying_slot_in_fs((gl_varying_slot) i))
-            key.input_slots_valid |= BITFIELD64_BIT(i);
-      }
-   }
+      key.input_slots_valid = fp->Base.InputsRead | VARYING_BIT_POS;
 
    key.clamp_fragment_color = ctx->API == API_OPENGL_COMPAT;
 
-- 
1.8.4



More information about the mesa-dev mailing list