From 1b9c2f26f93cbf3880760c6bef8fe045bbf56b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 12 Feb 2018 11:46:19 +0100 Subject: [PATCH] Whitelist mapbuffer usage to NVIDIA only (should maybe add Qualcomm too), it's murder on Mali --- ext/SPIRV-Cross | 2 +- ext/armips | 2 +- ext/glslang | 2 +- ext/native/gfx_es2/gpu_features.cpp | 6 ++++++ ext/native/gfx_es2/gpu_features.h | 1 + ext/native/thin3d/GLRenderManager.cpp | 4 ++-- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ext/SPIRV-Cross b/ext/SPIRV-Cross index 90966d50f5..6381b2ff9c 160000 --- a/ext/SPIRV-Cross +++ b/ext/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 90966d50f57608587bafd95b4e345b02b814754a +Subproject commit 6381b2ff9c0d975af8fd2974c97aa12a69ab6cc6 diff --git a/ext/armips b/ext/armips index 8b4cadaf62..770365d44d 160000 --- a/ext/armips +++ b/ext/armips @@ -1 +1 @@ -Subproject commit 8b4cadaf62d7de42d374056fc6aafc555f2bc7dc +Subproject commit 770365d44df35d6e675c58bb2a774ca412278ef5 diff --git a/ext/glslang b/ext/glslang index 2edde6665d..b16f7e6819 160000 --- a/ext/glslang +++ b/ext/glslang @@ -1 +1 @@ -Subproject commit 2edde6665d9a56ead5ea0e55b4e64d9a803e6164 +Subproject commit b16f7e6819267e57c3c244808d1981f0ce34acbc diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index 1eb2392cc4..966781cc75 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -77,6 +77,12 @@ void ProcessGPUFeatures() { } gl_extensions.bugs |= BUG_PVR_GENMIPMAP_HEIGHT_GREATER; } + + // TODO: Make this check more lenient. Disabled for all right now + // because it murders performance on Mali. + if (gl_extensions.gpuVendor != GPU_VENDOR_NVIDIA) { + gl_extensions.bugs |= BUG_ANY_MAP_BUFFER_RANGE_SLOW; + } } // http://stackoverflow.com/questions/16147700/opengl-es-using-tegra-specific-extensions-gl-ext-texture-array diff --git a/ext/native/gfx_es2/gpu_features.h b/ext/native/gfx_es2/gpu_features.h index c3a7a9161d..b26e923b55 100644 --- a/ext/native/gfx_es2/gpu_features.h +++ b/ext/native/gfx_es2/gpu_features.h @@ -23,6 +23,7 @@ enum { BUG_PVR_SHADER_PRECISION_BAD = 2, BUG_PVR_SHADER_PRECISION_TERRIBLE = 4, BUG_PVR_GENMIPMAP_HEIGHT_GREATER = 8, + BUG_ANY_MAP_BUFFER_RANGE_SLOW = 16, }; // Extensions to look at using: diff --git a/ext/native/thin3d/GLRenderManager.cpp b/ext/native/thin3d/GLRenderManager.cpp index 4a96479669..2c3f0b1b58 100644 --- a/ext/native/thin3d/GLRenderManager.cpp +++ b/ext/native/thin3d/GLRenderManager.cpp @@ -712,10 +712,10 @@ void *GLRBuffer::Map(GLbitfield access) { } #endif p = glMapBufferRange(target_, 0, size_, access); - } else if (gl_extensions.VersionGEThan(3, 0, 0)) { + } else if (gl_extensions.VersionGEThan(3, 0, 0) && !(gl_extensions.bugs & BUG_ANY_MAP_BUFFER_RANGE_SLOW)) { // GLES3 or desktop 3. p = glMapBufferRange(target_, 0, size_, access); - } else { + } else if (!(gl_extensions.bugs & BUG_ANY_MAP_BUFFER_RANGE_SLOW)) { #ifndef USING_GLES2 p = glMapBuffer(target_, GL_READ_WRITE); #endif