This is to enable a quirk for Savage2 which includes a shader with a stray '\' at the end of a comment line. Interpreting that backslash as a line continuation will break the compilation of the shader, so we need a way to disable this. ---
It is bogus that the new option is setup as something i965-specific. This is really just following the example of the existing force_glsl_extensions_warn options. I believe the correct answer is to create a new "glsl" option cache outside of the driver so that options like these can easily be applied to all code using the GLSL compiler. But I also think that can reasonably be done separately after this patch series. I've looked intowhat it would take to do this. It shouldn't be hard, but I could use some specific assistance with some of the details from someone with more Mesa-internals experience than I have. src/mesa/drivers/dri/common/xmlpool/t_options.h | 5 +++++ src/mesa/drivers/dri/i965/brw_context.c | 2 ++ src/mesa/drivers/dri/intel/intel_screen.c | 3 ++- src/mesa/main/mtypes.h | 6 ++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h index 78f1765..683a473 100644 --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -282,3 +282,8 @@ DRI_CONF_OPT_END DRI_CONF_OPT_BEGIN(disable_blend_func_extended,bool,def) \ DRI_CONF_DESC(en,gettext("Disable dual source blending")) \ DRI_CONF_OPT_END + +#define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \ +DRI_CONF_OPT_BEGIN(disable_glsl_line_continuations,bool,def) \ + DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \ +DRI_CONF_OPT_END diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 5665a3a..4628d82 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -374,6 +374,8 @@ brwCreateContext(int api, ctx->Const.ForceGLSLExtensionsWarn = driQueryOptionb(&intel->optionCache, "force_glsl_extensions_warn"); + ctx->Const.DisableGLSLLineContinuations = driQueryOptionb(&intel->optionCache, "disable_glsl_line_continuations"); + ctx->Const.ContextFlags = 0; if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index e0fe8c1..557f1af 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -80,6 +80,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_ALWAYS_FLUSH_BATCH(false) DRI_CONF_ALWAYS_FLUSH_CACHE(false) DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false) + DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false) DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false) DRI_CONF_OPT_BEGIN(stub_occlusion_query, bool, false) @@ -92,7 +93,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 15; +const GLuint __driNConfigOptions = 16; #include "intel_batchbuffer.h" #include "intel_buffers.h" diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5bfae69..f8fb113 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2925,6 +2925,12 @@ struct gl_constants /** GL_ARB_map_buffer_alignment */ GLuint MinMapBufferAlignment; + + /** + * Disable interpretation of line continuations (lines ending with a + * backslash character ('\') in GLSL source. + */ + GLboolean DisableGLSLLineContinuations; }; -- 1.7.10 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev