glthread: pass struct marshal_cmd_DrawElementsUserBuf into Draw directly
Pass the whole structure directly instead of as separate parameters. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26548>
This commit is contained in:
parent
98e42c6efb
commit
3a74cdcd91
4 changed files with 37 additions and 49 deletions
|
|
@ -12936,14 +12936,7 @@
|
|||
</function>
|
||||
|
||||
<function name="DrawElementsUserBuf" es1="1.0" es2="2.0" marshal="custom">
|
||||
<param name="indexBuf" type="GLintptr"/> <!-- "struct gl_buffer_object *" really -->
|
||||
<param name="mode" type="GLenum"/>
|
||||
<param name="count" type="GLsizei"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="indices" type="const GLvoid *"/>
|
||||
<param name="instancecount" type="GLsizei"/>
|
||||
<param name="basevertex" type="GLint"/>
|
||||
<param name="baseinstance" type="GLuint"/>
|
||||
<param name="cmd" type="const GLvoid *"/> <!-- struct marshal_cmd_DrawElementsUserBuf -->
|
||||
</function>
|
||||
|
||||
<function name="MultiDrawArraysUserBuf" es1="1.0" es2="2.0" marshal="custom">
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "transformfeedback.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "api_exec_decl.h"
|
||||
#include "glthread_marshal.h"
|
||||
|
||||
#include "state_tracker/st_context.h"
|
||||
#include "state_tracker/st_draw.h"
|
||||
|
|
@ -1983,10 +1984,7 @@ _mesa_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
|
|||
* GL_ELEMENT_ARRAY_BUFFER if indexBuf != NULL.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_DrawElementsUserBuf(GLintptr indexBuf, GLenum mode,
|
||||
GLsizei count, GLenum type,
|
||||
const GLvoid *indices, GLsizei numInstances,
|
||||
GLint basevertex, GLuint baseInstance)
|
||||
_mesa_DrawElementsUserBuf(const GLvoid *ptr)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
|
@ -1996,19 +1994,31 @@ _mesa_DrawElementsUserBuf(GLintptr indexBuf, GLenum mode,
|
|||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
const struct marshal_cmd_DrawElementsUserBuf *cmd =
|
||||
(const struct marshal_cmd_DrawElementsUserBuf *)ptr;
|
||||
const GLenum mode = cmd->mode;
|
||||
const GLsizei count = cmd->count;
|
||||
const GLenum type = cmd->type;
|
||||
const GLsizei instance_count = cmd->instance_count;
|
||||
|
||||
if (!_mesa_is_no_error_enabled(ctx) &&
|
||||
!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
|
||||
numInstances))
|
||||
instance_count))
|
||||
return;
|
||||
|
||||
struct gl_buffer_object *index_bo =
|
||||
indexBuf ? (struct gl_buffer_object*)indexBuf :
|
||||
ctx->Array.VAO->IndexBufferObj;
|
||||
cmd->index_buffer ? cmd->index_buffer : ctx->Array.VAO->IndexBufferObj;
|
||||
|
||||
const GLvoid *indices = cmd->indices;
|
||||
const GLint basevertex = cmd->basevertex;
|
||||
const GLuint baseinstance = cmd->baseinstance;
|
||||
|
||||
ctx->DrawID = cmd->drawid;
|
||||
_mesa_validated_drawrangeelements(ctx, index_bo,
|
||||
mode, false, 0, ~0,
|
||||
count, type, indices, basevertex,
|
||||
numInstances, baseInstance);
|
||||
instance_count, baseinstance);
|
||||
ctx->DrawID = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -707,21 +707,6 @@ _mesa_unmarshal_DrawElementsInstancedBaseVertexBaseInstanceDrawID(struct gl_cont
|
|||
return cmd_size;
|
||||
}
|
||||
|
||||
struct marshal_cmd_DrawElementsUserBuf
|
||||
{
|
||||
struct marshal_cmd_base cmd_base;
|
||||
GLenum16 mode;
|
||||
GLenum16 type;
|
||||
GLsizei count;
|
||||
GLsizei instance_count;
|
||||
GLint basevertex;
|
||||
GLuint baseinstance;
|
||||
GLuint drawid;
|
||||
GLuint user_buffer_mask;
|
||||
const GLvoid *indices;
|
||||
struct gl_buffer_object *index_buffer;
|
||||
};
|
||||
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawElementsUserBuf(struct gl_context *ctx,
|
||||
const struct marshal_cmd_DrawElementsUserBuf *restrict cmd)
|
||||
|
|
@ -735,21 +720,9 @@ _mesa_unmarshal_DrawElementsUserBuf(struct gl_context *ctx,
|
|||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask);
|
||||
|
||||
/* Draw. */
|
||||
const GLenum mode = cmd->mode;
|
||||
const GLsizei count = cmd->count;
|
||||
const GLenum type = cmd->type;
|
||||
const GLvoid *indices = cmd->indices;
|
||||
const GLsizei instance_count = cmd->instance_count;
|
||||
const GLint basevertex = cmd->basevertex;
|
||||
const GLuint baseinstance = cmd->baseinstance;
|
||||
struct gl_buffer_object *index_buffer = cmd->index_buffer;
|
||||
CALL_DrawElementsUserBuf(ctx->Dispatch.Current, (cmd));
|
||||
|
||||
ctx->DrawID = cmd->drawid;
|
||||
CALL_DrawElementsUserBuf(ctx->Dispatch.Current,
|
||||
((GLintptr)index_buffer, mode, count, type,
|
||||
indices, instance_count, basevertex,
|
||||
baseinstance));
|
||||
ctx->DrawID = 0;
|
||||
struct gl_buffer_object *index_buffer = cmd->index_buffer;
|
||||
_mesa_reference_buffer_object(ctx, &index_buffer, NULL);
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
|
@ -1803,10 +1776,7 @@ _mesa_marshal_DrawArraysUserBuf(void)
|
|||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_marshal_DrawElementsUserBuf(GLintptr indexBuf, GLenum mode,
|
||||
GLsizei count, GLenum type,
|
||||
const GLvoid *indices, GLsizei numInstances,
|
||||
GLint basevertex, GLuint baseInstance)
|
||||
_mesa_marshal_DrawElementsUserBuf(const GLvoid *cmd)
|
||||
{
|
||||
unreachable("should never end up here");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,21 @@ typedef uint32_t (*_mesa_unmarshal_func)(struct gl_context *ctx,
|
|||
const void *restrict cmd);
|
||||
extern const _mesa_unmarshal_func _mesa_unmarshal_dispatch[NUM_DISPATCH_CMD];
|
||||
|
||||
struct marshal_cmd_DrawElementsUserBuf
|
||||
{
|
||||
struct marshal_cmd_base cmd_base;
|
||||
GLenum16 mode;
|
||||
GLenum16 type;
|
||||
GLsizei count;
|
||||
GLsizei instance_count;
|
||||
GLint basevertex;
|
||||
GLuint baseinstance;
|
||||
GLuint drawid;
|
||||
GLuint user_buffer_mask;
|
||||
const GLvoid *indices;
|
||||
struct gl_buffer_object *index_buffer;
|
||||
};
|
||||
|
||||
static inline void *
|
||||
_mesa_glthread_allocate_command(struct gl_context *ctx,
|
||||
uint16_t cmd_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue