From: Mike Blumenkrantz Date: Thu, 28 Oct 2021 14:57:01 +0000 (-0400) Subject: zink: inject LOD for sampler version of OpImageQuerySize X-Git-Tag: upstream/22.3.5~16128 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8f18385e05db6d14ae6807a529c5d69c38d6091;p=platform%2Fupstream%2Fmesa.git zink: inject LOD for sampler version of OpImageQuerySize this is required by spec cc: mesa-stable Reviewed-by: Jason Ekstrand Part-of: --- 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 c09e346..b03dca5 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 @@ -2980,6 +2980,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);