Mesa (staging/21.3): zink: never use SpvOpImageQuerySizeLod for texel buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 26 22:36:10 UTC 2022


Module: Mesa
Branch: staging/21.3
Commit: e5d8b764d5ba5affb43156f68260a562db55f815
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5d8b764d5ba5affb43156f68260a562db55f815

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jan 21 09:39:22 2022 -0500

zink: never use SpvOpImageQuerySizeLod for texel buffers

this is illegal

cc: mesa-stable

affects KHR-GL46.texture_buffer.texture_buffer_texture_buffer_range

Reviewed-by: Caio Oliveira <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14696>
(cherry picked from commit 5e748770b9ca755811d55cafba084b3434165fe0)

---

 .pick_status.json                                    | 2 +-
 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4f6748cb7c8..9bebe081338 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -697,7 +697,7 @@
         "description": "zink: never use SpvOpImageQuerySizeLod for texel buffers",
         "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 eed1fb57bdf..3dd05824d50 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
@@ -3255,13 +3255,16 @@ 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,
+      /* Its Dim operand must be one of 1D, 2D, 3D, or Cube
+       * - OpImageQuerySizeLod specification
+       *
+       * 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)
+      if (!lod && tex_instr_is_lod_allowed(tex))
          lod = emit_uint_const(ctx, 32, 0);
       SpvId result = spirv_builder_emit_image_query_size(&ctx->builder,
                                                          dest_type, image,



More information about the mesa-commit mailing list