From 0a7020b4e60ef69e0e4b38aee31bfce385e594d8 Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Sat, 17 Nov 2018 07:13:11 +0100 Subject: mesa: Factor out struct gl_vertex_format. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Factor out struct gl_vertex_format from array attributes. The data type is supposed to describe the type of a vertex element. At this current stage the data type is only used with the VAO, but actually is useful in various other places. Due to the bitfields being used, special care needs to be taken for the glGet code paths. v2: Change unsigned char -> GLubyte. Use struct assignment for struct gl_vertex_format. Reviewed-by: Brian Paul Reviewed-by: Marek Olšák Signed-off-by: Mathias Fröhlich --- src/mesa/main/get.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index ac17539f094..ee77c45d03c 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -755,13 +755,22 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_POINT_SIZE); break; - case GL_TEXTURE_COORD_ARRAY_SIZE: case GL_TEXTURE_COORD_ARRAY_TYPE: case GL_TEXTURE_COORD_ARRAY_STRIDE: array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]; v->value_int = *(GLuint *) ((char *) array + d->offset); break; + case GL_TEXTURE_COORD_ARRAY_SIZE: + array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]; + v->value_int = array->Format.Size; + break; + + case GL_VERTEX_ARRAY_SIZE: + array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS]; + v->value_int = array->Format.Size; + break; + case GL_ACTIVE_TEXTURE_ARB: v->value_int = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; break; @@ -969,11 +978,11 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu /* ARB_vertex_array_bgra */ case GL_COLOR_ARRAY_SIZE: array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0]; - v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size; + v->value_int = array->Format.Format == GL_BGRA ? GL_BGRA : array->Format.Size; break; case GL_SECONDARY_COLOR_ARRAY_SIZE: array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1]; - v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size; + v->value_int = array->Format.Format == GL_BGRA ? GL_BGRA : array->Format.Size; break; /* ARB_copy_buffer */ -- cgit v1.2.3