From 13160c0d14f0bfed8869762f776630e21b95db76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 12 Dec 2022 00:28:16 -0500 Subject: [PATCH] mesa: change gl_vertex_format::Format to bool Bgra to free bits Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/mesa/main/get.c | 4 ++-- src/mesa/main/mtypes.h | 6 +++--- src/mesa/main/varray.c | 4 ++-- src/mesa/vbo/vbo_save_api.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 20b1cc03b24..1102f554f0a 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1053,11 +1053,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.Format == GL_BGRA ? GL_BGRA : array->Format.Size; + v->value_int = array->Format.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.Format == GL_BGRA ? GL_BGRA : array->Format.Size; + v->value_int = array->Format.Bgra ? GL_BGRA : array->Format.Size; break; /* ARB_copy_buffer */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bf39a0826d5..a1fc78ace73 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -326,13 +326,13 @@ struct gl_colorbuffer_attrib struct gl_vertex_format { GLenum16 Type; /**< datatype: GL_FLOAT, GL_INT, etc */ - GLenum16 Format; /**< default: GL_RGBA, but may be GL_BGRA */ - enum pipe_format _PipeFormat:16; /**< pipe_format for Gallium */ + bool Bgra; /**< true if GL_BGRA, else GL_RGBA */ GLubyte Size:5; /**< components per element (1,2,3,4) */ GLubyte Normalized:1; /**< GL_ARB_vertex_program */ GLubyte Integer:1; /**< Integer-valued? */ GLubyte Doubles:1; /**< double values are not converted to floats */ - GLubyte _ElementSize; /**< Size of each element in bytes */ + enum pipe_format _PipeFormat:16; /**< pipe_format for Gallium */ + GLushort _ElementSize; /**< Size of each element in bytes */ }; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 5990b9a965a..f0933a67664 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -652,7 +652,7 @@ _mesa_set_vertex_format(struct gl_vertex_format *vertex_format, { assert(size <= 4); vertex_format->Type = type; - vertex_format->Format = format; + vertex_format->Bgra = format == GL_BGRA; vertex_format->Size = size; vertex_format->Normalized = normalized; vertex_format->Integer = integer; @@ -2300,7 +2300,7 @@ get_vertex_array_attrib(struct gl_context *ctx, case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: return !!(vao->Enabled & VERT_BIT_GENERIC(index)); case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: - return (array->Format.Format == GL_BGRA) ? GL_BGRA : array->Format.Size; + return array->Format.Bgra ? GL_BGRA : array->Format.Size; case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: return array->Stride; case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 5f92a4d16ff..5947b05b1bd 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -322,7 +322,7 @@ compare_vao(gl_vertex_processing_mode mode, return false; if (attrib->Format.Size != size[vbo_attr]) return false; - assert(attrib->Format.Format == GL_RGBA); + assert(!attrib->Format.Bgra); assert(attrib->Format.Normalized == GL_FALSE); assert(attrib->Format.Integer == vbo_attrtype_to_integer_flag(tp)); assert(attrib->Format.Doubles == vbo_attrtype_to_double_flag(tp));