aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-11-17 07:13:11 +0100
committerMathias Fröhlich <[email protected]>2018-11-21 06:27:19 +0100
commit3c46fa59888cf5c8ca36be849512b2ef0492760d (patch)
tree6c07e3f717876ba6038ccdd501eada1be3483b30
parent093aeb35651f20de70492ded56cc2a0f48174edf (diff)
mesa: Remove gl_array_attributes::Enabled.
Now that all users go via the VAO Enabled bitfield, get rid of the Enabled boolean. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
-rw-r--r--src/mesa/main/arrayobj.c14
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/varray.c11
-rw-r--r--src/mesa/vbo/vbo_save_api.c2
4 files changed, 4 insertions, 24 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 5572ae550f8..4977009f6f5 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -391,7 +391,6 @@ init_array(struct gl_context *ctx,
array->Stride = 0;
array->Ptr = NULL;
array->RelativeOffset = 0;
- array->Enabled = GL_FALSE;
array->Normalized = GL_FALSE;
array->Integer = GL_FALSE;
array->Doubles = GL_FALSE;
@@ -642,9 +641,6 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
attrib2->_EffBufferBindingIndex = bindex;
attrib2->_EffRelativeOffset = attrib2->RelativeOffset;
assert(attrib2->_EffRelativeOffset <= MaxRelativeOffset);
-
- /* Only enabled arrays shall appear in the unique bindings */
- assert(attrib2->Enabled);
}
/* Finally this is the set of effectively bound arrays with the
* original binding offset.
@@ -720,9 +716,6 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
attrib2->_EffRelativeOffset =
binding2->Offset + attrib2->RelativeOffset - min_offset;
assert(attrib2->_EffRelativeOffset <= MaxRelativeOffset);
-
- /* Only enabled arrays shall appear in the unique bindings */
- assert(attrib2->Enabled);
}
/* Finally this is the set of effectively bound arrays */
binding->_EffOffset = min_offset;
@@ -812,9 +805,6 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
attrib2->_EffBufferBindingIndex = bindex;
attrib2->_EffRelativeOffset = attrib2->Ptr - ptr;
assert(attrib2->_EffRelativeOffset <= binding->Stride);
-
- /* Only enabled arrays shall appear in the unique bindings */
- assert(attrib2->Enabled);
}
/* Finally this is the set of effectively bound arrays */
binding->_EffOffset = (GLintptr)ptr;
@@ -883,8 +873,6 @@ _mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao)
const struct gl_vertex_buffer_binding *buffer_binding =
&vao->BufferBinding[attrib_array->BufferBindingIndex];
- /* Only enabled arrays shall appear in the Enabled bitmask */
- assert(attrib_array->Enabled);
/* We have already masked out vao->VertexAttribBufferMask */
assert(!_mesa_is_bufferobj(buffer_binding->BufferObj));
@@ -914,8 +902,6 @@ _mesa_all_buffers_are_unmapped(const struct gl_vertex_array_object *vao)
const struct gl_vertex_buffer_binding *buffer_binding =
&vao->BufferBinding[attrib_array->BufferBindingIndex];
- /* Only enabled arrays shall appear in the Enabled bitmask */
- assert(attrib_array->Enabled);
/* We have already masked with vao->VertexAttribBufferMask */
assert(_mesa_is_bufferobj(buffer_binding->BufferObj));
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9d79957afaa..da6a2616881 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1422,7 +1422,6 @@ struct gl_array_attributes
GLshort Stride; /**< Stride as specified with gl*Pointer() */
GLenum16 Type; /**< Datatype: GL_FLOAT, GL_INT, etc */
GLenum16 Format; /**< Default: GL_RGBA, but may be GL_BGRA */
- GLboolean Enabled; /**< Whether the array is enabled */
GLubyte Size; /**< Components per element (1,2,3,4) */
unsigned Normalized:1; /**< Fixed-point values are normalized when converted to floats */
unsigned Integer:1; /**< Fixed-point values are not converted to floats */
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index e8969eb954a..bcaa4956478 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1078,10 +1078,9 @@ _mesa_enable_vertex_array_attrib(struct gl_context *ctx,
assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
assert(!vao->SharedAndImmutable);
- if (!vao->VertexAttrib[attrib].Enabled) {
+ const GLbitfield array_bit = VERT_BIT(attrib);
+ if ((vao->Enabled & array_bit) == 0) {
/* was disabled, now being enabled */
- vao->VertexAttrib[attrib].Enabled = GL_TRUE;
- const GLbitfield array_bit = VERT_BIT(attrib);
vao->Enabled |= array_bit;
vao->NewArrays |= array_bit;
@@ -1165,10 +1164,9 @@ _mesa_disable_vertex_array_attrib(struct gl_context *ctx,
assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
assert(!vao->SharedAndImmutable);
- if (vao->VertexAttrib[attrib].Enabled) {
+ const GLbitfield array_bit = VERT_BIT(attrib);
+ if (vao->Enabled & array_bit) {
/* was enabled, now being disabled */
- vao->VertexAttrib[attrib].Enabled = GL_FALSE;
- const GLbitfield array_bit = VERT_BIT(attrib);
vao->Enabled &= ~array_bit;
vao->NewArrays |= array_bit;
@@ -2781,7 +2779,6 @@ _mesa_copy_vertex_attrib_array(struct gl_context *ctx,
dst->Doubles = src->Doubles;
dst->Normalized = src->Normalized;
dst->Ptr = src->Ptr;
- dst->Enabled = src->Enabled;
dst->_ElementSize = src->_ElementSize;
dst->_EffBufferBindingIndex = src->_EffBufferBindingIndex;
dst->_EffRelativeOffset = src->_EffRelativeOffset;
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 97796aea53f..a085729389f 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -455,7 +455,6 @@ compare_vao(gl_vertex_processing_mode mode,
if (attrib->Size != size[vbo_attr])
return false;
assert(attrib->Format == GL_RGBA);
- assert(attrib->Enabled == GL_TRUE);
assert(attrib->Normalized == GL_FALSE);
assert(attrib->Integer == vbo_attrtype_to_integer_flag(tp));
assert(attrib->Doubles == vbo_attrtype_to_double_flag(tp));
@@ -517,7 +516,6 @@ update_vao(struct gl_context *ctx,
_mesa_vertex_attrib_binding(ctx, *vao, vao_attr, 0);
_mesa_enable_vertex_array_attrib(ctx, *vao, vao_attr);
}
- assert(vao_enabled == (*vao)->Enabled);
assert((vao_enabled & ~(*vao)->VertexAttribBufferMask) == 0);
/* Finalize and freeze the VAO */