nir_to_spirv: Allow LOD for external images

External images translate to 2D images in ntv, so we will have to emit
OpImageQuerySizeLod instead of OpImageQuerySize (thanks Faith for
pointing that out). This quells

  VUID-VkShaderModuleCreateInfo-pCode-08737

  Image must have either 'MS'=1 or 'Sampled'=0 or 'Sampled'=2
     %32 = OpImageQuerySize %v2int %31

triggred by piglit

  spec@oes_egl_image_external_essl3@oes_egl_image_external_essl3

on Zink.

Fixes: 3f783a3c50
  zink: omit Lod image operand in ntv when not using an image texture dim

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28389>
This commit is contained in:
Gert Wollny
2024-03-26 09:58:05 +01:00
committed by Marge Bot
parent 601d219257
commit b6c1390354
@@ -3549,6 +3549,9 @@ tex_instr_is_lod_allowed(nir_tex_instr *tex)
tex->sampler_dim == GLSL_SAMPLER_DIM_2D ||
tex->sampler_dim == GLSL_SAMPLER_DIM_3D ||
tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE ||
/* External images are interpreted as 2D in type_to_dim,
* so LOD is allowed */
tex->sampler_dim == GLSL_SAMPLER_DIM_EXTERNAL ||
/* RECT will always become 2D, so this is fine */
tex->sampler_dim == GLSL_SAMPLER_DIM_RECT);
}