freedreno/ir3: fix image-to-tex flags, remove 3d -> array hack

The function would return both the 3d and array flags set for 2d array,
and would return just 3d for cubes. Fix the flags so that they are
appropriate for images.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13804>
This commit is contained in:
Ilia Mirkin 2021-11-15 18:31:24 -05:00 committed by Marge Bot
parent a9c1cc63c6
commit 8c9a86cb57
2 changed files with 4 additions and 11 deletions

View file

@ -1319,13 +1319,6 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr,
unsigned flags, ncoords = ir3_get_image_coords(intr, &flags);
type_t type = ir3_get_type_for_image_intrinsic(intr);
/* hmm, this seems a bit odd, but it is what blob does and (at least
* a5xx) just faults on bogus addresses otherwise:
*/
if (flags & IR3_INSTR_3D) {
flags &= ~IR3_INSTR_3D;
flags |= IR3_INSTR_A;
}
info.flags |= flags;
for (unsigned i = 0; i < ncoords; i++)

View file

@ -97,14 +97,14 @@ ir3_image_to_tex(struct ir3_ibo_mapping *mapping, unsigned image)
unsigned
ir3_get_image_coords(const nir_intrinsic_instr *instr, unsigned *flagsp)
{
enum glsl_sampler_dim dim = nir_intrinsic_image_dim(instr);
unsigned coords = nir_image_intrinsic_coord_components(instr);
unsigned flags = 0;
if (coords == 3)
flags |= IR3_INSTR_3D;
if (nir_intrinsic_image_array(instr))
if (dim == GLSL_SAMPLER_DIM_CUBE || nir_intrinsic_image_array(instr))
flags |= IR3_INSTR_A;
else if (dim == GLSL_SAMPLER_DIM_3D)
flags |= IR3_INSTR_3D;
if (flagsp)
*flagsp = flags;