mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 22:08:26 +02:00
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>
This commit is contained in:
parent
0fbd82bdc4
commit
b57d56d754
8 changed files with 25 additions and 39 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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]];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue