From c6abde211fa875f90e59e3709720cfe394669069 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 23 Nov 2011 10:01:39 -0800 Subject: [PATCH] i965: Don't perform the precompile on fragment shaders by default. 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 | 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 5dcf8dd4432..11630075518 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 87675e98373..171f3eff8a0 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 f25fab30a03..33c9ae57ac2 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 46b822cb319..f67bef95566 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" -- 2.30.2