v3d/tex: handle correctly coordinates for cube/cubearrays images

When fetching for cube maps, we need to interpret them as 2d texture
arrays, being the third coordinate the index for the face.

Fixes Vulkan CTS tests like the following using v3dv:

dEQP-VK.binding_model.shader_access.primary_cmd_buf.storage_image.fragment.single_descriptor.cube_base_mip
dEQP-VK.binding_model.shader_access.primary_cmd_buf.storage_image.compute.multiple_descriptor_sets.multiple_contiguous_descriptors.cube_array_base_mip

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5675>
This commit is contained in:
Alejandro Piñeiro
2020-06-26 15:32:31 +02:00
committed by Marge Bot
parent 0b6e03b848
commit f8946bd705

View File

@@ -363,11 +363,11 @@ v3d40_vir_emit_image_load_store(struct v3d_compile *c,
break; break;
case GLSL_SAMPLER_DIM_2D: case GLSL_SAMPLER_DIM_2D:
case GLSL_SAMPLER_DIM_RECT: case GLSL_SAMPLER_DIM_RECT:
case GLSL_SAMPLER_DIM_CUBE:
vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUT, vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUT,
ntq_get_src(c, instr->src[1], 1), &tmu_writes); ntq_get_src(c, instr->src[1], 1), &tmu_writes);
break; break;
case GLSL_SAMPLER_DIM_3D: case GLSL_SAMPLER_DIM_3D:
case GLSL_SAMPLER_DIM_CUBE:
vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUT, vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUT,
ntq_get_src(c, instr->src[1], 1), &tmu_writes); ntq_get_src(c, instr->src[1], 1), &tmu_writes);
vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUR, vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUR,
@@ -377,7 +377,11 @@ v3d40_vir_emit_image_load_store(struct v3d_compile *c,
unreachable("bad image sampler dim"); unreachable("bad image sampler dim");
} }
if (nir_intrinsic_image_array(instr)) { /* In order to fetch on a cube map, we need to interpret it as
* 2D arrays, where the third coord would be the face index.
*/
if (nir_intrinsic_image_dim(instr) == GLSL_SAMPLER_DIM_CUBE ||
nir_intrinsic_image_array(instr)) {
vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUI, vir_TMU_WRITE(c, V3D_QPU_WADDR_TMUI,
ntq_get_src(c, instr->src[1], ntq_get_src(c, instr->src[1],
is_1d ? 1 : 2), &tmu_writes); is_1d ? 1 : 2), &tmu_writes);