v3d: define our own canonical supported formats

Some of the canonical formats defined by Gallium are not TLB compatible,
so we need to provide an alternative.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15693>
This commit is contained in:
Juan A. Suarez Romero
2022-04-13 20:08:45 +02:00
committed by Marge Bot
parent 606e42027e
commit e40cbd3438

View File

@@ -1156,6 +1156,18 @@ v3d_resource_get_stencil(struct pipe_resource *prsc)
return &rsc->separate_stencil->base;
}
static enum pipe_format
v3d_resource_get_compatible_tlb_format(struct pipe_context *pctx,
enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_R16G16_UNORM:
return PIPE_FORMAT_R16G16_UINT;
default:
return format;
}
}
static const struct u_transfer_vtbl transfer_vtbl = {
.resource_create = v3d_resource_create,
.resource_destroy = v3d_resource_destroy,
@@ -1199,4 +1211,5 @@ v3d_resource_context_init(struct pipe_context *pctx)
pctx->blit = v3d_blit;
pctx->generate_mipmap = v3d_generate_mipmap;
pctx->flush_resource = v3d_flush_resource;
pctx->get_canonical_format = v3d_resource_get_compatible_tlb_format;
}