On 11.10.2017 21:15, Kenneth Graunke wrote:
GL_EXT_texture_sRGB_decode requires us to handle sRGB decoding
in an inconsistent manner when textures are accessed via texelFetch().

So, we need to track which textures are accessed via texelFetch().

Reviewed-by: Nicolai Hähnle <[email protected]>


---
  src/compiler/nir/nir_gather_info.c | 14 +++++++++++++-
  src/compiler/shader_info.h         |  3 +++
  2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_gather_info.c 
b/src/compiler/nir/nir_gather_info.c
index ac87bec46c0..f46cee7aa5e 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -264,8 +264,20 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, 
nir_shader *shader)
  static void
  gather_tex_info(nir_tex_instr *instr, nir_shader *shader)
  {
-   if (instr->op == nir_texop_tg4)
+   switch (instr->op) {
+   case nir_texop_tg4:
        shader->info.uses_texture_gather = true;
+      break;
+   case nir_texop_txf:
+   case nir_texop_txf_ms:
+   case nir_texop_txf_ms_mcs:
+      shader->info.textures_used_by_txf |=
+         ((1 << MAX2(instr->texture_array_size, 1)) - 1) <<
+         instr->texture_index;
+      break;
+   default:
+      break;
+   }
  }
static void
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 38413940d67..cd044d86094 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -70,6 +70,9 @@ typedef struct shader_info {
     /* Whether or not this shader ever uses textureGather() */
     bool uses_texture_gather;
+ /** Bitfield of which textures are used by texelFetch() */
+   uint32_t textures_used_by_txf;
+
     /* The size of the gl_ClipDistance[] array, if declared. */
     unsigned clip_distance_array_size;


--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to