<enum name="VERTEX_ATTRIB_ARRAY_DIVISOR_ARB" value="0x88FE"/>
- <function name="VertexAttribDivisorARB" alias="VertexAttribDivisor">
+ <function name="VertexAttribDivisorARB" alias="VertexAttribDivisor"
+ marshal_call_after="if (COMPAT) _mesa_glthread_AttribDivisor(ctx, NULL, VERT_ATTRIB_GENERIC(index), divisor);">
<param name="index" type="GLuint"/>
<param name="divisor" type="GLuint"/>
</function>
- <function name="VertexArrayVertexAttribDivisorEXT">
+ <function name="VertexArrayVertexAttribDivisorEXT"
+ marshal_call_after="if (COMPAT) _mesa_glthread_AttribDivisor(ctx, &vaobj, VERT_ATTRIB_GENERIC(index), divisor);">
<param name="vaobj" type="GLuint"/>
<param name="index" type="GLuint"/>
<param name="divisor" type="GLuint"/>
GLuint CurrentElementBufferName;
GLbitfield Enabled;
GLbitfield UserPointerMask;
+ GLbitfield NonZeroDivisorMask;
struct {
GLuint ElementSize;
GLsizei Stride;
+ GLuint Divisor;
const void *Pointer;
} Attrib[VERT_ATTRIB_MAX];
};
GLsizei n, GLuint *arrays);
void _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj,
gl_vert_attrib attrib, bool enable);
+void _mesa_glthread_AttribDivisor(struct gl_context *ctx, const GLuint *vaobj,
+ gl_vert_attrib attrib, GLuint divisor);
void _mesa_glthread_AttribPointer(struct gl_context *ctx, gl_vert_attrib attrib,
GLint size, GLenum type, GLsizei stride,
const void *pointer);
#include "main/dispatch.h"
/* TODO:
- * - Handle GL_ARB_instanced_arrays (incl. EXT_dsa)
* - Handle ARB_vertex_attrib_binding (incl. EXT_dsa and ARB_dsa)
*/
}
}
+/* If vaobj is NULL, use the currently-bound VAO. */
+static inline struct glthread_vao *
+get_vao(struct gl_context *ctx, const GLuint *vaobj)
+{
+ if (vaobj)
+ return lookup_vao(ctx, *vaobj);
+
+ return ctx->GLThread.CurrentVAO;
+}
+
void
_mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj,
gl_vert_attrib attrib, bool enable)
{
- struct glthread_state *glthread = &ctx->GLThread;
- struct glthread_vao *vao;
-
if (attrib >= VERT_ATTRIB_MAX)
return;
- if (vaobj) {
- vao = lookup_vao(ctx, *vaobj);
- if (!vao)
- return;
- } else {
- vao = glthread->CurrentVAO;
- }
+ struct glthread_vao *vao = get_vao(ctx, vaobj);
+ if (!vao)
+ return;
if (enable)
vao->Enabled |= 1u << attrib;
vao->Enabled &= ~(1u << attrib);
}
+void _mesa_glthread_AttribDivisor(struct gl_context *ctx, const GLuint *vaobj,
+ gl_vert_attrib attrib, GLuint divisor)
+{
+ if (attrib >= VERT_ATTRIB_MAX)
+ return;
+
+ struct glthread_vao *vao = get_vao(ctx, vaobj);
+ if (!vao)
+ return;
+
+ vao->Attrib[attrib].Divisor = divisor;
+
+ if (divisor)
+ vao->NonZeroDivisorMask |= 1u << attrib;
+ else
+ vao->NonZeroDivisorMask &= ~(1u << attrib);
+}
+
static void
attrib_pointer(struct glthread_state *glthread, struct glthread_vao *vao,
GLuint buffer, gl_vert_attrib attrib,