summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2019-03-01 09:27:53 +0100
committerMathias Fröhlich <[email protected]>2019-03-15 06:06:42 +0100
commitb89ae55a709808c0e1449d4045935c936e28958a (patch)
tree6bd0092db932923325c377b5037e413c2006b5a0 /src
parentb43fae364f8ac27cf782fbbdd699aa9ec4ee6b89 (diff)
mesa: Replace _ae_{,un}map_vbos with _mesa_vao_{,un}map_arrays
Due to the use of bitmaps, the _mesa_vao_{,un}map_arrays functions should provide comparable runtime efficienty to the currently used _ae_{,un}map_vbos functions. So use this functions and enable further cleanup. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/api_arrayelt.c12
-rw-r--r--src/mesa/vbo/vbo_save_api.c12
2 files changed, 11 insertions, 13 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index cb0d2a28a6c..ea91fbcabf5 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1792,7 +1792,7 @@ _ae_ArrayElement(GLint elt)
GET_CURRENT_CONTEXT(ctx);
const AEcontext *actx = AE_CONTEXT(ctx);
const struct _glapi_table * const disp = GET_DISPATCH();
- GLboolean do_map;
+ struct gl_vertex_array_object *vao;
/* If PrimitiveRestart is enabled and the index is the RestartIndex
* then we call PrimitiveRestartNV and return.
@@ -1807,16 +1807,12 @@ _ae_ArrayElement(GLint elt)
_ae_update_state(ctx);
}
- /* Determine if we need to map/unmap VBOs */
- do_map = actx->nr_vbos && !actx->mapped_vbos;
-
- if (do_map)
- _ae_map_vbos(ctx);
+ vao = ctx->Array.VAO;
+ _mesa_vao_map_arrays(ctx, vao, GL_MAP_READ_BIT);
_mesa_array_element(ctx, (struct _glapi_table *)disp, elt);
- if (do_map)
- _ae_unmap_vbos(ctx);
+ _mesa_vao_unmap_arrays(ctx, vao);
}
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 6122727bae9..bb578694e00 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1307,6 +1307,7 @@ static void GLAPIENTRY
_save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
{
GET_CURRENT_CONTEXT(ctx);
+ struct gl_vertex_array_object *vao = ctx->Array.VAO;
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i;
@@ -1325,7 +1326,7 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
/* Make sure to process any VBO binding changes */
_mesa_update_state(ctx);
- _ae_map_vbos(ctx);
+ _mesa_vao_map_arrays(ctx, vao, GL_MAP_READ_BIT);
vbo_save_NotifyBegin(ctx, mode, true);
@@ -1333,7 +1334,7 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
_mesa_array_element(ctx, GET_DISPATCH(), start + i);
CALL_End(GET_DISPATCH(), ());
- _ae_unmap_vbos(ctx);
+ _mesa_vao_unmap_arrays(ctx, vao);
}
@@ -1395,7 +1396,8 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
{
GET_CURRENT_CONTEXT(ctx);
struct vbo_save_context *save = &vbo_context(ctx)->save;
- struct gl_buffer_object *indexbuf = ctx->Array.VAO->IndexBufferObj;
+ struct gl_vertex_array_object *vao = ctx->Array.VAO;
+ struct gl_buffer_object *indexbuf = vao->IndexBufferObj;
GLint i;
if (!_mesa_is_valid_prim_mode(ctx, mode)) {
@@ -1419,7 +1421,7 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
/* Make sure to process any VBO binding changes */
_mesa_update_state(ctx);
- _ae_map_vbos(ctx);
+ _mesa_vao_map(ctx, vao, GL_MAP_READ_BIT);
if (_mesa_is_bufferobj(indexbuf))
indices =
@@ -1447,7 +1449,7 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
CALL_End(GET_DISPATCH(), ());
- _ae_unmap_vbos(ctx);
+ _mesa_vao_unmap(ctx, vao);
}
static void GLAPIENTRY