glthread: initialize VAOs properly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4314>
This commit is contained in:
parent
47cf310a67
commit
09f94632e0
|
@ -89,6 +89,8 @@ _mesa_glthread_init(struct gl_context *ctx)
|
||||||
util_queue_destroy(&glthread->queue);
|
util_queue_destroy(&glthread->queue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mesa_glthread_reset_vao(&glthread->DefaultVAO);
|
||||||
glthread->CurrentVAO = &glthread->DefaultVAO;
|
glthread->CurrentVAO = &glthread->DefaultVAO;
|
||||||
|
|
||||||
ctx->MarshalExec = _mesa_create_marshal_table(ctx);
|
ctx->MarshalExec = _mesa_create_marshal_table(ctx);
|
||||||
|
|
|
@ -161,6 +161,7 @@ void _mesa_glthread_upload(struct gl_context *ctx, const void *data,
|
||||||
GLsizeiptr size, unsigned *out_offset,
|
GLsizeiptr size, unsigned *out_offset,
|
||||||
struct gl_buffer_object **out_buffer,
|
struct gl_buffer_object **out_buffer,
|
||||||
uint8_t **out_ptr);
|
uint8_t **out_ptr);
|
||||||
|
void _mesa_glthread_reset_vao(struct glthread_vao *vao);
|
||||||
|
|
||||||
void _mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target,
|
void _mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target,
|
||||||
GLuint buffer);
|
GLuint buffer);
|
||||||
|
|
|
@ -37,6 +37,35 @@
|
||||||
* - Handle ARB_vertex_attrib_binding (incl. EXT_dsa and ARB_dsa)
|
* - Handle ARB_vertex_attrib_binding (incl. EXT_dsa and ARB_dsa)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
_mesa_glthread_reset_vao(struct glthread_vao *vao)
|
||||||
|
{
|
||||||
|
static unsigned default_elem_size[VERT_ATTRIB_MAX] = {
|
||||||
|
[VERT_ATTRIB_NORMAL] = 12,
|
||||||
|
[VERT_ATTRIB_COLOR1] = 12,
|
||||||
|
[VERT_ATTRIB_FOG] = 4,
|
||||||
|
[VERT_ATTRIB_COLOR_INDEX] = 4,
|
||||||
|
[VERT_ATTRIB_EDGEFLAG] = 1,
|
||||||
|
[VERT_ATTRIB_POINT_SIZE] = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
vao->CurrentElementBufferName = 0;
|
||||||
|
vao->Enabled = 0;
|
||||||
|
vao->UserPointerMask = 0;
|
||||||
|
vao->NonZeroDivisorMask = 0;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < ARRAY_SIZE(vao->Attrib); i++) {
|
||||||
|
unsigned elem_size = default_elem_size[i];
|
||||||
|
if (!elem_size)
|
||||||
|
elem_size = 16;
|
||||||
|
|
||||||
|
vao->Attrib[i].ElementSize = elem_size;
|
||||||
|
vao->Attrib[i].Stride = elem_size;
|
||||||
|
vao->Attrib[i].Divisor = 0;
|
||||||
|
vao->Attrib[i].Pointer = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct glthread_vao *
|
static struct glthread_vao *
|
||||||
lookup_vao(struct gl_context *ctx, GLuint id)
|
lookup_vao(struct gl_context *ctx, GLuint id)
|
||||||
{
|
{
|
||||||
|
@ -127,6 +156,7 @@ _mesa_glthread_GenVertexArrays(struct gl_context *ctx,
|
||||||
continue; /* Is that all we can do? */
|
continue; /* Is that all we can do? */
|
||||||
|
|
||||||
vao->Name = id;
|
vao->Name = id;
|
||||||
|
_mesa_glthread_reset_vao(vao);
|
||||||
_mesa_HashInsertLocked(glthread->VAOs, id, vao);
|
_mesa_HashInsertLocked(glthread->VAOs, id, vao);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue