zink: create dummy xfb buffer

xfb spec disallows binding a null buffer, so we need something to throw in

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8943>
This commit is contained in:
Mike Blumenkrantz 2020-10-09 11:13:57 -04:00 committed by Marge Bot
parent ce230f15e4
commit 79dd0562f4
2 changed files with 6 additions and 0 deletions

View File

@ -62,6 +62,7 @@ zink_context_destroy(struct pipe_context *pctx)
util_blitter_destroy(ctx->blitter);
pipe_resource_reference(&ctx->dummy_vertex_buffer, NULL);
pipe_resource_reference(&ctx->dummy_xfb_buffer, NULL);
for (unsigned i = 0; i < ARRAY_SIZE(ctx->null_buffers); i++)
pipe_resource_reference(&ctx->null_buffers[i], NULL);
@ -1754,6 +1755,10 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_IMMUTABLE, sizeof(data), data);
if (!ctx->dummy_vertex_buffer)
goto fail;
ctx->dummy_xfb_buffer = pipe_buffer_create_with_data(&ctx->base,
PIPE_BIND_STREAM_OUTPUT, PIPE_USAGE_DEFAULT, sizeof(data), data);
if (!ctx->dummy_xfb_buffer)
goto fail;
/* start the first batch */
zink_start_batch(ctx, zink_curr_batch(ctx));

View File

@ -171,6 +171,7 @@ struct zink_context {
bool queries_disabled, render_condition_active;
struct pipe_resource *dummy_vertex_buffer;
struct pipe_resource *dummy_xfb_buffer;
struct pipe_resource *null_buffers[5]; /* used to create zink_framebuffer->null_surface, one buffer per samplecount */
uint32_t num_so_targets;