summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-01-22 16:18:16 -0500
committerMarge Bot <[email protected]>2020-02-11 00:34:57 +0000
commit03ded3d6ce37d3be12776bcc5dcd3c4d91f33248 (patch)
tree117b0d0be1d1f8253b5c6f3dd1148d01ceb2b3e0 /src/mesa/vbo
parent10cf7a5113446c85dd39bbb12544dd4ac30a0200 (diff)
vbo: skip FlushMappedBufferRange for glBegin/End by using a persistent mapping
This is a preparation for the next commit and just isolates the removal of GL_MAP_FLUSH_EXPLICIT_BIT and other map flags that don't make sense with UNSYNCHRONIZED. Reviewed-by: Mathias Fröhlich <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3766>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index fd55a5bbee6..ce13c32f95d 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -240,7 +240,8 @@ vbo_exec_vtx_unmap(struct vbo_exec_context *exec)
if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
struct gl_context *ctx = exec->ctx;
- if (ctx->Driver.FlushMappedBufferRange) {
+ if (ctx->Driver.FlushMappedBufferRange &&
+ !ctx->Extensions.ARB_buffer_storage) {
GLintptr offset = exec->vtx.buffer_used -
exec->vtx.bufferobj->Mappings[MAP_INTERNAL].Offset;
GLsizeiptr length = (exec->vtx.buffer_ptr - exec->vtx.buffer_map) *
@@ -273,12 +274,18 @@ void
vbo_exec_vtx_map(struct vbo_exec_context *exec)
{
struct gl_context *ctx = exec->ctx;
- const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */
- GL_MAP_INVALIDATE_RANGE_BIT |
- GL_MAP_UNSYNCHRONIZED_BIT |
- GL_MAP_FLUSH_EXPLICIT_BIT |
- MESA_MAP_NOWAIT_BIT;
const GLenum usage = GL_STREAM_DRAW_ARB;
+ GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */
+ GL_MAP_UNSYNCHRONIZED_BIT;
+
+ if (ctx->Extensions.ARB_buffer_storage) {
+ accessRange |= GL_MAP_PERSISTENT_BIT |
+ GL_MAP_COHERENT_BIT;
+ } else {
+ accessRange |= GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_FLUSH_EXPLICIT_BIT |
+ MESA_MAP_NOWAIT_BIT;
+ }
if (!_mesa_is_bufferobj(exec->vtx.bufferobj))
return;
@@ -312,6 +319,9 @@ vbo_exec_vtx_map(struct vbo_exec_context *exec)
VBO_VERT_BUFFER_SIZE,
NULL, usage,
GL_MAP_WRITE_BIT |
+ (ctx->Extensions.ARB_buffer_storage ?
+ GL_MAP_PERSISTENT_BIT |
+ GL_MAP_COHERENT_BIT : 0) |
GL_DYNAMIC_STORAGE_BIT |
GL_CLIENT_STORAGE_BIT,
exec->vtx.bufferobj)) {