From cdd70e1f0cc5d0af9fb605ef890681e936e6ac2b Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Thu, 18 Apr 2024 18:47:53 +0100 Subject: [PATCH] Fix Mali GPU Performance issues on OpenGL Co-authored-by: zhang wei --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index b89f6588e..93d6ebe7b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -73,6 +73,11 @@ GLenum MakeAttributeType(Pica::PipelineRegs::VertexAttributeFormat format) { } // Anonymous namespace +static bool IsVendorMali() { + std::string gpu_vendor{reinterpret_cast(glGetString(GL_VENDOR))}; + return gpu_vendor.find("ARM") != std::string::npos; +} + RasterizerOpenGL::RasterizerOpenGL(Memory::MemorySystem& memory, Pica::PicaCore& pica, VideoCore::CustomTexManager& custom_tex_manager, VideoCore::RendererBase& renderer, Driver& driver_) @@ -83,8 +88,14 @@ RasterizerOpenGL::RasterizerOpenGL(Memory::MemorySystem& memory, Pica::PicaCore& vertex_buffer{driver, GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE}, uniform_buffer{driver, GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE}, index_buffer{driver, GL_ELEMENT_ARRAY_BUFFER, INDEX_BUFFER_SIZE}, - texture_buffer{driver, GL_TEXTURE_BUFFER, texture_buffer_size}, - texture_lf_buffer{driver, GL_TEXTURE_BUFFER, texture_buffer_size} { + texture_buffer{driver, GL_TEXTURE_BUFFER, + IsVendorMali() + ? (GL_MAX_TEXTURE_BUFFER_SIZE == 65536 ? 11264 : texture_buffer_size) + : texture_buffer_size}, + texture_lf_buffer{driver, GL_TEXTURE_BUFFER, + IsVendorMali() + ? (GL_MAX_TEXTURE_BUFFER_SIZE == 65536 ? 525312 : texture_buffer_size) + : texture_buffer_size} { // Clipping plane 0 is always enabled for PICA fixed clip plane z <= 0 state.clip_distance[0] = true;