summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo.h
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-01-11 14:54:53 -0500
committerNicolai Hähnle <[email protected]>2016-02-03 14:03:49 +0100
commit6b057f8ecc43be2e190e53599bdd6b8cc96b6f19 (patch)
treeff6dcf3039d870a4a6089a86b2c1e3009d72befb /src/mesa/vbo/vbo.h
parent1a570d96a606249ba406da50a61e2eabb88c77ac (diff)
vbo: cache/memoize the result of vbo_get_minmax_indices (v3)
Some games developers are unaware that an index buffer in a VBO still needs to be read by the CPU if some varying data comes from a user pointer (unless glDrawRangeElements and friends are used). This is particularly bad when they tell us that the index buffer should live in VRAM. This cache helps, e.g. lifting This War Of Mine (a particularly bad offender) from under 10fps to slightly over 20fps on a Carrizo. Note that there is nothing prohibiting a user from rendering from multiple threads simultaneously with the same index buffer, hence the locking. (The internal buffer map taken for the buffer still leads to a race, but at least the locks are a move in the right direction.) v2: disable the cache on USAGE_TEXTURE_BUFFER as well (Chris Forbes) v3: - use bool instead of GLboolean for MinMaxCacheDirty (Ian Romanick) - replace the sticky USAGE_PERSISTENT_WRITE_MAP bit by a direct AccessFlags check Reviewed-by: Chris Forbes <[email protected]> (v2) Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo.h')
-rw-r--r--src/mesa/vbo/vbo.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 0b8b6a9de56..6494aa518a2 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -181,6 +181,9 @@ vbo_sizeof_ib_type(GLenum type)
}
void
+vbo_delete_minmax_cache(struct gl_buffer_object *bufferObj);
+
+void
vbo_get_minmax_indices(struct gl_context *ctx, const struct _mesa_prim *prim,
const struct _mesa_index_buffer *ib,
GLuint *min_index, GLuint *max_index, GLuint nr_prims);