i965: Add a driconf option to disable GL_ARB_blend_func_extended.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 18 Jul 2012 07:07:17 +0000 (00:07 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 19 Jul 2012 08:22:34 +0000 (01:22 -0700)
Unigine Heaven (at least) has a bug where it incorrectly uses the
GL_ARB_blend_func_extended extension.

Dual source blending allows two color outputs per render target;
individual shader outputs can be assigned to be either the first or
second blending input by setting the 'index' via one of two methods:

- An API call: glBindFragDataLocationIndexed()
- The GLSL 'layout' qualifier provided by GL_ARB_explicit_attrib_location

Both of these only work on user defined fragment shader outputs; it's an
error to use either on built-in outputs like gl_FragData.

Unigine uses gl_FragData and gl_FragColor exclusively, and doesn't even
attempt to use either method to set index == 1.  However, it does set
the blending function to SRC1 enums, which requires a fragment shader
output with index == 1 or else rendering is undefined.

In other words, enabling ARB_blend_func_extended causes Unigine to
render incorrectly, resulting in an apparent regression, even though our
driver code (as far as I can tell) is perfectly fine.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50291
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/common/drirc
src/mesa/drivers/dri/common/xmlpool/options.h
src/mesa/drivers/dri/intel/intel_extensions.c
src/mesa/drivers/dri/intel/intel_screen.c

index 2d92878520a930d92c432a7963428887afe7bcb0..52d8dd7247c3f27f7f2af6da1aa0bc331f5dbd09 100644 (file)
@@ -2,15 +2,19 @@
     <device screen="0" driver="i965">
         <application name="Unigine Sanctuary" executable="Sanctuary">
             <option name="force_glsl_extensions_warn" value="true" />
+            <option name="disable_blend_func_extended" value="true" />
        </application>
         <application name="Unigine Tropics" executable="Tropics">
             <option name="force_glsl_extensions_warn" value="true" />
+            <option name="disable_blend_func_extended" value="true" />
        </application>
         <application name="Unigine Heaven (32-bit)" executable="heaven_x86">
             <option name="force_glsl_extensions_warn" value="true" />
+            <option name="disable_blend_func_extended" value="true" />
        </application>
         <application name="Unigine Heaven (64-bit)" executable="heaven_x64">
             <option name="force_glsl_extensions_warn" value="true" />
+            <option name="disable_blend_func_extended" value="true" />
        </application>
     </device>
 </driconf>
index 75c887e5d0680e65e9ffbb84c84e1dc4a8922319..a20e3d12dcfc4ebd84ece3b860dfe2b35d11ff57 100644 (file)
@@ -636,3 +636,13 @@ DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \
         DRI_CONF_DESC(fr,"Force GLSL extension default behavior to 'warn'") \
         DRI_CONF_DESC(sv,"Force GLSL extension default behavior to 'warn'") \
 DRI_CONF_OPT_END
+
+#define DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(def) \
+DRI_CONF_OPT_BEGIN(disable_blend_func_extended,bool,def) \
+        DRI_CONF_DESC(en,"Disable dual source blending") \
+        DRI_CONF_DESC(de,"Disable dual source blending") \
+        DRI_CONF_DESC(es,"Disable dual source blending") \
+        DRI_CONF_DESC(nl,"Disable dual source blending") \
+        DRI_CONF_DESC(fr,"Disable dual source blending") \
+        DRI_CONF_DESC(sv,"Disable dual source blending") \
+DRI_CONF_OPT_END
index 844125dc8a503801030b36b3ef54d728e88e5d55..c2bc0722afabe4818929075e80a780abc9ca2ec0 100755 (executable)
@@ -104,7 +104,7 @@ intelInitExtensions(struct gl_context *ctx)
       ctx->Extensions.EXT_transform_feedback = true;
 
    if (intel->gen >= 6) {
-      ctx->Extensions.ARB_blend_func_extended = true;
+      ctx->Extensions.ARB_blend_func_extended = !driQueryOptionb(&intel->optionCache, "disable_blend_func_extended");
       ctx->Extensions.ARB_draw_buffers_blend = true;
    }
 
index e52bf13cfb68818b82325c11516b554ced0a81f7..81953ce9334d1c2ca7e558437e0379edb622fa67 100644 (file)
@@ -79,6 +79,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_BLEND_FUNC_EXTENDED(false)
 
       DRI_CONF_OPT_BEGIN(stub_occlusion_query, bool, false)
         DRI_CONF_DESC(en, "Enable stub ARB_occlusion_query support on 915/945.")
@@ -90,7 +91,7 @@ PUBLIC const char __driConfigOptions[] =
    DRI_CONF_SECTION_END
 DRI_CONF_END;
 
-const GLuint __driNConfigOptions = 14;
+const GLuint __driNConfigOptions = 15;
 
 #include "intel_batchbuffer.h"
 #include "intel_buffers.h"