Mesa (master): nir_to_tgsi: Respect PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Mar 18 03:49:30 UTC 2021
Module: Mesa
Branch: master
Commit: 4258ab45b75831db0270e07ed918e5f3b3a9a86f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4258ab45b75831db0270e07ed918e5f3b3a9a86f
Author: Eric Anholt <eric at anholt.net>
Date: Wed Mar 17 10:39:35 2021 -0700
nir_to_tgsi: Respect PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED.
If the driver can't do it, we shouldn't be putting it in the TGSI,
regardless of what the NIR compiler above us decided.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Neha Bhende <bhenden at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9662>
---
src/gallium/auxiliary/nir/nir_to_tgsi.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index e6e5c3c67e8..723786cf845 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -2646,9 +2646,12 @@ nir_to_tgsi_lower_64bit_to_vec2(nir_shader *s)
}
static void
-ntt_fix_nir_options(struct nir_shader *s)
+ntt_fix_nir_options(struct pipe_screen *screen, struct nir_shader *s)
{
const struct nir_shader_compiler_options *options = s->options;
+ bool lower_fsqrt =
+ !screen->get_shader_param(screen, pipe_shader_type_from_mesa(s->info.stage),
+ PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED);
if (!options->lower_extract_byte ||
!options->lower_extract_word ||
@@ -2657,7 +2660,8 @@ ntt_fix_nir_options(struct nir_shader *s)
!options->lower_fmod ||
!options->lower_rotate ||
!options->lower_uniforms_to_ubo ||
- !options->lower_vector_cmp) {
+ !options->lower_vector_cmp ||
+ options->lower_fsqrt != lower_fsqrt) {
nir_shader_compiler_options *new_options = ralloc(s, nir_shader_compiler_options);
*new_options = *s->options;
@@ -2669,6 +2673,7 @@ ntt_fix_nir_options(struct nir_shader *s)
new_options->lower_rotate = true;
new_options->lower_uniforms_to_ubo = true,
new_options->lower_vector_cmp = true;
+ new_options->lower_fsqrt = lower_fsqrt;
s->options = new_options;
}
@@ -2694,7 +2699,7 @@ nir_to_tgsi(struct nir_shader *s,
PIPE_SHADER_CAP_INTEGERS);
const struct nir_shader_compiler_options *original_options = s->options;
- ntt_fix_nir_options(s);
+ ntt_fix_nir_options(screen, s);
NIR_PASS_V(s, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
type_size, (nir_lower_io_options)0);
More information about the mesa-commit
mailing list