diff options
Diffstat (limited to 'src/mesa/main/state.c')
-rw-r--r-- | src/mesa/main/state.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 2fd4fb9d323..6dd7a7ec075 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -479,3 +479,32 @@ _mesa_update_vertex_processing_mode(struct gl_context *ctx) else ctx->VertexProgram._VPMode = VP_MODE_FF; } + + +/** + * Set the _DrawVAO and the net enabled arrays. + * The vao->_Enabled bitmask is transformed due to position/generic0 + * as stored in vao->_AttributeMapMode. Then the filter bitmask is applied + * to filter out arrays unwanted for the currently executed draw operation. + * For example, the generic attributes are masked out form the _DrawVAO's + * enabled arrays when a fixed function array draw is executed. + */ +void +_mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao, + GLbitfield filter) +{ + struct gl_vertex_array_object **ptr = &ctx->Array._DrawVAO; + if (*ptr != vao) { + _mesa_reference_vao_(ctx, ptr, vao); + ctx->NewDriverState |= ctx->DriverFlags.NewArray; + } else if (vao->NewArrays) { + ctx->NewDriverState |= ctx->DriverFlags.NewArray; + } + + /* May shuffle the position and generic0 bits around, filter out unwanted */ + const GLbitfield enabled = filter & _mesa_get_vao_vp_inputs(vao); + if (ctx->Array._DrawVAOEnabledAttribs != enabled) + ctx->NewDriverState |= ctx->DriverFlags.NewArray; + ctx->Array._DrawVAOEnabledAttribs = enabled; + _mesa_set_varying_vp_inputs(ctx, enabled); +} |