nir: Make nir_shader_gather_info() track texelFetch texture accesses.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 9 Sep 2017 07:19:57 +0000 (00:19 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 13 Oct 2017 00:22:42 +0000 (17:22 -0700)
For TGSI-based drivers, st_glsl_to_tgsi records this information.
For NIR-based drivers, nir_shader_gather_info() will do so.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_gather_info.c

index ac87bec46c0c22e79afcbd09bce750f605da36db..f46cee7aa5e8643c905bc9439b27360fc9606c3c 100644 (file)
@@ -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