From fb95a4693f05b8a64d61267409fcdce937dd3383 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 19 Feb 2020 16:54:45 -0500 Subject: [PATCH] glthread: add GL_DRAW_INDIRECT_BUFFER tracking and generator support Reviewed-by: Timothy Arceri Part-of: --- src/mapi/glapi/gen/marshal_XML.py | 4 +++- src/mesa/main/glthread.h | 1 + src/mesa/main/marshal.c | 3 +++ src/mesa/main/marshal.h | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py index d761e58ce83..5b682c51965 100644 --- a/src/mapi/glapi/gen/marshal_XML.py +++ b/src/mapi/glapi/gen/marshal_XML.py @@ -77,7 +77,9 @@ class marshal_function(gl_XML.gl_function): for p in self.parameters: if p.is_output: return 'sync' - if p.is_pointer() and not (p.count or p.counter) and not (self.marshal == 'draw' and p.name == 'indices'): + if (p.is_pointer() and not (p.count or p.counter) + and not (self.marshal == 'draw' + and (p.name == 'indices' or p.name == 'indirect'))): return 'sync' if p.count_parameter_list: # Parameter size is determined by enums; haven't diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index 021d5213084..5e99602b418 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -94,6 +94,7 @@ struct glthread_state * buffer) binding is in a VBO. */ bool element_array_is_vbo; + bool draw_indirect_buffer_is_vbo; }; void _mesa_glthread_init(struct gl_context *ctx); diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index 28054d236c9..24e419ca337 100644 --- a/src/mesa/main/marshal.c +++ b/src/mesa/main/marshal.c @@ -252,6 +252,9 @@ track_vbo_binding(struct gl_context *ctx, GLenum target, GLuint buffer) */ glthread->element_array_is_vbo = (buffer != 0); break; + case GL_DRAW_INDIRECT_BUFFER: + glthread->draw_indirect_buffer_is_vbo = buffer != 0; + break; } } diff --git a/src/mesa/main/marshal.h b/src/mesa/main/marshal.h index c15253f3973..a172ed30043 100644 --- a/src/mesa/main/marshal.h +++ b/src/mesa/main/marshal.h @@ -98,6 +98,25 @@ _mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx) return ctx->API != API_OPENGL_CORE && !glthread->element_array_is_vbo; } +static inline bool +_mesa_glthread_is_non_vbo_draw_arrays_indirect(const struct gl_context *ctx) +{ + struct glthread_state *glthread = ctx->GLThread; + + return ctx->API != API_OPENGL_CORE && + !glthread->draw_indirect_buffer_is_vbo; +} + +static inline bool +_mesa_glthread_is_non_vbo_draw_elements_indirect(const struct gl_context *ctx) +{ + struct glthread_state *glthread = ctx->GLThread; + + return ctx->API != API_OPENGL_CORE && + (!glthread->draw_indirect_buffer_is_vbo || + !glthread->element_array_is_vbo); +} + #define DEBUG_MARSHAL_PRINT_CALLS 0 /** -- 2.30.2