mesa: Remove _ae_{,un}map_vbos and dependencies.
Since mapping and unmapping the buffer objects in a VAO is handled directly from the VAO, this part of the _NEW_ARRAY state is no longer used. So remove this part of array element state. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
This commit is contained in:
@@ -66,11 +66,6 @@ typedef struct {
|
||||
AEarray arrays[32];
|
||||
AEattrib attribs[VERT_ATTRIB_MAX + 1];
|
||||
|
||||
/* List of VBOs we need to map before executing ArrayElements */
|
||||
struct gl_buffer_object *vbo[VERT_ATTRIB_MAX];
|
||||
GLuint nr_vbos;
|
||||
GLboolean mapped_vbos; /**< Any currently mapped VBOs? */
|
||||
|
||||
bool dirty_state;
|
||||
} AEcontext;
|
||||
|
||||
@@ -1534,26 +1529,6 @@ _ae_destroy_context(struct gl_context *ctx)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the given vertex buffer object exists and is not mapped.
|
||||
* If so, add it to the list of buffers we must map before executing
|
||||
* an glArrayElement call.
|
||||
*/
|
||||
static void
|
||||
check_vbo(AEcontext *actx, struct gl_buffer_object *vbo)
|
||||
{
|
||||
if (_mesa_is_bufferobj(vbo) &&
|
||||
!_mesa_bufferobj_mapped(vbo, MAP_INTERNAL)) {
|
||||
GLuint i;
|
||||
for (i = 0; i < actx->nr_vbos; i++)
|
||||
if (actx->vbo[i] == vbo)
|
||||
return; /* already in the list, we're done */
|
||||
assert(actx->nr_vbos < VERT_ATTRIB_MAX);
|
||||
actx->vbo[actx->nr_vbos++] = vbo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make a list of per-vertex functions to call for each glArrayElement call.
|
||||
* These functions access the array data (i.e. glVertex, glColor, glNormal,
|
||||
@@ -1569,14 +1544,11 @@ _ae_update_state(struct gl_context *ctx)
|
||||
GLuint i;
|
||||
struct gl_vertex_array_object *vao = ctx->Array.VAO;
|
||||
|
||||
actx->nr_vbos = 0;
|
||||
|
||||
/* conventional vertex arrays */
|
||||
if (vao->Enabled & VERT_BIT_COLOR_INDEX) {
|
||||
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
aa->offset = IndexFuncs[TYPE_IDX(aa->array->Format.Type)];
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
@@ -1584,7 +1556,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
aa->array = &vao->VertexAttrib[VERT_ATTRIB_EDGEFLAG];
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
aa->offset = _gloffset_EdgeFlagv;
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
@@ -1592,7 +1563,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
aa->array = &vao->VertexAttrib[VERT_ATTRIB_NORMAL];
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
aa->offset = NormalFuncs[TYPE_IDX(aa->array->Format.Type)];
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
@@ -1600,7 +1570,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR0];
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
aa->offset = ColorFuncs[aa->array->Format.Size-3][TYPE_IDX(aa->array->Format.Type)];
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
@@ -1608,7 +1577,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR1];
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Format.Type)];
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
@@ -1616,7 +1584,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
aa->array = &vao->VertexAttrib[VERT_ATTRIB_FOG];
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Format.Type)];
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
@@ -1634,7 +1601,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
[at->array->Format.Size-1]
|
||||
[TYPE_IDX(at->array->Format.Type)];
|
||||
at->index = VERT_ATTRIB_TEX0 + i;
|
||||
check_vbo(actx, at->binding->BufferObj);
|
||||
at++;
|
||||
}
|
||||
}
|
||||
@@ -1666,7 +1632,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
[TYPE_IDX(at->array->Format.Type)];
|
||||
|
||||
at->index = i;
|
||||
check_vbo(actx, at->binding->BufferObj);
|
||||
at++;
|
||||
}
|
||||
}
|
||||
@@ -1680,19 +1645,15 @@ _ae_update_state(struct gl_context *ctx)
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
assert(aa->array->Format.Size >= 2); /* XXX fix someday? */
|
||||
aa->offset = VertexFuncs[aa->array->Format.Size-2][TYPE_IDX(aa->array->Format.Type)];
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
else if (vao->Enabled & VERT_BIT_POS) {
|
||||
aa->array = &vao->VertexAttrib[VERT_ATTRIB_POS];
|
||||
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
|
||||
aa->offset = VertexFuncs[aa->array->Format.Size-2][TYPE_IDX(aa->array->Format.Type)];
|
||||
check_vbo(actx, aa->binding->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
check_vbo(actx, vao->IndexBufferObj);
|
||||
|
||||
assert(at - actx->attribs <= VERT_ATTRIB_MAX);
|
||||
assert(aa - actx->arrays < 32);
|
||||
at->func = NULL; /* terminate the list */
|
||||
@@ -1702,55 +1663,6 @@ _ae_update_state(struct gl_context *ctx)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Before replaying glArrayElements calls we need to map (for reading) any
|
||||
* VBOs referenced by the enabled vertex arrays.
|
||||
*/
|
||||
void
|
||||
_ae_map_vbos(struct gl_context *ctx)
|
||||
{
|
||||
AEcontext *actx = AE_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
|
||||
if (actx->mapped_vbos)
|
||||
return;
|
||||
|
||||
if (actx->dirty_state)
|
||||
_ae_update_state(ctx);
|
||||
|
||||
for (i = 0; i < actx->nr_vbos; i++)
|
||||
ctx->Driver.MapBufferRange(ctx, 0,
|
||||
actx->vbo[i]->Size,
|
||||
GL_MAP_READ_BIT,
|
||||
actx->vbo[i],
|
||||
MAP_INTERNAL);
|
||||
|
||||
if (actx->nr_vbos)
|
||||
actx->mapped_vbos = GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unmap VBOs
|
||||
*/
|
||||
void
|
||||
_ae_unmap_vbos(struct gl_context *ctx)
|
||||
{
|
||||
AEcontext *actx = AE_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
|
||||
if (!actx->mapped_vbos)
|
||||
return;
|
||||
|
||||
assert (!actx->dirty_state);
|
||||
|
||||
for (i = 0; i < actx->nr_vbos; i++)
|
||||
ctx->Driver.UnmapBuffer(ctx, actx->vbo[i], MAP_INTERNAL);
|
||||
|
||||
actx->mapped_vbos = GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_array_element(struct gl_context *ctx,
|
||||
struct _glapi_table *disp, GLint elt)
|
||||
@@ -1790,7 +1702,6 @@ void GLAPIENTRY
|
||||
_ae_ArrayElement(GLint elt)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
const AEcontext *actx = AE_CONTEXT(ctx);
|
||||
const struct _glapi_table * const disp = GET_DISPATCH();
|
||||
struct gl_vertex_array_object *vao;
|
||||
|
||||
@@ -1802,11 +1713,6 @@ _ae_ArrayElement(GLint elt)
|
||||
return;
|
||||
}
|
||||
|
||||
if (actx->dirty_state) {
|
||||
assert(!actx->mapped_vbos);
|
||||
_ae_update_state(ctx);
|
||||
}
|
||||
|
||||
vao = ctx->Array.VAO;
|
||||
_mesa_vao_map_arrays(ctx, vao, GL_MAP_READ_BIT);
|
||||
|
||||
@@ -1832,7 +1738,6 @@ _ae_invalidate_state(struct gl_context *ctx)
|
||||
*/
|
||||
assert(ctx->NewState & _NEW_ARRAY);
|
||||
|
||||
assert(!actx->mapped_vbos);
|
||||
actx->dirty_state = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,6 @@ extern void _mesa_array_element(struct gl_context *ctx,
|
||||
struct _glapi_table *disp, GLint elt);
|
||||
extern void GLAPIENTRY _ae_ArrayElement( GLint elt );
|
||||
|
||||
/* May optionally be called before a batch of element calls:
|
||||
*/
|
||||
extern void _ae_map_vbos( struct gl_context *ctx );
|
||||
extern void _ae_unmap_vbos( struct gl_context *ctx );
|
||||
|
||||
extern void
|
||||
_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
|
||||
const GLvertexformat *vfmt);
|
||||
|
||||
Reference in New Issue
Block a user