From 79dd0562f461b429aca81ea35ead9c6315659b85 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 9 Oct 2020 11:13:57 -0400 Subject: [PATCH] zink: create dummy xfb buffer xfb spec disallows binding a null buffer, so we need something to throw in Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/zink/zink_context.c | 5 +++++ src/gallium/drivers/zink/zink_context.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 3c343211051..42c097703ef 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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)); diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 774873a48ee..b7b1ddd062f 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -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;