diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index c88aee3936f..5c009017ac5 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 dd246585dca..ebd29c584d1 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 fdb1ec69a67..782c0250b79 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 7f2b1d4b917..dbfe1650888 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);