mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 18:00:13 +01:00
mesa: precompute _mesa_get_vao_vp_inputs
It's called for every draw, so this is important. All inputs of _mesa_get_vao_vp_inputs are changed when update_attribute_map_mode is called, so we can just compute the value there. The assertion ensures correct behavior in debug builds. Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
This commit is contained in:
parent
40b8838a5a
commit
306f1ef417
5 changed files with 15 additions and 15 deletions
|
|
@ -158,18 +158,6 @@ _mesa_vao_enable_to_vp_inputs(gl_attribute_map_mode mode, GLbitfield enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the vp_inputs enabled bitmask after application of
|
|
||||||
* the position/generic0 aliasing map.
|
|
||||||
*/
|
|
||||||
static inline GLbitfield
|
|
||||||
_mesa_get_vao_vp_inputs(const struct gl_vertex_array_object *vao)
|
|
||||||
{
|
|
||||||
const gl_attribute_map_mode mode = vao->_AttributeMapMode;
|
|
||||||
return _mesa_vao_enable_to_vp_inputs(mode, vao->Enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper functions for consuming backends to walk the
|
* Helper functions for consuming backends to walk the
|
||||||
* ctx->Array._DrawVAO for driver side array setup.
|
* ctx->Array._DrawVAO for driver side array setup.
|
||||||
|
|
|
||||||
|
|
@ -1658,6 +1658,9 @@ struct gl_vertex_array_object
|
||||||
/** Denotes the way the position/generic0 attribute is mapped */
|
/** Denotes the way the position/generic0 attribute is mapped */
|
||||||
gl_attribute_map_mode _AttributeMapMode;
|
gl_attribute_map_mode _AttributeMapMode;
|
||||||
|
|
||||||
|
/** "Enabled" with the position/generic0 attribute aliasing resolved */
|
||||||
|
GLbitfield _EnabledWithMapMode;
|
||||||
|
|
||||||
/** Mask of VERT_BIT_* values indicating changed/dirty arrays */
|
/** Mask of VERT_BIT_* values indicating changed/dirty arrays */
|
||||||
GLbitfield NewArrays;
|
GLbitfield NewArrays;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -680,8 +680,11 @@ _mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao,
|
||||||
new_array = true;
|
new_array = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* May shuffle the position and generic0 bits around, filter out unwanted */
|
assert(vao->_EnabledWithMapMode ==
|
||||||
const GLbitfield enabled = filter & _mesa_get_vao_vp_inputs(vao);
|
_mesa_vao_enable_to_vp_inputs(vao->_AttributeMapMode, vao->Enabled));
|
||||||
|
|
||||||
|
/* Filter out unwanted arrays. */
|
||||||
|
const GLbitfield enabled = filter & vao->_EnabledWithMapMode;
|
||||||
if (ctx->Array._DrawVAOEnabledAttribs != enabled) {
|
if (ctx->Array._DrawVAOEnabledAttribs != enabled) {
|
||||||
ctx->Array._DrawVAOEnabledAttribs = enabled;
|
ctx->Array._DrawVAOEnabledAttribs = enabled;
|
||||||
new_array = true;
|
new_array = true;
|
||||||
|
|
|
||||||
|
|
@ -1882,6 +1882,9 @@ _mesa_enable_vertex_array_attribs(struct gl_context *ctx,
|
||||||
/* Update the map mode if needed */
|
/* Update the map mode if needed */
|
||||||
if (attrib_bits & (VERT_BIT_POS|VERT_BIT_GENERIC0))
|
if (attrib_bits & (VERT_BIT_POS|VERT_BIT_GENERIC0))
|
||||||
update_attribute_map_mode(ctx, vao);
|
update_attribute_map_mode(ctx, vao);
|
||||||
|
|
||||||
|
vao->_EnabledWithMapMode =
|
||||||
|
_mesa_vao_enable_to_vp_inputs(vao->_AttributeMapMode, vao->Enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1979,6 +1982,9 @@ _mesa_disable_vertex_array_attribs(struct gl_context *ctx,
|
||||||
/* Update the map mode if needed */
|
/* Update the map mode if needed */
|
||||||
if (attrib_bits & (VERT_BIT_POS|VERT_BIT_GENERIC0))
|
if (attrib_bits & (VERT_BIT_POS|VERT_BIT_GENERIC0))
|
||||||
update_attribute_map_mode(ctx, vao);
|
update_attribute_map_mode(ctx, vao);
|
||||||
|
|
||||||
|
vao->_EnabledWithMapMode =
|
||||||
|
_mesa_vao_enable_to_vp_inputs(vao->_AttributeMapMode, vao->Enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ update_vao_inputs(struct gl_context *ctx,
|
||||||
const struct gl_vertex_array_object *vao = ctx->Array._DrawVAO;
|
const struct gl_vertex_array_object *vao = ctx->Array._DrawVAO;
|
||||||
|
|
||||||
/* Make sure we process only arrays enabled in the VAO */
|
/* Make sure we process only arrays enabled in the VAO */
|
||||||
assert((enable & ~_mesa_get_vao_vp_inputs(vao)) == 0);
|
assert((enable & ~vao->_EnabledWithMapMode) == 0);
|
||||||
|
|
||||||
/* Fill in the client arrays from the VAO */
|
/* Fill in the client arrays from the VAO */
|
||||||
const struct gl_vertex_buffer_binding *bindings = &vao->BufferBinding[0];
|
const struct gl_vertex_buffer_binding *bindings = &vao->BufferBinding[0];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue