diff options
author | Mathias Fröhlich <[email protected]> | 2016-08-24 08:45:05 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2018-02-23 05:33:43 +0100 |
commit | 08c7474189da25729e4e0bc8755b676e13c2c2c8 (patch) | |
tree | 15c2aa92d5f5c54d8124dcf0fde8ea99990c6a38 /src/mesa/main/state.c | |
parent | ce3d2421a0bc0dd2e99fa6a54a127ca5fc57ba15 (diff) |
mesa: Introduce a yet unused _DrawVAO.
During the patch series this VAO gets populated with either the currently
bound VAO or an internal VAO that will be used for immediate mode and
dlist rendering.
v2: More comments about the _DrawVAO, filter and enabled mask.
Rename _DrawVAOEnabled to _DrawVAOEnabledAttribs.
v3: Fix and move comment.
Signed-off-by: Mathias Fröhlich <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
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); +} |