zink: fake sparse R9G9B9E5 support as needed

these just allocate the whole thing now, which means they aren't actually
sparse, but who cares because nobody but cts is actually going to use it
and those tests pass just fine

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14381>
This commit is contained in:
Mike Blumenkrantz 2022-01-03 14:34:44 -05:00 committed by Marge Bot
parent d83b52928c
commit 1bbcd68d5f
2 changed files with 7 additions and 0 deletions

View File

@ -861,6 +861,9 @@ zink_bo_commit(struct zink_screen *screen, struct zink_resource *res, unsigned l
bool ok = true;
struct zink_bo *bo = res->obj->bo;
if (screen->faked_e5sparse && res->base.b.format == PIPE_FORMAT_R9G9B9E5_FLOAT)
return true;
simple_mtx_lock(&screen->queue_lock);
simple_mtx_lock(&bo->lock);
if (res->base.b.target == PIPE_BUFFER) {

View File

@ -782,6 +782,10 @@ resource_create(struct pipe_screen *pscreen,
struct pipe_resource templ2 = *templ;
if (templ2.flags & PIPE_RESOURCE_FLAG_SPARSE)
templ2.bind |= PIPE_BIND_SHADER_IMAGE;
if (screen->faked_e5sparse && templ->format == PIPE_FORMAT_R9G9B9E5_FLOAT) {
templ2.flags &= ~PIPE_RESOURCE_FLAG_SPARSE;
res->base.b.flags &= ~PIPE_RESOURCE_FLAG_SPARSE;
}
unsigned scanout_flags = templ->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED);
if (whandle && whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE)
scanout_flags = 0;