Mesa (master): nir/vtn: Handle integer sampling coordinates
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 31 21:34:34 UTC 2020
Module: Mesa
Branch: master
Commit: 701cb9d60c0350b0134e52cb1b51eefbbf27bd22
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=701cb9d60c0350b0134e52cb1b51eefbbf27bd22
Author: Jesse Natalie <jenatali at microsoft.com>
Date: Wed May 6 17:20:26 2020 -0700
nir/vtn: Handle integer sampling coordinates
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5242>
---
src/compiler/spirv/spirv_to_nir.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index e2912809bb0..8067c419477 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2632,9 +2632,21 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
if (is_array && texop != nir_texop_lod)
coord_components++;
- coord = vtn_get_nir_ssa(b, w[idx++]);
+ struct vtn_ssa_value *coord_val = vtn_ssa_value(b, w[idx++]);
+ coord = coord_val->def;
p->src = nir_src_for_ssa(nir_channels(&b->nb, coord,
(1 << coord_components) - 1));
+
+ /* OpenCL allows integer sampling coordinates */
+ if (glsl_type_is_integer(coord_val->type) &&
+ opcode == SpvOpImageSampleExplicitLod) {
+ vtn_fail_if(b->shader->info.stage != MESA_SHADER_KERNEL,
+ "Unless the Kernel capability is being used, the coordinate parameter "
+ "OpImageSampleExplicitLod must be floating point.");
+
+ p->src = nir_src_for_ssa(nir_i2f32(&b->nb, p->src.ssa));
+ }
+
p->src_type = nir_tex_src_coord;
p++;
break;
More information about the mesa-commit
mailing list