android: renderer_opengl: Various fixes for GLES.

video_core: bump swap chain size for GLES to reduce bottleneck

SWAP_CHAIN_SIZE
This commit is contained in:
bunnei 2020-03-07 20:33:32 -05:00 committed by SachinVin
parent 4cc8d43fa1
commit 6f1c76518c

View file

@ -29,6 +29,7 @@
#include "core/tracer/recorder.h" #include "core/tracer/recorder.h"
#include "video_core/debug_utils/debug_utils.h" #include "video_core/debug_utils/debug_utils.h"
#include "video_core/rasterizer_interface.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/gl_vars.h"
#include "video_core/renderer_opengl/post_processing_opengl.h" #include "video_core/renderer_opengl/post_processing_opengl.h"
#include "video_core/renderer_opengl/renderer_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 // 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 // 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 // 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; constexpr std::size_t SWAP_CHAIN_SIZE = 9;
#endif
class OGLTextureMailboxException : public std::runtime_error { class OGLTextureMailboxException : public std::runtime_error {
public: public:
@ -96,7 +102,7 @@ public:
frame->color.Create(); frame->color.Create();
state.renderbuffer = frame->color.handle; state.renderbuffer = frame->color.handle;
state.Apply(); state.Apply();
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, width, height); glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, width, height);
// Recreate the FBO for the render target // Recreate the FBO for the render target
frame->render.Release(); frame->render.Release();
@ -1197,9 +1203,11 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum
/// Initialize the renderer /// Initialize the renderer
VideoCore::ResultStatus RendererOpenGL::Init() { VideoCore::ResultStatus RendererOpenGL::Init() {
#ifndef ANDROID
if (!gladLoadGL()) { if (!gladLoadGL()) {
return VideoCore::ResultStatus::ErrorBelowGL33; return VideoCore::ResultStatus::ErrorBelowGL33;
} }
#endif
if (GLAD_GL_KHR_debug) { if (GLAD_GL_KHR_debug) {
glEnable(GL_DEBUG_OUTPUT); glEnable(GL_DEBUG_OUTPUT);