summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-06-19 02:53:47 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-06-24 07:36:14 +0200
commit39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0 (patch)
treef0083d6353ffbac6621ba8a67fd751300429192e
parentgl_rasterizer: Use NV_vertex_buffer_unified_memory for vertex buffer robustness (diff)
downloadyuzu-39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0.tar
yuzu-39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0.tar.gz
yuzu-39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0.tar.bz2
yuzu-39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0.tar.lz
yuzu-39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0.tar.xz
yuzu-39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0.tar.zst
yuzu-39c97f1b652898dbd0e5e6d028de2ba4b9fa94a0.zip
-rw-r--r--src/video_core/renderer_opengl/gl_stream_buffer.cpp19
-rw-r--r--src/video_core/renderer_opengl/gl_stream_buffer.h1
2 files changed, 5 insertions, 15 deletions
diff --git a/src/video_core/renderer_opengl/gl_stream_buffer.cpp b/src/video_core/renderer_opengl/gl_stream_buffer.cpp
index 164df4feb..3655ff629 100644
--- a/src/video_core/renderer_opengl/gl_stream_buffer.cpp
+++ b/src/video_core/renderer_opengl/gl_stream_buffer.cpp
@@ -57,30 +57,21 @@ std::tuple<u8*, GLintptr, bool> OGLStreamBuffer::Map(GLsizeiptr size, GLintptr a
bool invalidate = false;
if (buffer_pos + size > buffer_size) {
+ MICROPROFILE_SCOPE(OpenGL_StreamBuffer);
+ glInvalidateBufferData(gl_buffer.handle);
+
buffer_pos = 0;
invalidate = true;
-
- glUnmapNamedBuffer(gl_buffer.handle);
- }
-
- if (invalidate) {
- static const GLbitfield flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT |
- GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
-
- MICROPROFILE_SCOPE(OpenGL_StreamBuffer);
- mapped_ptr = static_cast<u8*>(
- glMapNamedBufferRange(gl_buffer.handle, buffer_pos, buffer_size - buffer_pos, flags));
- mapped_offset = buffer_pos;
}
- return std::make_tuple(mapped_ptr + buffer_pos - mapped_offset, buffer_pos, invalidate);
+ return std::make_tuple(mapped_ptr + buffer_pos, buffer_pos, invalidate);
}
void OGLStreamBuffer::Unmap(GLsizeiptr size) {
ASSERT(size <= mapped_size);
if (size > 0) {
- glFlushMappedNamedBufferRange(gl_buffer.handle, buffer_pos - mapped_offset, size);
+ glFlushMappedNamedBufferRange(gl_buffer.handle, buffer_pos, size);
}
buffer_pos += size;
diff --git a/src/video_core/renderer_opengl/gl_stream_buffer.h b/src/video_core/renderer_opengl/gl_stream_buffer.h
index e67a82980..307a67113 100644
--- a/src/video_core/renderer_opengl/gl_stream_buffer.h
+++ b/src/video_core/renderer_opengl/gl_stream_buffer.h
@@ -48,7 +48,6 @@ private:
GLuint64EXT gpu_address = 0;
GLintptr buffer_pos = 0;
GLsizeiptr buffer_size = 0;
- GLintptr mapped_offset = 0;
GLsizeiptr mapped_size = 0;
u8* mapped_ptr = nullptr;
};