summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.h
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-02-04 17:13:06 +0100
committerMathias Fröhlich <[email protected]>2018-02-09 04:26:23 +0100
commit77cb2fc0bd8f57b646ef5ab674c1f76d873a22ae (patch)
treeba370ba824495a6b1a218c428c850ea0825b7b64 /src/mesa/main/varray.h
parent437cae411e7664e01d9c1c280317274b3ffc0734 (diff)
mesa: Only update enabled VAO gl_vertex_array entries.
Instead of updating all modified gl_vertex_array_object::_VertexArray entries just update those that are modified and enabled. Also release buffer object from the _VertexArray that belong to disabled attributes. v2: Also set Ptr and Size to zero. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/varray.h')
-rw-r--r--src/mesa/main/varray.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index ddabd0bc585..46f83b22008 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -58,17 +58,24 @@ _mesa_update_vertex_array(struct gl_context *ctx,
const struct gl_array_attributes *attribs,
const struct gl_vertex_buffer_binding *binding)
{
- dst->Size = attribs->Size;
- dst->Type = attribs->Type;
- dst->Format = attribs->Format;
- dst->StrideB = binding->Stride;
- dst->Ptr = _mesa_vertex_attrib_address(attribs, binding);
- dst->Normalized = attribs->Normalized;
- dst->Integer = attribs->Integer;
- dst->Doubles = attribs->Doubles;
- dst->InstanceDivisor = binding->InstanceDivisor;
- dst->_ElementSize = attribs->_ElementSize;
- _mesa_reference_buffer_object(ctx, &dst->BufferObj, binding->BufferObj);
+ if (attribs->Enabled) {
+ dst->Size = attribs->Size;
+ dst->Type = attribs->Type;
+ dst->Format = attribs->Format;
+ dst->StrideB = binding->Stride;
+ dst->Ptr = _mesa_vertex_attrib_address(attribs, binding);
+ dst->Normalized = attribs->Normalized;
+ dst->Integer = attribs->Integer;
+ dst->Doubles = attribs->Doubles;
+ dst->InstanceDivisor = binding->InstanceDivisor;
+ dst->_ElementSize = attribs->_ElementSize;
+ _mesa_reference_buffer_object(ctx, &dst->BufferObj, binding->BufferObj);
+ } else {
+ /* Disabled arrays shall not be consumed */
+ dst->Size = 0;
+ dst->Ptr = NULL;
+ _mesa_reference_buffer_object(ctx, &dst->BufferObj, NULL);
+ }
}