glthread: handle non-VBO uploads for glMultiModeDraw{Arrays,Elements}IBM

This was unimplemented, and this implementation matches exactly what we do
in main/draw.c.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20624>
This commit is contained in:
Marek Olšák 2022-12-26 04:08:21 -05:00
parent 8510814528
commit aabca21c7e
3 changed files with 45 additions and 19 deletions

View file

@ -10974,8 +10974,7 @@
</category>
<category name="GL_IBM_multimode_draw_arrays" number="200">
<function name="MultiModeDrawArraysIBM"
marshal_sync="_mesa_glthread_has_non_vbo_vertices(ctx)">
<function name="MultiModeDrawArraysIBM" marshal="custom">
<param name="mode" type="const GLenum *" count="primcount"/>
<param name="first" type="const GLint *" count="primcount"/>
<param name="count" type="const GLsizei *" count="primcount"/>
@ -10984,8 +10983,7 @@
<glx handcode="true" ignore="true"/>
</function>
<function name="MultiModeDrawElementsIBM"
marshal_sync="_mesa_glthread_has_non_vbo_vertices_or_indices(ctx)">
<function name="MultiModeDrawElementsIBM" marshal="custom">
<param name="mode" type="const GLenum *" count="primcount"/>
<param name="count" type="const GLsizei *" count="primcount"/>
<param name="type" type="GLenum"/>

View file

@ -1202,6 +1202,33 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
buffers);
}
void GLAPIENTRY
_mesa_marshal_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first,
const GLsizei *count, GLsizei primcount,
GLint modestride)
{
for (int i = 0 ; i < primcount; i++) {
if (count[i] > 0) {
GLenum m = *((GLenum *)((GLubyte *)mode + i * modestride));
_mesa_marshal_DrawArrays(m, first[i], count[i]);
}
}
}
void GLAPIENTRY
_mesa_marshal_MultiModeDrawElementsIBM(const GLenum *mode,
const GLsizei *count, GLenum type,
const GLvoid * const *indices,
GLsizei primcount, GLint modestride)
{
for (int i = 0 ; i < primcount; i++) {
if (count[i] > 0) {
GLenum m = *((GLenum *)((GLubyte *)mode + i * modestride));
_mesa_marshal_DrawElements(m, count[i], type, indices[i]);
}
}
}
void GLAPIENTRY
_mesa_marshal_DrawArrays(GLenum mode, GLint first, GLsizei count)
{
@ -1366,6 +1393,22 @@ _mesa_unmarshal_MultiDrawElementsBaseVertex(struct gl_context *ctx,
return 0;
}
uint32_t
_mesa_unmarshal_MultiModeDrawArraysIBM(struct gl_context *ctx,
const struct marshal_cmd_MultiModeDrawArraysIBM *cmd)
{
unreachable("should never end up here");
return 0;
}
uint32_t
_mesa_unmarshal_MultiModeDrawElementsIBM(struct gl_context *ctx,
const struct marshal_cmd_MultiModeDrawElementsIBM *cmd)
{
unreachable("should never end up here");
return 0;
}
void GLAPIENTRY
_mesa_marshal_DrawArraysUserBuf(void)
{

View file

@ -94,21 +94,6 @@ _mesa_glthread_has_no_unpack_buffer(const struct gl_context *ctx)
return ctx->GLThread.CurrentPixelUnpackBufferName == 0;
}
/**
* Instead of conditionally handling marshaling immediate index data in draw
* calls (deprecated and removed in GL core), we just disable threading.
*/
static inline bool
_mesa_glthread_has_non_vbo_vertices_or_indices(const struct gl_context *ctx)
{
const struct glthread_state *glthread = &ctx->GLThread;
struct glthread_vao *vao = glthread->CurrentVAO;
return ctx->API != API_OPENGL_CORE &&
(vao->CurrentElementBufferName == 0 ||
(vao->UserPointerMask & vao->BufferEnabled));
}
static inline bool
_mesa_glthread_has_non_vbo_vertices(const struct gl_context *ctx)
{