intel: Implement Gen12 workaround for array textures of size 1
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 13 Jan 2020 13:11:25 +0000 (15:11 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sun, 26 Jan 2020 20:27:03 +0000 (22:27 +0200)
commit397ff2976ba281a7d599b6246b7f6311011eaa0c
treedafd6b5cdf8fd78f906c2128b1c32c12ab000311
parent4d03e5312732c1ad48cc116b03573b7156fdb5da
intel: Implement Gen12 workaround for array textures of size 1

Gen12 does not support RENDER_SURFACE_STATE::SurfaceArray = true &&
RENDER_SURFACE_STATE::Depth = 0. SurfaceArray can only be set to true
if Depth >= 1.

We workaround this limitation by adding the max(value, 1) snippet in
the shaders on the 3 components for texture array sizes.

Tested on Gen9 with the following Vulkan CTS tests :
dEQP-VK.image.image_size.2d_array.*

v2: Drop debug print (Tapani)
    Switch to GEN:BUG instead of Wa_

v3: Fix dEQP-VK.image.image_size.1d_array.* cases (Lionel)

v4: Fix dEQP-VK.glsl.texture_functions.query.texturesize.* cases
    (Missing tex_op handling) (Lionel)

v5: Missing break statement (Lionel)

v6: Fixup comment (Tapani)

v7: Fixup comment again (Tapani)

v8: Don't use sample_dim as index (Jason)
    Rename pass
    Simplify control flow

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com> (v7)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3362>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3362>
src/intel/Makefile.sources
src/intel/compiler/brw_nir.c
src/intel/compiler/brw_nir.h
src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c [new file with mode: 0644]
src/intel/compiler/meson.build
src/intel/isl/isl_surface_state.c