OSDN Git Service

i965: Don't perform the precompile on fragment shaders by default.
authorEric Anholt <eric@anholt.net>
Wed, 23 Nov 2011 18:01:39 +0000 (10:01 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 30 Nov 2011 19:22:53 +0000 (11:22 -0800)
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.  Long term, we can probably
build a good-enough app for shader-db to trigger real codegen.

src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/intel/intel_screen.c

index 5dcf8dd..1163007 100644 (file)
@@ -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.
index 87675e9..171f3ef 100644 (file)
@@ -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;
index f25fab3..33c9ae5 100644 (file)
@@ -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))
index 46b822c..f67bef9 100644 (file)
@@ -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"