Mesa (main): nine: Disable optional use of TTN when MUL_ZERO_WINS is available.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 20 14:22:22 UTC 2022


Module: Mesa
Branch: main
Commit: 7f01299c40ef5d301bbbb99fc6a6420aa27a65dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f01299c40ef5d301bbbb99fc6a6420aa27a65dc

Author: Emma Anholt <emma at anholt.net>
Date:   Mon Mar 28 15:07:09 2022 -0700

nine: Disable optional use of TTN when MUL_ZERO_WINS is available.

NIR doesn't have that knob currently, so we end up throwing errors about
it being ignored.

This should fix cases of "tgsi_to_nir: unhandled TGSI property 23 = 1",
and presumably do better at DX9 muls on nv50 and r600.

Acked-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14883>

---

 src/gallium/frontends/nine/nine_shader.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/nine/nine_shader.c b/src/gallium/frontends/nine/nine_shader.c
index f8ac83e45d5..aa2680160f9 100644
--- a/src/gallium/frontends/nine/nine_shader.c
+++ b/src/gallium/frontends/nine/nine_shader.c
@@ -3893,9 +3893,13 @@ nine_ureg_create_shader(struct ureg_program                  *ureg,
     assert(((struct tgsi_header *) &tgsi_tokens[0])->HeaderSize >= 2);
     enum pipe_shader_type shader_type = ((struct tgsi_processor *) &tgsi_tokens[1])->Processor;
 
+    /* NIR doesn't have mul_zero_wins */
+    bool ttn_supported = !GET_CAP(TGSI_MUL_ZERO_WINS);
     int preferred_ir = screen->get_shader_param(screen, shader_type, PIPE_SHADER_CAP_PREFERRED_IR);
+    int supported_irs = screen->get_shader_param(screen, shader_type, PIPE_SHADER_CAP_SUPPORTED_IRS);
     bool prefer_nir = (preferred_ir == PIPE_SHADER_IR_NIR);
-    bool use_nir = prefer_nir ||
+    bool use_nir = (prefer_nir && ttn_supported) ||
+        !(supported_irs & (1 << PIPE_SHADER_IR_TGSI)) ||
         ((shader_type == PIPE_SHADER_VERTEX) && nine_shader_get_debug_flag(NINE_SHADER_DEBUG_OPTION_NIR_VS)) ||
         ((shader_type == PIPE_SHADER_FRAGMENT) && nine_shader_get_debug_flag(NINE_SHADER_DEBUG_OPTION_NIR_PS));
 



More information about the mesa-commit mailing list