From cc2f3a0168d11d74022b87b48f20c03ddeee6f53 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 17 Oct 2021 14:06:50 -0400 Subject: [PATCH] gallium,vbo: add PIPE_BIND_VERTEX_STATE for display lists Reviewed-by: Pierre-Eric Pelloux-Prayer Reviewed-By: Mike Blumenkrantz Part-of: --- src/gallium/include/pipe/p_defines.h | 1 + src/mesa/main/dd.h | 6 ++++++ src/mesa/state_tracker/st_cb_bufferobjects.c | 5 ++++- src/mesa/vbo/vbo_save_api.c | 6 ++++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index c88aee3..5c00901 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -480,6 +480,7 @@ enum pipe_flush_flags #define PIPE_BIND_INDEX_BUFFER (1 << 5) /* draw_elements */ #define PIPE_BIND_CONSTANT_BUFFER (1 << 6) /* set_constant_buffer */ #define PIPE_BIND_DISPLAY_TARGET (1 << 7) /* flush_front_buffer */ +#define PIPE_BIND_VERTEX_STATE (1 << 8) /* create_vertex_state */ /* gap */ #define PIPE_BIND_STREAM_OUTPUT (1 << 10) /* set_stream_output_buffers */ #define PIPE_BIND_CURSOR (1 << 11) /* mouse cursor */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index dd24658..ebd29c5 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -92,6 +92,12 @@ struct pipe_vertex_element; /* This buffer will only be mapped/unmapped once */ #define MESA_MAP_ONCE 0x10000 +/* This BufferStorage flag indicates that the buffer will be used + * by pipe_vertex_state, which doesn't track buffer busyness and doesn't + * support invalidations. + */ +#define MESA_GALLIUM_VERTEX_STATE_STORAGE 0x20000 + /** * Device driver function table. diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index fdb1ec6..782c025 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -353,7 +353,10 @@ bufferobj_data(struct gl_context *ctx, release_buffer(obj); - const unsigned bindings = buffer_target_to_bind_flags(target); + unsigned bindings = buffer_target_to_bind_flags(target); + + if (storageFlags & MESA_GALLIUM_VERTEX_STATE_STORAGE) + bindings |= PIPE_BIND_VERTEX_STATE; if (ST_DEBUG & DEBUG_BUFFER) { debug_printf("Create buffer size %" PRId64 " bind 0x%x\n", diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 7f2b1d4..dbfe165 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -746,7 +746,8 @@ compile_vertex_list(struct gl_context *ctx) GL_ELEMENT_ARRAY_BUFFER_ARB, MAX2(total_bytes_needed, VBO_SAVE_BUFFER_SIZE), NULL, - GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT, + GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT | + MESA_GALLIUM_VERTEX_STATE_STORAGE, save->current_bo); if (!success) { _mesa_reference_buffer_object(ctx, &save->current_bo, NULL); @@ -876,7 +877,8 @@ end: GL_ELEMENT_ARRAY_BUFFER_ARB, VBO_SAVE_BUFFER_SIZE, NULL, - GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT, + GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT | + MESA_GALLIUM_VERTEX_STATE_STORAGE, save->current_bo); if (!success) handle_out_of_memory(ctx); -- 2.7.4