#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 */
/* 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.
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",
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);
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);