diff --git a/src/asahi/lib/cmdbuf.xml b/src/asahi/lib/cmdbuf.xml index 66fdbc8684b..ee58bddddd7 100644 --- a/src/asahi/lib/cmdbuf.xml +++ b/src/asahi/lib/cmdbuf.xml @@ -205,6 +205,7 @@ + diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index c1bf2cf5de8..3116b345efa 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -476,10 +476,16 @@ agx_create_sampler_view(struct pipe_context *pctx, cfg.unk_mipmapped = rsrc->mipmapped; cfg.srgb_2_channel = cfg.srgb && util_format_colormask(desc) == 0x3; - if (state->target == PIPE_TEXTURE_3D) + if (state->target == PIPE_TEXTURE_3D) { cfg.depth = u_minify(texture->depth0, level); - else - cfg.depth = state->u.tex.last_layer - state->u.tex.first_layer + 1; + } else { + unsigned layers = state->u.tex.last_layer - state->u.tex.first_layer + 1; + + if ((state->target == PIPE_TEXTURE_CUBE) || (state->target == PIPE_TEXTURE_CUBE_ARRAY)) + layers /= 6; + + cfg.depth = layers; + } if (rsrc->modifier == DRM_FORMAT_MOD_LINEAR) { cfg.stride = ail_get_linear_stride_B(&rsrc->layout, level) - 16;