<glx ignore="true"/>
</function>
- <function name="DeleteBuffers" es1="1.1" es2="2.0" no_error="true">
+ <function name="DeleteBuffers" es1="1.1" es2="2.0" no_error="true"
+ marshal_call_after="if (COMPAT) _mesa_glthread_DeleteBuffers(ctx, n, buffer);">
<param name="n" type="GLsizei" counter="true"/>
<param name="buffer" type="const GLuint *" count="n"/>
<glx ignore="true"/>
struct glthread_vao {
GLuint Name;
bool HasUserPointer;
- bool IndexBufferIsUserPointer;
+ GLuint CurrentElementBufferName;
};
/** A single batch of commands queued up for execution. */
struct glthread_vao *LastLookedUpVAO;
struct glthread_vao DefaultVAO;
- /**
- * Tracks on the main thread side whether the current vertex array binding
- * is in a VBO.
- */
- bool vertex_array_is_vbo;
-
- /**
- * Tracks on the main thread side whether the current element array (index
- * buffer) binding is in a VBO.
- */
- bool draw_indirect_buffer_is_vbo;
+ /** Currently-bound buffer object IDs. */
+ GLuint CurrentArrayBufferName;
+ GLuint CurrentDrawIndirectBufferName;
};
void _mesa_glthread_init(struct gl_context *ctx);
void _mesa_glthread_finish(struct gl_context *ctx);
void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);
+void _mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target,
+ GLuint buffer);
+void _mesa_glthread_DeleteBuffers(struct gl_context *ctx, GLsizei n,
+ const GLuint *buffers);
+
void _mesa_glthread_BindVertexArray(struct gl_context *ctx, GLuint id);
void _mesa_glthread_DeleteVertexArrays(struct gl_context *ctx,
GLsizei n, const GLuint *ids);
switch (target) {
case GL_ARRAY_BUFFER:
- glthread->vertex_array_is_vbo = (buffer != 0);
+ glthread->CurrentArrayBufferName = buffer;
break;
case GL_ELEMENT_ARRAY_BUFFER:
/* The current element array buffer binding is actually tracked in the
* vertex array object instead of the context, so this would need to
* change on vertex array object updates.
*/
- glthread->CurrentVAO->IndexBufferIsUserPointer = buffer != 0;
+ glthread->CurrentVAO->CurrentElementBufferName = buffer;
break;
case GL_DRAW_INDIRECT_BUFFER:
- glthread->draw_indirect_buffer_is_vbo = buffer != 0;
+ glthread->CurrentDrawIndirectBufferName = buffer;
break;
}
}
+void
+_mesa_glthread_DeleteBuffers(struct gl_context *ctx, GLsizei n,
+ const GLuint *buffers)
+{
+ struct glthread_state *glthread = &ctx->GLThread;
+
+ if (!buffers)
+ return;
+
+ for (unsigned i = 0; i < n; i++) {
+ GLuint id = buffers[i];
+
+ if (id == glthread->CurrentArrayBufferName)
+ _mesa_glthread_BindBuffer(ctx, GL_ARRAY_BUFFER, 0);
+ if (id == glthread->CurrentVAO->CurrentElementBufferName)
+ _mesa_glthread_BindBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, 0);
+ if (id == glthread->CurrentDrawIndirectBufferName)
+ _mesa_glthread_BindBuffer(ctx, GL_DRAW_INDIRECT_BUFFER, 0);
+ }
+}
/* BufferData: marshalled asynchronously */
struct marshal_cmd_BufferData
_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx)
{
const struct glthread_state *glthread = &ctx->GLThread;
+ struct glthread_vao *vao = glthread->CurrentVAO;
return ctx->API != API_OPENGL_CORE &&
- (glthread->CurrentVAO->IndexBufferIsUserPointer ||
- glthread->CurrentVAO->HasUserPointer);
+ (vao->CurrentElementBufferName == 0 || vao->HasUserPointer);
}
static inline bool
const struct glthread_state *glthread = &ctx->GLThread;
return ctx->API != API_OPENGL_CORE &&
- (!glthread->draw_indirect_buffer_is_vbo ||
- glthread->CurrentVAO->HasUserPointer );
+ (glthread->CurrentDrawIndirectBufferName == 0 ||
+ glthread->CurrentVAO->HasUserPointer);
}
static inline bool
_mesa_glthread_is_non_vbo_draw_elements_indirect(const struct gl_context *ctx)
{
const struct glthread_state *glthread = &ctx->GLThread;
+ struct glthread_vao *vao = glthread->CurrentVAO;
return ctx->API != API_OPENGL_CORE &&
- (!glthread->draw_indirect_buffer_is_vbo ||
- glthread->CurrentVAO->IndexBufferIsUserPointer ||
- glthread->CurrentVAO->HasUserPointer);
+ (glthread->CurrentDrawIndirectBufferName == 0 ||
+ vao->CurrentElementBufferName == 0 || vao->HasUserPointer);
}
struct _glapi_table *
_mesa_create_marshal_table(const struct gl_context *ctx);
-void
-_mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target, GLuint buffer);
-
static inline unsigned
_mesa_buffer_enum_to_count(GLenum buffer)
{
GLuint id = arrays[i];
struct glthread_vao *vao;
- vao = malloc(sizeof(*vao));
+ vao = calloc(1, sizeof(*vao));
if (!vao)
continue; /* Is that all we can do? */
vao->Name = id;
- vao->HasUserPointer = false;
_mesa_HashInsertLocked(glthread->VAOs, id, vao);
}
}
{
struct glthread_state *glthread = &ctx->GLThread;
- if (!glthread->vertex_array_is_vbo)
+ if (glthread->CurrentArrayBufferName == 0)
glthread->CurrentVAO->HasUserPointer = true;
}