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

Author: Karol Herbst <kher...@redhat.com>
Date:   Tue Oct 15 01:06:18 2019 +0200

st/mesa: fix crash for drivers supporting nir defaulting to tgsi

nvc0 and I assume radeonsi as well hit an assert inside glsl_to_tgsi as atan
instructions get inserted into the shader.

Fixes: cece947a8dfa ("glsl/builtin: Add alternate versions of atan using new 
ops")
Cc: Neil Roberts <nrobe...@igalia.com>
Signed-off-by: Karol Herbst <kher...@redhat.com>
Reviewed-by: Timothy Arceri <tarc...@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>
Reviewed-by: Rob Clark <robdcl...@gmail.com>

---

 src/mesa/state_tracker/st_extensions.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index c9a99b06f4b..14f270e1447 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -163,7 +163,10 @@ void st_init_limits(struct pipe_screen *screen,
       struct gl_program_constants *pc;
       const nir_shader_compiler_options *nir_options = NULL;
 
-      if (screen->get_compiler_options) {
+      bool prefer_nir = PIPE_SHADER_IR_NIR ==
+         screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_PREFERRED_IR);
+
+      if (screen->get_compiler_options && prefer_nir) {
          nir_options = (const nir_shader_compiler_options *)
             screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR, sh);
       }
@@ -324,9 +327,6 @@ void st_init_limits(struct pipe_screen *screen,
       if (!screen->get_param(screen, PIPE_CAP_NIR_COMPACT_ARRAYS))
          options->LowerCombinedClipCullDistance = true;
 
-      bool prefer_nir = PIPE_SHADER_IR_NIR ==
-         screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_PREFERRED_IR);
-
       /* NIR can do the lowering on our behalf and we'll get better results
        * because it can actually optimize SSBO access.
        */

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to