[Mesa-dev] [PATCH 16/92] st/nir: make nir_lower_tex configurable

Nicolai Hähnle nhaehnle at gmail.com
Mon Jun 26 14:09:55 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/mesa/state_tracker/st_program.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index eb44fc5..a3b8bbf 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1072,22 +1072,31 @@ st_create_fp_variant(struct st_context *st,
                    sizeof(options.bias_state_tokens));
          }
 
          _mesa_add_state_reference(params, texcoord_state);
          memcpy(options.texcoord_state_tokens, texcoord_state,
                 sizeof(options.texcoord_state_tokens));
 
          NIR_PASS_V(tgsi.ir.nir, nir_lower_drawpixels, &options);
       }
 
-      if (unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
-         nir_lower_tex_options options = {0};
+      const nir_lower_tex_options *screen_lower_tex_options =
+         st->pipe->screen->get_struct_param(st->pipe->screen,
+                                            PIPE_STRUCT_CAP_NIR_LOWER_TEX_OPTIONS);
+
+      if (screen_lower_tex_options ||
+          unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
+         nir_lower_tex_options options;
+         if (screen_lower_tex_options)
+            memcpy(&options, screen_lower_tex_options, sizeof(options));
+         else
+            memset(&options, 0, sizeof(options));
          options.lower_y_uv_external = key->external.lower_nv12;
          options.lower_y_u_v_external = key->external.lower_iyuv;
          NIR_PASS_V(tgsi.ir.nir, nir_lower_tex, &options);
       }
 
       st_finalize_nir(st, &stfp->Base, tgsi.ir.nir);
 
       if (unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
          /* This pass needs to happen *after* nir_lower_sampler */
          NIR_PASS_V(tgsi.ir.nir, st_nir_lower_tex_src_plane,
-- 
2.9.3



More information about the mesa-dev mailing list