Mesa (main): zink: create dummy surface/bufferview for null descriptor use
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 2 17:14:01 UTC 2021
Module: Mesa
Branch: main
Commit: 7ed9919e955e1a331dfcd18afd2df5762888f445
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ed9919e955e1a331dfcd18afd2df5762888f445
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Mar 25 15:55:33 2021 -0400
zink: create dummy surface/bufferview for null descriptor use
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11122>
---
src/gallium/drivers/zink/zink_context.c | 11 ++++++++++-
src/gallium/drivers/zink/zink_context.h | 2 ++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 3888cb3a9a6..f4c6cb53b6a 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -95,6 +95,9 @@ zink_context_destroy(struct pipe_context *pctx)
pipe_resource_reference(&ctx->dummy_vertex_buffer, NULL);
pipe_resource_reference(&ctx->dummy_xfb_buffer, NULL);
+ zink_surface_reference(screen, (struct zink_surface**)&ctx->dummy_surface, NULL);
+ zink_buffer_view_reference(screen, &ctx->dummy_bufferview, NULL);
+
if (ctx->tc)
util_queue_destroy(&ctx->batch.flush_queue);
@@ -3364,13 +3367,19 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
const uint8_t data[] = { 0 };
ctx->dummy_vertex_buffer = pipe_buffer_create_with_data(&ctx->base,
- PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_IMMUTABLE, sizeof(data), data);
+ PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_SHADER_IMAGE, 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;
+ ctx->dummy_surface = zink_surface_create_null(ctx, PIPE_TEXTURE_2D, 1, 1, 1);
+ if (!ctx->dummy_surface)
+ goto fail;
+ ctx->dummy_bufferview = get_buffer_view(ctx, zink_resource(ctx->dummy_vertex_buffer), PIPE_FORMAT_R8_UNORM, 0, sizeof(data));
+ if (!ctx->dummy_bufferview)
+ goto fail;
if (!zink_descriptor_layouts_init(ctx))
goto fail;
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index e1d1e449591..864cd3b29c5 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -231,6 +231,8 @@ struct zink_context {
struct pipe_resource *dummy_vertex_buffer;
struct pipe_resource *dummy_xfb_buffer;
+ struct pipe_surface *dummy_surface;
+ struct zink_buffer_view *dummy_bufferview;
struct {
/* descriptor info */
More information about the mesa-commit
mailing list