mesa: change gl_vertex_format::Format to bool Bgra to free bits

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20287>
This commit is contained in:
Marek Olšák 2022-12-12 00:28:16 -05:00
parent 124d2762db
commit 13160c0d14
4 changed files with 8 additions and 8 deletions

View file

@ -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 */

View file

@ -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 */
};

View file

@ -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:

View file

@ -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));