zink: inject LOD for sampler version of OpImageQuerySize

this is required by spec

cc: mesa-stable

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13585>
(cherry picked from commit e8f18385e0)
This commit is contained in:
Mike Blumenkrantz 2021-10-28 10:57:01 -04:00 committed by Dylan Baker
parent 5cd36b4f87
commit aa0ac4d3fc
2 changed files with 9 additions and 1 deletions

View file

@ -238,7 +238,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
},

View file

@ -3030,6 +3030,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);