From f0923c4ed785d03360210244b1d32e4790acb1bb Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 27 May 2019 18:39:21 +1000 Subject: [PATCH] [client] egl: expose a few new tuneables --- VERSION | 2 +- client/renderers/EGL/egl.c | 43 ++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/VERSION b/VERSION index 8f2be364..0c8a86af 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-rc3-1-g84e5626fee+1 \ No newline at end of file +B1-rc3-4-ga53d7bcd30+1 \ No newline at end of file diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index c2891ebb..9e562b66 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -102,6 +102,20 @@ static struct Option egl_options[] = .type = OPTION_TYPE_BOOL, .value.x_bool = false }, + { + .module = "egl", + .name = "doubleBuffer", + .description = "Enable double buffering", + .type = OPTION_TYPE_BOOL, + .value.x_bool = true + }, + { + .module = "egl", + .name = "multisample", + .description = "Enable Multisampling", + .type = OPTION_TYPE_BOOL, + .value.x_bool = true + }, { .module = "egl", .name = "nvGainMax", @@ -167,18 +181,25 @@ bool egl_create(void ** opaque, const LG_RendererParams params) bool egl_initialize(void * opaque, Uint32 * sdlFlags) { + const bool doubleBuffer = option_get_bool("egl", "doubleBuffer"); + DEBUG_INFO("Double buffering is %s", doubleBuffer ? "on" : "off"); + *sdlFlags = SDL_WINDOW_OPENGL; - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER , 1); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER , doubleBuffer ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); - int maxSamples = sysinfo_gfx_max_multisample(); - if (maxSamples > 1) + if (option_get_bool("egl", "multisample")) { - if (maxSamples > 4) - maxSamples = 4; + int maxSamples = sysinfo_gfx_max_multisample(); + if (maxSamples > 1) + { + if (maxSamples > 4) + maxSamples = 4; - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, maxSamples); + DEBUG_INFO("Multsampling enabled, max samples: %d", maxSamples); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, maxSamples); + } } return true; @@ -378,10 +399,10 @@ bool egl_render_startup(void * opaque, SDL_Window * window) EGLint attr[] = { - EGL_BUFFER_SIZE , 16, + EGL_BUFFER_SIZE , 32, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SAMPLE_BUFFERS , 1, - EGL_SAMPLES , 8, + EGL_SAMPLES , 4, EGL_NONE }; @@ -412,6 +433,10 @@ bool egl_render_startup(void * opaque, SDL_Window * window) return false; } + EGLint value; + eglQueryContext(this->display, this->context, EGL_RENDER_BUFFER, &value); + DEBUG_INFO("%x", value); + eglMakeCurrent(this->display, this->surface, this->surface, this->context); DEBUG_INFO("Vendor : %s", glGetString(GL_VENDOR ));