Mesa (master): meta: Unset the textures_used_by_txf bitfield.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Oct 13 00:24:13 UTC 2017


Module: Mesa
Branch: master
Commit: 32fcced7b479cb7acf43305481cc23a0b04b051c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32fcced7b479cb7acf43305481cc23a0b04b051c

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Oct 11 00:18:38 2017 -0700

meta: Unset the textures_used_by_txf bitfield.

Drivers that use Meta are happily using blitting data using texelFetch
and GL_SKIP_DECODE_EXT, but the GL_EXT_texture_sRGB spec unfortunately
makes GL_SKIP_DECODE_EXT not necessarily work with texelFetch.

As a hack, just unset the texture_used_by_txf bitfield so we can
continue with the old desired behavior.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/mesa/drivers/common/meta.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7314384248..bae04bea51 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -87,6 +87,7 @@
 #include "main/glformats.h"
 #include "util/bitscan.h"
 #include "util/ralloc.h"
+#include "compiler/nir/nir.h"
 
 /** Return offset in bytes of the field within a vertex struct */
 #define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
@@ -195,6 +196,18 @@ _mesa_meta_compile_and_link_program(struct gl_context *ctx,
 
    _mesa_meta_link_program_with_debug(ctx, sh_prog);
 
+   struct gl_program *fp =
+      sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
+
+   /* texelFetch() can break GL_SKIP_DECODE_EXT, but many meta passes want
+    * to use both together; pretend that we're not using texelFetch to hack
+    * around this bad interaction.  This is a bit fragile as it may break
+    * if you re-run the pass that gathers this info, but we probably won't...
+    */
+   fp->info.textures_used_by_txf = 0;
+   if (fp->nir)
+      fp->nir->info.textures_used_by_txf = 0;
+
    _mesa_meta_use_program(ctx, sh_prog);
 
    *out_sh_prog = sh_prog;




More information about the mesa-commit mailing list