asahi: Implement linear 2D array textures

These are useful for layered staging resources. Tested by forcing linear
textures and running dEQP-GLES3.functional.texture.format.sized.2d_array.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20446>
This commit is contained in:
Alyssa Rosenzweig
2022-12-20 21:00:10 -05:00
parent 0bc70a0074
commit b612690e38
2 changed files with 12 additions and 4 deletions

View File

@@ -300,6 +300,7 @@ agx_linear_allowed(const struct agx_resource *pres)
* works for 2D textures. Rectangle textures are a special case of 2D.
*/
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_RECT:
break;

View File

@@ -587,9 +587,8 @@ agx_pack_texture(void *out, struct agx_resource *rsrc,
util_format_compose_swizzles(format_swizzle, view_swizzle, out_swizzle);
/* Must tile array textures */
assert((rsrc->layout.tiling != AIL_TILING_LINEAR) ||
(state->u.tex.last_layer == state->u.tex.first_layer));
unsigned first_layer =
(state->target == PIPE_BUFFER) ? 0 : state->u.tex.first_layer;
/* Pack the descriptor into GPU memory */
agx_pack(out, TEXTURE, cfg) {
@@ -635,7 +634,15 @@ agx_pack_texture(void *out, struct agx_resource *rsrc,
(state->target == PIPE_TEXTURE_CUBE_ARRAY))
layers /= 6;
cfg.depth = layers;
if (rsrc->layout.tiling == AIL_TILING_LINEAR &&
state->target == PIPE_TEXTURE_2D_ARRAY) {
cfg.depth_linear = layers;
cfg.layer_stride_linear = (rsrc->layout.layer_stride_B - 0x80);
cfg.extended = true;
} else {
assert((rsrc->layout.tiling != AIL_TILING_LINEAR) || (layers == 1));
cfg.depth = layers;
}
}
if (rsrc->base.nr_samples > 1)