From 57bf51a97357b0cce293659123a3353d1b726487 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 23 Mar 2020 23:35:58 -0400 Subject: [PATCH] glthread: handle POS vs GENERIC0 aliasing Part-of: --- src/mesa/main/glthread.h | 3 ++- src/mesa/main/glthread_varray.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index f979e5931d4..35b5f1981be 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -65,7 +65,8 @@ struct glthread_attrib_binding { struct glthread_vao { GLuint Name; GLuint CurrentElementBufferName; - GLbitfield Enabled; + GLbitfield UserEnabled; /**< Vertex attrib arrays enabled by the user. */ + GLbitfield Enabled; /**< UserEnabled with POS vs GENERIC0 aliasing resolved. */ GLbitfield UserPointerMask; GLbitfield NonZeroDivisorMask; diff --git a/src/mesa/main/glthread_varray.c b/src/mesa/main/glthread_varray.c index ac83c7a93cd..ff333af0079 100644 --- a/src/mesa/main/glthread_varray.c +++ b/src/mesa/main/glthread_varray.c @@ -50,6 +50,7 @@ _mesa_glthread_reset_vao(struct glthread_vao *vao) }; vao->CurrentElementBufferName = 0; + vao->UserEnabled = 0; vao->Enabled = 0; vao->UserPointerMask = 0; vao->NonZeroDivisorMask = 0; @@ -230,9 +231,14 @@ _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj, return; if (enable) - vao->Enabled |= 1u << attrib; + vao->UserEnabled |= 1u << attrib; else - vao->Enabled &= ~(1u << attrib); + vao->UserEnabled &= ~(1u << attrib); + + /* The generic0 attribute superseeds the position attribute */ + vao->Enabled = vao->UserEnabled; + if (vao->Enabled & VERT_BIT_GENERIC0) + vao->Enabled &= ~VERT_BIT_POS; } void _mesa_glthread_AttribDivisor(struct gl_context *ctx, const GLuint *vaobj, -- 2.30.2