glthread: replace custom glBindBuffer marshalling with generated one
authorMarek Olšák <marek.olsak@amd.com>
Tue, 25 Feb 2020 00:26:12 +0000 (19:26 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 6 Mar 2020 01:06:14 +0000 (01:06 +0000)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>

src/mapi/glapi/gen/gl_API.xml
src/mesa/main/marshal.c
src/mesa/main/marshal.h

index fd21297d7210c5740680402e728c4f76b208a3e8..19b2dea482178abfe488dda7ae7ea84260da2999 100644 (file)
     <type name="intptr"   size="4"                  glx_name="CARD32"/>
     <type name="sizeiptr" size="4"  unsigned="true" glx_name="CARD32"/>
 
     <type name="intptr"   size="4"                  glx_name="CARD32"/>
     <type name="sizeiptr" size="4"  unsigned="true" glx_name="CARD32"/>
 
-    <function name="BindBuffer" es1="1.1" es2="2.0" marshal="custom" no_error="true">
+    <function name="BindBuffer" es1="1.1" es2="2.0" no_error="true"
+              marshal_call_after="_mesa_glthread_BindBuffer(ctx, target, buffer);">
         <param name="target" type="GLenum"/>
         <param name="buffer" type="GLuint"/>
         <glx ignore="true"/>
         <param name="target" type="GLenum"/>
         <param name="buffer" type="GLuint"/>
         <glx ignore="true"/>
index ce91d6a8f66ee0f8323475cccec7dbc77925a600..f8eabf1b53c000609fdd2c3ea70e1e5f91e44a90 100644 (file)
@@ -136,15 +136,6 @@ _mesa_marshal_ShaderSource(GLuint shader, GLsizei count,
 }
 
 
 }
 
 
-/* BindBufferBase: marshalled asynchronously */
-struct marshal_cmd_BindBufferBase
-{
-   struct marshal_cmd_base cmd_base;
-   GLenum target;
-   GLuint index;
-   GLuint buffer;
-};
-
 /** Tracks the current bindings for the vertex array and index array buffers.
  *
  * This is part of what we need to enable glthread on compat-GL contexts that
 /** Tracks the current bindings for the vertex array and index array buffers.
  *
  * This is part of what we need to enable glthread on compat-GL contexts that
@@ -168,8 +159,8 @@ struct marshal_cmd_BindBufferBase
  * feature that if you pass a bad name, it just gens a buffer object for you,
  * so we escape without having to know if things are valid or not.
  */
  * feature that if you pass a bad name, it just gens a buffer object for you,
  * so we escape without having to know if things are valid or not.
  */
-static void
-track_vbo_binding(struct gl_context *ctx, GLenum target, GLuint buffer)
+void
+_mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target, GLuint buffer)
 {
    struct glthread_state *glthread = ctx->GLThread;
 
 {
    struct glthread_state *glthread = ctx->GLThread;
 
@@ -191,47 +182,6 @@ track_vbo_binding(struct gl_context *ctx, GLenum target, GLuint buffer)
 }
 
 
 }
 
 
-struct marshal_cmd_BindBuffer
-{
-   struct marshal_cmd_base cmd_base;
-   GLenum target;
-   GLuint buffer;
-};
-
-/**
- * This is just like the code-generated glBindBuffer() support, except that we
- * call track_vbo_binding().
- */
-void
-_mesa_unmarshal_BindBuffer(struct gl_context *ctx,
-                           const struct marshal_cmd_BindBuffer *cmd)
-{
-   const GLenum target = cmd->target;
-   const GLuint buffer = cmd->buffer;
-   CALL_BindBuffer(ctx->CurrentServerDispatch, (target, buffer));
-}
-void GLAPIENTRY
-_mesa_marshal_BindBuffer(GLenum target, GLuint buffer)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   size_t cmd_size = sizeof(struct marshal_cmd_BindBuffer);
-   struct marshal_cmd_BindBuffer *cmd;
-   debug_print_marshal("BindBuffer");
-
-   track_vbo_binding(ctx, target, buffer);
-
-   if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {
-      cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindBuffer,
-                                            cmd_size);
-      cmd->target = target;
-      cmd->buffer = buffer;
-      _mesa_post_marshal_hook(ctx);
-   } else {
-      _mesa_glthread_finish(ctx);
-      CALL_BindBuffer(ctx->CurrentServerDispatch, (target, buffer));
-   }
-}
-
 /* BufferData: marshalled asynchronously */
 struct marshal_cmd_BufferData
 {
 /* BufferData: marshalled asynchronously */
 struct marshal_cmd_BufferData
 {
index c53c060f593fa9169bc9005d057b64071f5e94bb..b75613b9a3e08d8a3ff5f5a433a460da54df6983 100644 (file)
@@ -151,7 +151,6 @@ struct _glapi_table *
 _mesa_create_marshal_table(const struct gl_context *ctx);
 
 struct marshal_cmd_ShaderSource;
 _mesa_create_marshal_table(const struct gl_context *ctx);
 
 struct marshal_cmd_ShaderSource;
-struct marshal_cmd_BindBuffer;
 struct marshal_cmd_BufferData;
 struct marshal_cmd_BufferSubData;
 struct marshal_cmd_NamedBufferData;
 struct marshal_cmd_BufferData;
 struct marshal_cmd_BufferSubData;
 struct marshal_cmd_NamedBufferData;
@@ -165,12 +164,8 @@ void
 _mesa_unmarshal_ShaderSource(struct gl_context *ctx,
                              const struct marshal_cmd_ShaderSource *cmd);
 
 _mesa_unmarshal_ShaderSource(struct gl_context *ctx,
                              const struct marshal_cmd_ShaderSource *cmd);
 
-void GLAPIENTRY
-_mesa_marshal_BindBuffer(GLenum target, GLuint buffer);
-
 void
 void
-_mesa_unmarshal_BindBuffer(struct gl_context *ctx,
-                           const struct marshal_cmd_BindBuffer *cmd);
+_mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target, GLuint buffer);
 
 void
 _mesa_unmarshal_BufferData(struct gl_context *ctx,
 
 void
 _mesa_unmarshal_BufferData(struct gl_context *ctx,