From 1f42838992a963db61d8a37271f9cbffbc241e23 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Fri, 23 Apr 2021 09:09:25 +0100 Subject: [PATCH] Fix incorrect glColorPointer stride --- GL/draw.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/GL/draw.c b/GL/draw.c index 703a926..6d204d2 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -702,8 +702,12 @@ static void _readNormalData(ReadNormalFunc func, const GLuint first, const GLuin } } +GL_FORCE_INLINE GLuint diffusePointerSize() { + return (DIFFUSE_POINTER.size == GL_BGRA) ? 4 : DIFFUSE_POINTER.size; +} + static void _readDiffuseData(ReadDiffuseFunc func, const GLuint first, const GLuint count, const Vertex* output) { - const GLuint size = (DIFFUSE_POINTER.size == GL_BGRA) ? 4 : DIFFUSE_POINTER.size; + const GLuint size = diffusePointerSize(); const GLuint cstride = (DIFFUSE_POINTER.stride) ? DIFFUSE_POINTER.stride : size * byte_size(DIFFUSE_POINTER.type); const GLubyte* cptr = ((GLubyte*) DIFFUSE_POINTER.ptr) + (first * cstride); @@ -751,7 +755,7 @@ static void generateElements( ST_POINTER.stride : ST_POINTER.size * byte_size(ST_POINTER.type); const GLuint dstride = (DIFFUSE_POINTER.stride) ? - DIFFUSE_POINTER.stride : DIFFUSE_POINTER.size * byte_size(DIFFUSE_POINTER.type); + DIFFUSE_POINTER.stride : diffusePointerSize() * byte_size(DIFFUSE_POINTER.type); const GLuint nstride = (NORMAL_POINTER.stride) ? NORMAL_POINTER.stride : NORMAL_POINTER.size * byte_size(NORMAL_POINTER.type); @@ -805,7 +809,7 @@ static void generateElementsFastPath( ST_POINTER.stride : ST_POINTER.size * byte_size(ST_POINTER.type); const GLuint dstride = (DIFFUSE_POINTER.stride) ? - DIFFUSE_POINTER.stride : DIFFUSE_POINTER.size * byte_size(DIFFUSE_POINTER.type); + DIFFUSE_POINTER.stride : diffusePointerSize() * byte_size(DIFFUSE_POINTER.type); const GLuint nstride = (NORMAL_POINTER.stride) ? NORMAL_POINTER.stride : NORMAL_POINTER.size * byte_size(NORMAL_POINTER.type); @@ -883,7 +887,7 @@ static void generateArraysFastPath(SubmissionTarget* target, const GLsizei first ST_POINTER.stride : ST_POINTER.size * byte_size(ST_POINTER.type); const GLuint dstride = (DIFFUSE_POINTER.stride) ? - DIFFUSE_POINTER.stride : DIFFUSE_POINTER.size * byte_size(DIFFUSE_POINTER.type); + DIFFUSE_POINTER.stride : diffusePointerSize() * byte_size(DIFFUSE_POINTER.type); const GLuint nstride = (NORMAL_POINTER.stride) ? NORMAL_POINTER.stride : NORMAL_POINTER.size * byte_size(NORMAL_POINTER.type);