diff options
author | Marek Olšák <marek.olsak@amd.com> | 2022-11-22 04:25:42 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-12-12 19:15:34 +0000 |
commit | b57d56d754242694467c715f1bfb23fc278d1199 (patch) | |
tree | 41ab4149cf20d5a3d4a83f746542bdf15fdf3071 /src | |
parent | 0fbd82bdc45c48aa8cbc08d8bbf1319e66217d45 (diff) |
mesa: remove VAO::NewVertexBuffers/Elements, set the dirty flags directly
These intermediate dirty flags are unnecessary now.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19953>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/arrayobj.c | 4 | ||||
-rw-r--r-- | src/mesa/main/arrayobj.h | 4 | ||||
-rw-r--r-- | src/mesa/main/attrib.c | 2 | ||||
-rw-r--r-- | src/mesa/main/draw.c | 7 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 30 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_rasterpos.c | 8 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_private.h | 5 |
8 files changed, 25 insertions, 39 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 966d26ba247..d937375e349 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -519,7 +519,7 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx, { assert(!vao->IsDynamic); /* Make sure we do not run into problems with shared objects */ - assert(!vao->SharedAndImmutable || (!vao->NewVertexBuffers && !vao->NewVertexElements)); + assert(!vao->SharedAndImmutable); /* Limit used for common binding scanning below. */ const GLsizeiptr MaxRelativeOffset = @@ -801,8 +801,6 @@ _mesa_set_vao_immutable(struct gl_context *ctx, struct gl_vertex_array_object *vao) { _mesa_update_vao_derived_arrays(ctx, vao); - vao->NewVertexBuffers = false; - vao->NewVertexElements = false; vao->SharedAndImmutable = true; } diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index 8d29bf3eff7..58feea588d4 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -186,8 +186,6 @@ _mesa_get_derived_vao_masks(const struct gl_context *ctx, const GLbitfield enabled_nonuser = enabled & vao->VertexAttribBufferMask; const GLbitfield enabled_nonzero_divisor = enabled & vao->NonZeroDivisorMask; - assert(!vao->NewVertexBuffers && !vao->NewVertexElements); - *enabled_user_attribs = ~enabled_nonuser & ctx->Array._DrawVAOEnabledAttribs; *nonzero_divisor_attribs = enabled_nonzero_divisor & @@ -237,7 +235,6 @@ static inline const struct gl_vertex_buffer_binding* _mesa_draw_buffer_binding_from_attrib(const struct gl_vertex_array_object *vao, const struct gl_array_attributes *attrib) { - assert(!vao->NewVertexBuffers && !vao->NewVertexElements); return &vao->BufferBinding[attrib->_EffBufferBindingIndex]; } @@ -249,7 +246,6 @@ static inline const struct gl_array_attributes* _mesa_draw_array_attrib(const struct gl_vertex_array_object *vao, gl_vert_attrib attr) { - assert(!vao->NewVertexBuffers && !vao->NewVertexElements); const gl_attribute_map_mode map_mode = vao->_AttributeMapMode; return &vao->VertexAttrib[_mesa_vao_attribute_map[map_mode][attr]]; } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 30f02998321..f2eaddf09a4 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1209,8 +1209,6 @@ copy_array_object(struct gl_context *ctx, dest->VertexAttribBufferMask = src->VertexAttribBufferMask; dest->NonZeroDivisorMask = src->NonZeroDivisorMask; dest->_AttributeMapMode = src->_AttributeMapMode; - dest->NewVertexBuffers = src->NewVertexBuffers; - dest->NewVertexElements = src->NewVertexElements; /* skip NumUpdates and IsDynamic because they can only increase, not decrease */ } diff --git a/src/mesa/main/draw.c b/src/mesa/main/draw.c index 76e5b50c190..35b1738f97d 100644 --- a/src/mesa/main/draw.c +++ b/src/mesa/main/draw.c @@ -153,13 +153,6 @@ _mesa_update_vao_state(struct gl_context *ctx, GLbitfield filter) struct gl_vertex_array_object *vao = ctx->Array._DrawVAO; bool new_vertex_buffers = false, new_vertex_elements = false; - if (vao->NewVertexBuffers || vao->NewVertexElements) { - new_vertex_buffers |= vao->NewVertexBuffers; - new_vertex_elements |= vao->NewVertexElements; - vao->NewVertexBuffers = false; - vao->NewVertexElements = false; - } - assert(vao->_EnabledWithMapMode == _mesa_vao_enable_to_vp_inputs(vao->_AttributeMapMode, vao->Enabled)); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d341a47370d..ac73ccf66bb 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1686,10 +1686,6 @@ struct gl_vertex_array_object /** "Enabled" with the position/generic0 attribute aliasing resolved */ GLbitfield _EnabledWithMapMode; - /** Which states have been changed according to the gallium definitions. */ - bool NewVertexBuffers; - bool NewVertexElements; - /** The index buffer (also known as the element array buffer in OpenGL). */ struct gl_buffer_object *IndexBufferObj; }; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 7b694b753ba..29f2e6b9d6e 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -189,8 +189,8 @@ _mesa_vertex_attrib_binding(struct gl_context *ctx, array->BufferBindingIndex = bindingIndex; if (vao->Enabled & array_bit) { - vao->NewVertexBuffers = true; - vao->NewVertexElements = true; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; + ctx->Array.NewVertexElements = true; } vao->NonDefaultStateMask |= array_bit | BITFIELD_BIT(bindingIndex); @@ -250,10 +250,10 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx, } if (vao->Enabled & binding->_BoundArrays) { - vao->NewVertexBuffers = true; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; /* Non-dynamic VAOs merge vertex buffers, which affects vertex elements. */ if (!vao->IsDynamic) - vao->NewVertexElements = true; + ctx->Array.NewVertexElements = true; } vao->NonDefaultStateMask |= BITFIELD_BIT(index); @@ -284,8 +284,8 @@ vertex_binding_divisor(struct gl_context *ctx, vao->NonZeroDivisorMask &= ~binding->_BoundArrays; if (vao->Enabled & binding->_BoundArrays) { - vao->NewVertexBuffers = true; - vao->NewVertexElements = true; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; + ctx->Array.NewVertexElements = true; } vao->NonDefaultStateMask |= BITFIELD_BIT(bindingIndex); @@ -769,8 +769,10 @@ _mesa_update_array_format(struct gl_context *ctx, array->RelativeOffset = relativeOffset; array->Format = new_format; - if (vao->Enabled & VERT_BIT(attrib)) - vao->NewVertexElements = true; + if (vao->Enabled & VERT_BIT(attrib)) { + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; + ctx->Array.NewVertexElements = true; + } vao->NonDefaultStateMask |= BITFIELD_BIT(attrib); } @@ -1033,10 +1035,10 @@ update_array(struct gl_context *ctx, array->Ptr = ptr; if (vao->Enabled & VERT_BIT(attrib)) { - vao->NewVertexBuffers = true; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; /* Non-dynamic VAOs merge vertex buffers, which affects vertex elements. */ if (!vao->IsDynamic) - vao->NewVertexElements = true; + ctx->Array.NewVertexElements = true; } vao->NonDefaultStateMask |= BITFIELD_BIT(attrib); @@ -2066,9 +2068,9 @@ _mesa_enable_vertex_array_attribs(struct gl_context *ctx, if (attrib_bits) { /* was disabled, now being enabled */ vao->Enabled |= attrib_bits; - vao->NewVertexBuffers = true; - vao->NewVertexElements = true; vao->NonDefaultStateMask |= attrib_bits; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; + ctx->Array.NewVertexElements = true; /* Update the map mode if needed */ if (attrib_bits & (VERT_BIT_POS|VERT_BIT_GENERIC0)) @@ -2171,8 +2173,8 @@ _mesa_disable_vertex_array_attribs(struct gl_context *ctx, if (attrib_bits) { /* was enabled, now being disabled */ vao->Enabled &= ~attrib_bits; - vao->NewVertexBuffers = true; - vao->NewVertexElements = true; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; + ctx->Array.NewVertexElements = true; /* Update the map mode if needed */ if (attrib_bits & (VERT_BIT_POS|VERT_BIT_GENERIC0)) diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 1ccdda13e4e..0b9582aa082 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -261,10 +261,12 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) * Just plug in position pointer now. */ rs->VAO->VertexAttrib[VERT_ATTRIB_POS].Ptr = (GLubyte *) v; - rs->VAO->NewVertexBuffers = true; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; + /* Non-dynamic VAOs merge vertex buffers, which changes vertex elements. */ - if (!rs->VAO->IsDynamic) - rs->VAO->NewVertexElements = true; + if (!rs->VAO->IsDynamic) { + ctx->Array.NewVertexElements = true; + } /* Save the Draw VAO before we override it. */ struct gl_vertex_array_object *old_vao; diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h index 57f896cd19c..9f7e70f4c77 100644 --- a/src/mesa/vbo/vbo_private.h +++ b/src/mesa/vbo/vbo_private.h @@ -37,6 +37,7 @@ #include "vbo/vbo_save.h" #include "main/varray.h" #include "main/macros.h" +#include "state_tracker/st_atom.h" struct _glapi_table; @@ -257,8 +258,8 @@ _vbo_set_attrib_format(struct gl_context *ctx, GL_FALSE, integer, doubles, offset); if (vao->Enabled & VERT_BIT(attr)) { - vao->NewVertexBuffers = true; - vao->NewVertexElements = true; + ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS; + ctx->Array.NewVertexElements = true; } vao->VertexAttrib[attr].Ptr = ADD_POINTERS(buffer_offset, offset); |