Mesa (main): nir_to_tgsi: Support integer sysvals on !CAP_INTEGERS hardware.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 18 05:01:20 UTC 2021
Module: Mesa
Branch: main
Commit: 026452fe466f2537ce2496efd008b16d1be5053b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=026452fe466f2537ce2496efd008b16d1be5053b
Author: Emma Anholt <emma at anholt.net>
Date: Sun Jun 13 08:07:14 2021 -0700
nir_to_tgsi: Support integer sysvals on !CAP_INTEGERS hardware.
glsl_to_tgsi does the same thing, needed for the draw path on i915g.
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11329>
---
src/gallium/auxiliary/nir/nir_to_tgsi.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 1da966277b0..475243bf2cb 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -1640,6 +1640,23 @@ ntt_emit_load_sysval(struct ntt_compile *c, nir_intrinsic_instr *instr)
uint32_t write_mask = BITSET_MASK(nir_dest_num_components(instr->dest));
sv = ntt_swizzle_for_write_mask(sv, write_mask);
+ /* TGSI and NIR define these intrinsics as always loading ints, but they can
+ * still appear on hardware with non-native-integers fragment shaders using
+ * the draw path (i915g). In that case, having called nir_lower_int_to_float
+ * means that we actually want floats instead.
+ */
+ if (!c->native_integers) {
+ switch (instr->intrinsic) {
+ case nir_intrinsic_load_vertex_id:
+ case nir_intrinsic_load_instance_id:
+ ureg_U2F(c->ureg, ntt_get_dest(c, &instr->dest), sv);
+ return;
+
+ default:
+ break;
+ }
+ }
+
ntt_store(c, &instr->dest, sv);
}
More information about the mesa-commit
mailing list