diff options
author | Mathias Fröhlich <[email protected]> | 2018-04-01 20:18:36 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2018-05-10 07:06:15 +0200 |
commit | d1698d4311a63e1054e458ae1a27d7684595faee (patch) | |
tree | 6d73b27e4d4963a36db96f20472bc725c265309b /src/mesa/vbo | |
parent | fb4011ace9022e674639f2743272b7eba650cde3 (diff) |
mesa: Compute effective buffer bindings in the vao.
Compute VAO buffer binding information past the position/generic0 mapping.
Scan for duplicate buffer bindings and collapse them into derived
effective buffer binding index and effective attribute mask variables.
Provide a set of helper functions to access the distilled
information in the VAO. All of them prefixed with _mesa_draw_...
to indicate that they are meant to query draw information.
v2: Also group user space arrays containing interleaved arrays.
Add _Eff*Offset to be copied on attribute and binding copy.
Update comments.
Reviewed-by: Brian Paul <[email protected]>
Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo.h | 8 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 17 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_private.h | 14 |
3 files changed, 38 insertions, 1 deletions
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index 9b150662915..ca46f9baa79 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -186,6 +186,14 @@ void _vbo_update_inputs(struct gl_context *ctx, struct vbo_inputs *inputs); +const struct gl_array_attributes* +_vbo_current_attrib(const struct gl_context *ctx, gl_vert_attrib attr); + + +const struct gl_vertex_buffer_binding* +_vbo_current_binding(const struct gl_context *ctx); + + void GLAPIENTRY _es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index ada78ffd63b..cc6aada8610 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -234,6 +234,23 @@ _vbo_DestroyContext(struct gl_context *ctx) } +const struct gl_array_attributes * +_vbo_current_attrib(const struct gl_context *ctx, gl_vert_attrib attr) +{ + const struct vbo_context *vbo = vbo_context_const(ctx); + const gl_vertex_processing_mode vmp = ctx->VertexProgram._VPMode; + return &vbo->current[_vbo_attribute_alias_map[vmp][attr]]; +} + + +const struct gl_vertex_buffer_binding * +_vbo_current_binding(const struct gl_context *ctx) +{ + const struct vbo_context *vbo = vbo_context_const(ctx); + return &vbo->binding; +} + + /* * Helper function for _vbo_draw_indirect below that additionally takes a zero * initialized array of _mesa_prim scratch space memory as the last argument. diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h index 589c61d675e..b69f836aa0b 100644 --- a/src/mesa/vbo/vbo_private.h +++ b/src/mesa/vbo/vbo_private.h @@ -60,6 +60,13 @@ vbo_context(struct gl_context *ctx) } +static inline const struct vbo_context * +vbo_context_const(const struct gl_context *ctx) +{ + return ctx->vbo_context; +} + + /** * Array to apply the fixed function material aliasing map to * an attribute value used in vbo processing inputs to an attribute @@ -209,7 +216,12 @@ _vbo_set_attrib_format(struct gl_context *ctx, const GLboolean doubles = vbo_attrtype_to_double_flag(type); _mesa_update_array_format(ctx, vao, attr, size, type, GL_RGBA, GL_FALSE, integer, doubles, offset); - /* Ptr for userspace arrays */ + /* Ptr for userspace arrays. + * For updating the pointer we would need to add the vao->NewArrays flag + * to the VAO. But but that is done already unconditionally in + * _mesa_update_array_format called above. + */ + assert((vao->NewArrays | ~vao->_Enabled) & VERT_BIT(attr)); vao->VertexAttrib[attr].Ptr = ADD_POINTERS(buffer_offset, offset); } |