Mesa (master): st/nir: Don't use GLSL IR's MOD_TO_FLOOR lowering when using NIR.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 5 23:56:31 UTC 2019


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu May 16 22:41:13 2019 -0700

st/nir: Don't use GLSL IR's MOD_TO_FLOOR lowering when using NIR.

Both GLSL IR and NIR perform the same mod -> floor lowering for 32-bit
types.  But nir_lower_double_ops is slightly more defensive against
lowered drcp precision loss, and handles mod(x, x) = 0 directly.  This
works well...assuming nir_lower_double_ops actually gets an fmod op to
lower in the first place.

The previous patches enabled NIR-based lowering for the remaining
drivers, so we can stop using the GLSL IR lowering when using NIR.

Fixes KHR-GL45.gpu_shader_fp64.builtin.mod_dvec[234] on iris.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/state_tracker/st_glsl_to_ir.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_ir.cpp b/src/mesa/state_tracker/st_glsl_to_ir.cpp
index ea56bf432a6..ba241c08ad9 100644
--- a/src/mesa/state_tracker/st_glsl_to_ir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_ir.cpp
@@ -121,7 +121,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
             shader, ctx->Extensions.KHR_blend_equation_advanced_coherent);
 
       lower_instructions(ir,
-                         MOD_TO_FLOOR |
+                         (use_nir ? 0 : MOD_TO_FLOOR) |
                          FDIV_TO_MUL_RCP |
                          EXP_TO_EXP2 |
                          LOG_TO_LOG2 |




More information about the mesa-commit mailing list