[Mesa-dev] [PATCH 09/14] i965: Remove brw_fs_precompile

Ian Romanick idr at freedesktop.org
Fri Jan 6 16:50:00 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

There are several things that could cause the fragment shader
precompile to fail.  Looking for calls to 'fail' in brw_fs_visitor.cpp
finds three classes of things:

  * Trying to emit instructions that are invalid in 16-wide mode.

  * Trying to emit instructions that should have been lowered.

  * Register allocation failures.

None of these should cause link errors.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp     |   68 ------------------------------
 src/mesa/drivers/dri/i965/brw_fs.h       |    1 -
 src/mesa/drivers/dri/i965/brw_shader.cpp |    5 --
 3 files changed, 0 insertions(+), 74 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 40327ac..3b71864 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1858,71 +1858,3 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
 
    return true;
 }
-
-bool
-brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
-{
-   struct brw_context *brw = brw_context(ctx);
-   struct brw_wm_prog_key key;
-
-   if (!prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
-      return true;
-
-   struct gl_fragment_program *fp = (struct gl_fragment_program *)
-      prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
-   struct brw_fragment_program *bfp = brw_fragment_program(fp);
-
-   memset(&key, 0, sizeof(key));
-
-   if (fp->UsesKill)
-      key.iz_lookup |= IZ_PS_KILL_ALPHATEST_BIT;
-
-   if (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
-      key.iz_lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
-
-   /* Just assume depth testing. */
-   key.iz_lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
-   key.iz_lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
-
-   key.vp_outputs_written |= BITFIELD64_BIT(FRAG_ATTRIB_WPOS);
-   for (int i = 0; i < FRAG_ATTRIB_MAX; i++) {
-      if (!(fp->Base.InputsRead & BITFIELD64_BIT(i)))
-	 continue;
-
-      key.proj_attrib_mask |= 1 << i;
-
-      int vp_index = _mesa_vert_result_to_frag_attrib((gl_vert_result) i);
-
-      if (vp_index >= 0)
-	 key.vp_outputs_written |= BITFIELD64_BIT(vp_index);
-   }
-
-   key.clamp_fragment_color = true;
-
-   for (int i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-      if (fp->Base.ShadowSamplers & (1 << i))
-	 key.tex.compare_funcs[i] = GL_LESS;
-
-      /* FINISHME: depth compares might use (0,0,0,W) for example */
-      key.tex.swizzles[i] = SWIZZLE_XYZW;
-   }
-
-   if (fp->Base.InputsRead & FRAG_BIT_WPOS) {
-      key.drawable_height = ctx->DrawBuffer->Height;
-      key.render_to_fbo = ctx->DrawBuffer->Name != 0;
-   }
-
-   key.nr_color_regions = 1;
-
-   key.program_string_id = bfp->id;
-
-   uint32_t old_prog_offset = brw->wm.prog_offset;
-   struct brw_wm_prog_data *old_prog_data = brw->wm.prog_data;
-
-   bool success = do_wm_prog(brw, prog, bfp, &key);
-
-   brw->wm.prog_offset = old_prog_offset;
-   brw->wm.prog_data = old_prog_data;
-
-   return success;
-}
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index d623316..24bf7bb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -613,4 +613,3 @@ public:
 
 bool brw_do_channel_expressions(struct exec_list *instructions);
 bool brw_do_vector_splitting(struct exec_list *instructions);
-bool brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog);
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 294cc73..634f7e3 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -65,11 +65,6 @@ brw_new_shader_program(struct gl_context *ctx, GLuint name)
 bool
 brw_shader_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
 {
-   struct brw_context *brw = brw_context(ctx);
-
-   if (brw->precompile && !brw_fs_precompile(ctx, prog))
-      return false;
-
    return true;
 }
 
-- 
1.7.6.4



More information about the mesa-dev mailing list