From b5d5113803f03cdaa549a490caf30aee4b7b8b6b Mon Sep 17 00:00:00 2001 From: Malcolm Jestadt Date: Tue, 2 Jul 2019 22:27:54 -0400 Subject: [PATCH] gl: Workaround slow PBO usage with Mesa -Mesa is currently fastest with GL_STREAM_COPY -See https://gitlab.freedesktop.org/mesa/mesa/commit/a338dc01866ce50bf7555ee8dc08491c7f63b585 -Also see https://bugs.freedesktop.org/show_bug.cgi?id=111043 --- rpcs3/Emu/RSX/GL/GLTexture.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index f66eadb215..587f52b7db 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -723,11 +723,16 @@ namespace gl GLsizeiptr src_mem = src->width() * src->height(); GLsizeiptr dst_mem = dst->width() * dst->height(); + GLenum buffer_copy_flag = GL_STATIC_COPY; + if (gl::get_driver_caps().vendor_MESA) buffer_copy_flag = GL_STREAM_COPY; + // NOTE: Mesa lacks acceleration for PBO unpacking and is currently fastest with GL_STREAM_COPY + // See https://bugs.freedesktop.org/show_bug.cgi?id=111043 + auto max_mem = std::max(src_mem, dst_mem) * 16; if (!g_typeless_transfer_buffer || max_mem > g_typeless_transfer_buffer.size()) { if (g_typeless_transfer_buffer) g_typeless_transfer_buffer.remove(); - g_typeless_transfer_buffer.create(buffer::target::pixel_pack, max_mem, nullptr, GL_STATIC_COPY); + g_typeless_transfer_buffer.create(buffer::target::pixel_pack, max_mem, nullptr, buffer_copy_flag); } auto format_type = get_format_type(src->get_internal_format());