/**
- * Set the vbo->exec->inputs[] pointers to point to the enabled
- * vertex arrays. This depends on the current vertex program/shader
- * being executed because of whether or not generic vertex arrays
- * alias the conventional vertex arrays.
- * For arrays that aren't enabled, we set the input[attrib] pointer
- * to point at a zero-stride current value "array".
+ * Return a filter mask for the net enabled vao arrays.
+ * This is to mask out arrays that would otherwise supersed required current
+ * values for the fixed function shaders for example.
*/
-static void
-recalculate_input_bindings(struct gl_context *ctx)
+static GLbitfield
+enabled_filter(const struct gl_context *ctx)
{
- struct vbo_context *vbo = vbo_context(ctx);
- struct vbo_exec_context *exec = &vbo->exec;
- const struct gl_vertex_array_object *vao = ctx->Array.VAO;
- const struct gl_vertex_array *vertexAttrib = vao->_VertexArray;
- const struct gl_vertex_array **inputs = &exec->array.inputs[0];
-
- /* May shuffle the position and generic0 bits around */
- GLbitfield vp_inputs = _mesa_get_vao_vp_inputs(vao);
-
- const gl_vertex_processing_mode processing_mode
- = ctx->VertexProgram._VPMode;
- const GLubyte * const map = _vbo_attribute_alias_map[processing_mode];
- switch (processing_mode) {
+ switch (ctx->VertexProgram._VPMode) {
case VP_MODE_FF:
/* When no vertex program is active (or the vertex program is generated
* from fixed-function state). We put the material values into the
* slots from the enabled arrays so that the current material values
* are pulled instead of the vao arrays.
*/
- vp_inputs &= VERT_BIT_FF_ALL;
-
- break;
+ return VERT_BIT_FF_ALL;
case VP_MODE_SHADER:
/* There are no shaders in OpenGL ES 1.x, so this code path should be
*/
assert(ctx->API != API_OPENGLES);
- /* In the compatibility profile of desktop OpenGL, the generic[0]
- * attribute array aliases and overrides the legacy position array.
- * Otherwise, legacy attributes available in the legacy slots,
- * generic attributes in the generic slots and materials are not
- * available as per-vertex attributes.
- *
- * In all other APIs, only the generic attributes exist, and none of the
- * slots are considered "magic."
- */
-
/* Other parts of the code assume that inputs[VERT_ATTRIB_POS] through
* inputs[VERT_ATTRIB_FF_MAX] will be non-NULL. However, in OpenGL
* ES 2.0+ or OpenGL core profile, none of these arrays should ever
* be enabled.
*/
if (ctx->API != API_OPENGL_COMPAT)
- vp_inputs &= VERT_BIT_GENERIC_ALL;
+ return VERT_BIT_GENERIC_ALL;
+
+ return VERT_BIT_ALL;
- break;
default:
assert(0);
+ return 0;
}
-
- const gl_attribute_map_mode mode = vao->_AttributeMapMode;
- const GLubyte *const vao_map = _mesa_vao_attribute_map[mode];
- for (unsigned vp_attrib = 0; vp_attrib < VERT_ATTRIB_MAX; ++vp_attrib) {
- if (unlikely(vp_inputs & VERT_BIT(vp_attrib)))
- inputs[vp_attrib] = &vertexAttrib[vao_map[vp_attrib]];
- else
- inputs[vp_attrib] = &vbo->currval[map[vp_attrib]];
- }
-
- _mesa_set_varying_vp_inputs(ctx, vp_inputs);
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
}
* Examine the enabled vertex arrays to set the exec->array.inputs[] values.
* These will point to the arrays to actually use for drawing. Some will
* be user-provided arrays, other will be zero-stride const-valued arrays.
- * Note that this might set the _NEW_VARYING_VP_INPUTS dirty flag so state
- * validation must be done after this call.
*/
static void
vbo_bind_arrays(struct gl_context *ctx)
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
- _mesa_set_drawing_arrays(ctx, vbo->exec.array.inputs);
+ _mesa_set_drawing_arrays(ctx, vbo->draw_arrays.inputs);
if (exec->array.recalculate_inputs) {
- recalculate_input_bindings(ctx);
+ /* Finally update the inputs array */
+ _vbo_update_inputs(ctx, &vbo->draw_arrays);
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
exec->array.recalculate_inputs = GL_FALSE;
- /* Again... because we may have changed the bitmask of per-vertex varying
- * attributes. If we regenerate the fixed-function vertex program now
- * we may be able to prune down the number of vertex attributes which we
- * need in the shader.
- */
- if (ctx->NewState) {
- /* Setting "validating" to TRUE prevents _mesa_update_state from
- * invalidating what we just did.
- */
- exec->validating = GL_TRUE;
- _mesa_update_state(ctx);
- exec->validating = GL_FALSE;
- }
+ assert(ctx->NewState == 0);
}
}
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawArrays(ctx, mode, count))
return;
}
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count,
numInstances))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawArraysInstanced(ctx, mode, first, count,
numInstances))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_MultiDrawArrays(ctx, mode, count, primcount))
return;
}
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawRangeElements(ctx, mode, start, end, count,
type, indices))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
return;
}
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
return;
}
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
indices, numInstances))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
indices, numInstances))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
indices, numInstances))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
indices, numInstances))
return;
{
GET_CURRENT_CONTEXT(ctx);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
primcount))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
primcount))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj, stream,
numInstances)) {
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawArraysIndirect(ctx, mode, indirect))
return;
}
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_DrawElementsIndirect(ctx, mode, type, indirect))
return;
}
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_MultiDrawArraysIndirect(ctx, mode, indirect,
primcount, stride))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_MultiDrawElementsIndirect(ctx, mode, type, indirect,
primcount, stride))
return;
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_MultiDrawArraysIndirectCount(ctx, mode,
indirect,
drawcount_offset,
if (_mesa_is_no_error_enabled(ctx)) {
FLUSH_CURRENT(ctx, 0);
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (ctx->NewState)
_mesa_update_state(ctx);
} else {
+ _mesa_set_draw_vao(ctx, ctx->Array.VAO, enabled_filter(ctx));
+
if (!_mesa_validate_MultiDrawElementsIndirectCount(ctx, mode, type,
indirect,
drawcount_offset,