Mesa (master): glthread: fix interpreting vertex size == GL_BGRA for vertex attribs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 29 02:45:59 UTC 2021


Module: Mesa
Branch: master
Commit: 76c322a48defa384731734a130699df9e8c064f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=76c322a48defa384731734a130699df9e8c064f9

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed Jan 27 18:40:16 2021 -0500

glthread: fix interpreting vertex size == GL_BGRA for vertex attribs

Fixes: c9c9f57b022 - glthread: track pointers and strides for Pointer & EXT_dsa attrib functions
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4116

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Reviewed-by: Zoltán Böszörményi <zboszor at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8753>

---

 src/mesa/main/glthread_varray.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/glthread_varray.c b/src/mesa/main/glthread_varray.c
index 4250cf0744d..f4f2bde2158 100644
--- a/src/mesa/main/glthread_varray.c
+++ b/src/mesa/main/glthread_varray.c
@@ -332,6 +332,15 @@ void _mesa_glthread_AttribDivisor(struct gl_context *ctx, const GLuint *vaobj,
       vao->NonZeroDivisorMask &= ~(1u << attrib);
 }
 
+static unsigned
+element_size(GLint size, GLenum type)
+{
+   if (size == GL_BGRA)
+      size = 4;
+
+   return _mesa_bytes_per_vertex_attrib(size, type);
+}
+
 static void
 attrib_pointer(struct glthread_state *glthread, struct glthread_vao *vao,
                GLuint buffer, gl_vert_attrib attrib,
@@ -341,7 +350,7 @@ attrib_pointer(struct glthread_state *glthread, struct glthread_vao *vao,
    if (attrib >= VERT_ATTRIB_MAX)
       return;
 
-   unsigned elem_size = _mesa_bytes_per_vertex_attrib(size, type);
+   unsigned elem_size = element_size(size, type);
 
    vao->Attrib[attrib].ElementSize = elem_size;
    vao->Attrib[attrib].Stride = stride ? stride : elem_size;
@@ -393,7 +402,7 @@ attrib_format(struct glthread_state *glthread, struct glthread_vao *vao,
    if (attribindex >= VERT_ATTRIB_GENERIC_MAX)
       return;
 
-   unsigned elem_size = _mesa_bytes_per_vertex_attrib(size, type);
+   unsigned elem_size = element_size(size, type);
 
    unsigned i = VERT_ATTRIB_GENERIC(attribindex);
    vao->Attrib[i].ElementSize = elem_size;



More information about the mesa-commit mailing list