Module: Mesa
Branch: master
Commit: 79dd0562f461b429aca81ea35ead9c6315659b85
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=79dd0562f461b429aca81ea35ead9c6315659b85

Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Oct  9 11:13:57 2020 -0400

zink: create dummy xfb buffer

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

Reviewed-by: Erik Faye-Lund <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8943>

---

 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;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to