From 6f1c76518c40ce4724eae2b1bb3d5547bcfc471f Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 7 Mar 2020 20:33:32 -0500 Subject: [PATCH] android: renderer_opengl: Various fixes for GLES. video_core: bump swap chain size for GLES to reduce bottleneck SWAP_CHAIN_SIZE --- src/video_core/renderer_opengl/renderer_opengl.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 113c9aa0a7..6b58b7e6ac 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -29,6 +29,7 @@ #include "core/tracer/recorder.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/rasterizer_interface.h" +#include "video_core/renderer_opengl/gl_state.h" #include "video_core/renderer_opengl/gl_vars.h" #include "video_core/renderer_opengl/post_processing_opengl.h" #include "video_core/renderer_opengl/renderer_opengl.h" @@ -39,7 +40,12 @@ namespace OpenGL { // If the size of this is too small, it ends up creating a soft cap on FPS as the renderer will have // to wait on available presentation frames. There doesn't seem to be much of a downside to a larger // number but 9 swap textures at 60FPS presentation allows for 800% speed so thats probably fine +#ifdef ANDROID +// Reduce the size of swap_chain, since the UI only allows upto 200% speed. +constexpr std::size_t SWAP_CHAIN_SIZE = 6; +#else constexpr std::size_t SWAP_CHAIN_SIZE = 9; +#endif class OGLTextureMailboxException : public std::runtime_error { public: @@ -96,7 +102,7 @@ public: frame->color.Create(); state.renderbuffer = frame->color.handle; state.Apply(); - glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, width, height); + glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, width, height); // Recreate the FBO for the render target frame->render.Release(); @@ -1197,9 +1203,11 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum /// Initialize the renderer VideoCore::ResultStatus RendererOpenGL::Init() { +#ifndef ANDROID if (!gladLoadGL()) { return VideoCore::ResultStatus::ErrorBelowGL33; } +#endif if (GLAD_GL_KHR_debug) { glEnable(GL_DEBUG_OUTPUT);