[Mesa-dev] [PATCH 3/3] i965: Don't perform the precompile on fragment shaders by default.

Eric Anholt eric at anholt.net
Mon Nov 28 10:48:21 PST 2011


It is useful to have this option for shader-db, and it was also good
at the time where we were rejecting shaders due to various internal
limits we hadn't supported yet.  However, at this point the precompile
step takes extra time (since not all NOS is known at link time) and
spews misleading debug in the common case of debugging a real app.

This is left in place for VS, where we still have a couple of codegen
failure paths that result in link failure through precompile.  Those
need to be fixed.

shader-db can still get at the debug info it wants using
"shader_precompile=true" driconf option.
---
 src/mesa/drivers/dri/i965/brw_context.c   |    1 +
 src/mesa/drivers/dri/i965/brw_context.h   |    1 +
 src/mesa/drivers/dri/i965/brw_shader.cpp  |    4 +++-
 src/mesa/drivers/dri/intel/intel_screen.c |    6 +++++-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 5dcf8dd..1163007 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -327,6 +327,7 @@ brwCreateContext(int api,
    brw_draw_init( brw );
 
    brw->new_vs_backend = (getenv("INTEL_OLD_VS") == NULL);
+   brw->precompile = driQueryOptionb(&intel->optionCache, "shader_precompile");
 
    /* If we're using the new shader backend, we require integer uniforms
     * stored as actual integers.
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index c1b123f5..a1119bb 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -604,6 +604,7 @@ struct brw_context
    bool has_aa_line_parameters;
    bool has_pln;
    bool new_vs_backend;
+   bool precompile;
 
    struct {
       struct brw_state_flags dirty;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index f25fab3..33c9ae5 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -65,7 +65,9 @@ brw_new_shader_program(struct gl_context *ctx, GLuint name)
 bool
 brw_shader_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
 {
-   if (!brw_fs_precompile(ctx, prog))
+   struct brw_context *brw = brw_context(ctx);
+
+   if (brw->precompile && !brw_fs_precompile(ctx, prog))
       return false;
 
    if (!brw_vs_precompile(ctx, prog))
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 46b822c..f67bef9 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -76,10 +76,14 @@ PUBLIC const char __driConfigOptions[] =
       DRI_CONF_OPT_BEGIN(stub_occlusion_query, bool, false)
 	 DRI_CONF_DESC(en, "Enable stub ARB_occlusion_query support on 915/945.")
       DRI_CONF_OPT_END
+
+      DRI_CONF_OPT_BEGIN(shader_precompile, bool, false)
+	 DRI_CONF_DESC(en, "Perform code generation at shader link time.")
+      DRI_CONF_OPT_END
    DRI_CONF_SECTION_END
 DRI_CONF_END;
 
-const GLuint __driNConfigOptions = 11;
+const GLuint __driNConfigOptions = 12;
 
 #include "intel_batchbuffer.h"
 #include "intel_buffers.h"
-- 
1.7.7.3



More information about the mesa-dev mailing list