From 4a92492a8a016114b6b4ed9833dddbc58a485f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 27 Nov 2022 10:39:49 -0500 Subject: [PATCH] gallium: add the u_vbuf pointer into pipe_context This will allow removing the draw_vbo wrapping in cso_context. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/auxiliary/cso_cache/cso_context.c | 4 ++++ src/gallium/include/pipe/p_context.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index efce6f6737e..dbad1b2b416 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -259,7 +259,9 @@ cso_init_vbuf(struct cso_context *cso, unsigned flags) if (caps.fallback_always || (uses_user_vertex_buffers && caps.fallback_only_for_user_vbuffers)) { + assert(!cso->pipe->vbuf); cso->vbuf = u_vbuf_create(cso->pipe, &caps); + cso->pipe->vbuf = cso->vbuf; cso->always_use_vbuf = caps.fallback_always; cso->vbuf_current = caps.fallback_always ? cso->vbuf : NULL; } @@ -451,6 +453,8 @@ cso_destroy_context(struct cso_context *ctx) if (ctx->vbuf) u_vbuf_destroy(ctx->vbuf); + + ctx->pipe->vbuf = NULL; FREE(ctx); } diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 9eff0d87e50..c59dde608ca 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -83,6 +83,7 @@ union pipe_query_result; struct u_log_context; struct u_upload_mgr; struct util_debug_callback; +struct u_vbuf; /** * Gallium rendering context. Basically: @@ -95,6 +96,7 @@ struct pipe_context { void *priv; /**< context private data (for DRI for example) */ void *draw; /**< private, for draw module (temporary?) */ + struct u_vbuf *vbuf; /**< for cso_context, don't use in drivers */ /** * Stream uploaders created by the driver. All drivers, gallium frontends, and