Mesa (staging/21.3): zink: inject LOD for sampler version of OpImageQuerySize
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 1 19:36:40 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: 5b6ed5880359d1e87fc82727e7fc5de2beae62aa
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b6ed5880359d1e87fc82727e7fc5de2beae62aa
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Oct 28 10:57:01 2021 -0400
zink: inject LOD for sampler version of OpImageQuerySize
this is required by spec
cc: mesa-stable
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13585>
(cherry picked from commit e8f18385e05db6d14ae6807a529c5d69c38d6091)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index fea261458d0..0a60ead40ab 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -265,7 +265,7 @@
"description": "zink: inject LOD for sampler version of OpImageQuerySize",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 68e0db3bf81..78e4f5334cd 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -3224,6 +3224,14 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
lod = emit_float_const(ctx, 32, 0.0);
if (tex->op == nir_texop_txs) {
SpvId image = spirv_builder_emit_image(&ctx->builder, image_type, load);
+ /* Additionally, if its Dim is 1D, 2D, 3D, or Cube,
+ * it must also have either an MS of 1 or a Sampled of 0 or 2.
+ * - OpImageQuerySize specification
+ *
+ * all spirv samplers use these types
+ */
+ if (tex->sampler_dim != GLSL_SAMPLER_DIM_MS && !lod)
+ lod = emit_uint_const(ctx, 32, 0);
SpvId result = spirv_builder_emit_image_query_size(&ctx->builder,
dest_type, image,
lod);
More information about the mesa-commit
mailing list