From 4a781737c1da77015df4547f64f2f88966816343 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 12 Dec 2015 01:18:46 +0100 Subject: OPENGL: Resolve OpenGL functions on run-time. Formerly we relied on static linkage. However, in the presense of modern OpenGL (ES) implementations it is not easily identifable which library to link against. For example, on Linux amd64 with nVidia drivers and SDL2 setup to create a GLES 1.1 context one would need to link against libGL.so. However, traditionally GLES 1.1 required to link against libGLESv1_CM.so. To prevent a huge mess we simply resolve the OpenGL functions on run-time now and stop linking against a static library (in most cases). GLES support needs to be enabled manually on configure time for now. Tizen changes have NOT been tested. --- backends/graphics/opengl/context.cpp | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 backends/graphics/opengl/context.cpp (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp new file mode 100644 index 0000000000..c4869c2ae6 --- /dev/null +++ b/backends/graphics/opengl/context.cpp @@ -0,0 +1,69 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "backends/graphics/opengl/opengl-sys.h" +#include "backends/graphics/opengl/opengl-graphics.h" + +#include "common/tokenizer.h" + +namespace OpenGL { + +void Context::reset() { + NPOTSupported = false; +} + +Context g_context; + +void OpenGLGraphicsManager::initializeGLContext() { + // Initialize default state. + g_context.reset(); + + // Load all functions. + // We use horrible trickery to silence C++ compilers. + // See backends/plugins/sdl/sdl-provider.cpp for more information. + assert(sizeof(void (*)()) == sizeof(void *)); + void *fn = nullptr; +#define GL_EXT_FUNC_DEF(ret, name, param) \ + fn = getProcAddress(#name); \ + memcpy(&g_context.name, &fn, sizeof(fn)) +#ifdef USE_BUILTIN_OPENGL +#define GL_FUNC_DEF(ret, name, param) g_context.name = &name +#else +#define GL_FUNC_DEF GL_EXT_FUNC_DEF +#endif +#include "backends/graphics/opengl/opengl-func.h" +#undef GL_EXT_FUNC_DEF +#undef GL_FUNC_DEF + + const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS); + + Common::StringTokenizer tokenizer(extString, " "); + while (!tokenizer.empty()) { + Common::String token = tokenizer.nextToken(); + + if (token == "GL_ARB_texture_non_power_of_two") { + g_context.NPOTSupported = true; + } + } +} + +} // End of namespace OpenGL -- cgit v1.2.3 From d6d3e17d53754acedce0b1706e73f929d29b5eb8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 12 Dec 2015 22:08:33 +0100 Subject: OPENGL: Allow runtime specification of OpenGL mode. Formerly, we required that the OpenGL mode was fixed at compile time. Now we allow the code to work with whatever it is given at runtime. It is still possible to force a context type on compile time. --- backends/graphics/opengl/context.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index c4869c2ae6..d1776f851d 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -28,15 +28,23 @@ namespace OpenGL { void Context::reset() { + ready = false; + type = kContextGL; NPOTSupported = false; } Context g_context; -void OpenGLGraphicsManager::initializeGLContext() { +void OpenGLGraphicsManager::initializeGLContext(ContextType type) { // Initialize default state. g_context.reset(); +#if USE_FORCED_GL + type = kContextGL; +#elif USE_FORCED_GLES + type = kContextGLES; +#endif + // Load all functions. // We use horrible trickery to silence C++ compilers. // See backends/plugins/sdl/sdl-provider.cpp for more information. @@ -64,6 +72,9 @@ void OpenGLGraphicsManager::initializeGLContext() { g_context.NPOTSupported = true; } } + + g_context.ready = true; + g_context.type = type; } } // End of namespace OpenGL -- cgit v1.2.3 From af727afe0ceb66eaf51985ceceb2ac842b3358ee Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 18 Dec 2015 21:14:48 +0100 Subject: OPENGL: Simplify context type setting. --- backends/graphics/opengl/context.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index d1776f851d..0077cc2746 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -27,24 +27,32 @@ namespace OpenGL { -void Context::reset() { - ready = false; - type = kContextGL; +void Context::reset(bool full) { + if (full) { + // GLES supports least features, thus we initialize the context type + // to this on full reset. + type = kContextGLES; + } + NPOTSupported = false; } Context g_context; -void OpenGLGraphicsManager::initializeGLContext(ContextType type) { - // Initialize default state. - g_context.reset(); - +void OpenGLGraphicsManager::setContextType(ContextType type) { #if USE_FORCED_GL type = kContextGL; #elif USE_FORCED_GLES type = kContextGLES; #endif + g_context.type = type; +} + +void OpenGLGraphicsManager::initializeGLContext() { + // Initialize default state. + g_context.reset(); + // Load all functions. // We use horrible trickery to silence C++ compilers. // See backends/plugins/sdl/sdl-provider.cpp for more information. @@ -72,9 +80,6 @@ void OpenGLGraphicsManager::initializeGLContext(ContextType type) { g_context.NPOTSupported = true; } } - - g_context.ready = true; - g_context.type = type; } } // End of namespace OpenGL -- cgit v1.2.3 From fe88375ff376cbb0d940c96ac6ec1667be4acab0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 20 Dec 2015 05:42:54 +0100 Subject: OPENGL: Support GLES2 contexts. --- backends/graphics/opengl/context.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 0077cc2746..0944e05f7c 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -44,6 +44,8 @@ void OpenGLGraphicsManager::setContextType(ContextType type) { type = kContextGL; #elif USE_FORCED_GLES type = kContextGLES; +#elif USE_FORCED_GLES2 + type = kContextGLES2; #endif g_context.type = type; -- cgit v1.2.3 From 1c61e017a0eec8eff4d5f6281c2bd4e906103773 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 20 Dec 2015 05:54:34 +0100 Subject: OPENGL: Reset full context structure. --- backends/graphics/opengl/context.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 0944e05f7c..764cabcbde 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -28,13 +28,13 @@ namespace OpenGL { void Context::reset(bool full) { - if (full) { - // GLES supports least features, thus we initialize the context type - // to this on full reset. - type = kContextGLES; - } + // GLES supports least features, thus we initialize the context type + // to this on full reset. + const ContextType savedType = full ? kContextGLES : type; + + memset(this, 0, sizeof(Context)); - NPOTSupported = false; + type = savedType; } Context g_context; -- cgit v1.2.3 From fee1aa550203c3f46ff19afbe19a7baa4771a5cd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 20 Dec 2015 09:30:11 +0100 Subject: OPENGL: Add support for shaders with GL contexts. --- backends/graphics/opengl/context.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 764cabcbde..618be07a57 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -74,14 +74,35 @@ void OpenGLGraphicsManager::initializeGLContext() { const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS); +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + bool ARBShaderObjects = false; + bool ARBShadingLanguage100 = false; + bool ARBVertexShader = false; + bool ARBFragmentShader = false; +#endif + Common::StringTokenizer tokenizer(extString, " "); while (!tokenizer.empty()) { Common::String token = tokenizer.nextToken(); if (token == "GL_ARB_texture_non_power_of_two") { g_context.NPOTSupported = true; +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + } else if (token == "GL_ARB_shader_objects") { + ARBShaderObjects = true; + } else if (token == "GL_ARB_shading_language_100") { + ARBShadingLanguage100 = true; + } else if (token == "GL_ARB_vertex_shader") { + ARBVertexShader = true; + } else if (token == "GL_ARB_fragment_shader") { + ARBFragmentShader = true; +#endif } } + +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + g_context.shadersSupported = ARBShaderObjects & ARBShadingLanguage100 & ARBVertexShader & ARBFragmentShader; +#endif } } // End of namespace OpenGL -- cgit v1.2.3 From 5752f125e1a0d334c3a5bfcea314c4ffceede640 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 21 Dec 2015 04:49:25 +0100 Subject: OPENGL: Make Context::reset explicitly reset state. --- backends/graphics/opengl/context.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 618be07a57..a58a5e060a 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -27,14 +27,15 @@ namespace OpenGL { -void Context::reset(bool full) { - // GLES supports least features, thus we initialize the context type - // to this on full reset. - const ContextType savedType = full ? kContextGLES : type; - - memset(this, 0, sizeof(Context)); +void Context::reset() { + NPOTSupported = false; +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + shadersSupported = false; +#endif - type = savedType; +#define GL_FUNC_DEF(ret, name, param) name = nullptr; +#include "backends/graphics/opengl/opengl-func.h" +#undef GL_FUNC_DEF } Context g_context; -- cgit v1.2.3 From c7c870bf7f269229d069d47c22b61c237737cdae Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 21 Dec 2015 05:05:37 +0100 Subject: OPENGL: (Partly) move context specific handling to Context. This does not include (most) shader setup, and projection matrices yet. --- backends/graphics/opengl/context.cpp | 103 +++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index a58a5e060a..905532c8be 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -22,6 +22,7 @@ #include "backends/graphics/opengl/opengl-sys.h" #include "backends/graphics/opengl/opengl-graphics.h" +#include "backends/graphics/opengl/shader.h" #include "common/tokenizer.h" @@ -38,6 +39,108 @@ void Context::reset() { #undef GL_FUNC_DEF } +void Context::initializePipeline() { +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (g_context.type != kContextGLES2) { +#endif +#if !USE_FORCED_GLES2 + GL_CALL(glDisable(GL_LIGHTING)); + GL_CALL(glDisable(GL_FOG)); + GL_CALL(glShadeModel(GL_FLAT)); + GL_CALL(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)); +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + } +#endif + +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (g_context.type == kContextGLES2) { +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES + GL_CALL(glEnableVertexAttribArray(kPositionAttribLocation)); + GL_CALL(glEnableVertexAttribArray(kTexCoordAttribLocation)); + + GL_CALL(glActiveTexture(GL_TEXTURE0)); +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + } else { +#endif +#if !USE_FORCED_GLES2 +#if !USE_FORCED_GLES + if (g_context.shadersSupported) { + GL_CALL(glEnableVertexAttribArrayARB(kPositionAttribLocation)); + GL_CALL(glEnableVertexAttribArrayARB(kTexCoordAttribLocation)); + } else { +#endif + // Enable rendering with vertex and coord arrays. + GL_CALL(glEnableClientState(GL_VERTEX_ARRAY)); + GL_CALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); +#if !USE_FORCED_GLES + } +#endif + + GL_CALL(glEnable(GL_TEXTURE_2D)); +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + } +#endif +} + +void Context::setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (g_context.type == kContextGLES2) { +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES + GL_CALL(glVertexAttrib4f(kColorAttribLocation, r, g, b, a)); +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + } else { +#endif +#if !USE_FORCED_GLES2 +#if !USE_FORCED_GLES + if (g_context.shadersSupported) { + GL_CALL(glVertexAttrib4fARB(kColorAttribLocation, r, g, b, a)); + } else { +#endif + GL_CALL(glColor4f(r, g, b, a)); +#if !USE_FORCED_GLES + } +#endif +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + } +#endif +} + +void Context::setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords) { +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (g_context.type == kContextGLES2) { +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES + GL_CALL(glVertexAttribPointer(kTexCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, texCoords)); + GL_CALL(glVertexAttribPointer(kPositionAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, vertices)); +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + } else { +#endif +#if !USE_FORCED_GLES2 +#if !USE_FORCED_GLES + if (g_context.shadersSupported) { + GL_CALL(glVertexAttribPointerARB(kTexCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, texCoords)); + GL_CALL(glVertexAttribPointerARB(kPositionAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, vertices)); + } else { +#endif + GL_CALL(glTexCoordPointer(2, GL_FLOAT, 0, texCoords)); + GL_CALL(glVertexPointer(2, GL_FLOAT, 0, vertices)); +#if !USE_FORCED_GLES + } +#endif +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + } +#endif +} + Context g_context; void OpenGLGraphicsManager::setContextType(ContextType type) { -- cgit v1.2.3 From fc52f730506422ac99e44cd74f229e6a0c5c2121 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 21 Dec 2015 05:47:29 +0100 Subject: OPENGL: Slightly cleanup programmable pipeline handling. --- backends/graphics/opengl/context.cpp | 107 +++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 49 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 905532c8be..2da4cab158 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -28,6 +28,16 @@ namespace OpenGL { +#if USE_FORCED_GL +#define HAS_SHADERS_CHECK shadersSupported +#elif USE_FORCED_GLES +#define HAS_SHADERS_CHECK false +#elif USE_FORCED_GLES2 +#define HAS_SHADERS_CHECK true +#else +#define HAS_SHADERS_CHECK (type == kContextGLES2 || shadersSupported) +#endif + void Context::reset() { NPOTSupported = false; #if !USE_FORCED_GLES && !USE_FORCED_GLES2 @@ -53,32 +63,35 @@ void Context::initializePipeline() { } #endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.type == kContextGLES2) { + // Enable rendering with vertex and coord arrays. +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (HAS_SHADERS_CHECK) { #endif -#if !USE_FORCED_GL && !USE_FORCED_GLES +#if !USE_FORCED_GLES GL_CALL(glEnableVertexAttribArray(kPositionAttribLocation)); GL_CALL(glEnableVertexAttribArray(kTexCoordAttribLocation)); +#endif +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + } else { +#endif +#if !USE_FORCED_GLES2 + GL_CALL(glEnableClientState(GL_VERTEX_ARRAY)); + GL_CALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); +#endif +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + } +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (g_context.type == kContextGLES2) { +#endif +#if !USE_FORCED_GL && !USE_FORCED_GLES GL_CALL(glActiveTexture(GL_TEXTURE0)); #endif #if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 } else { #endif #if !USE_FORCED_GLES2 -#if !USE_FORCED_GLES - if (g_context.shadersSupported) { - GL_CALL(glEnableVertexAttribArrayARB(kPositionAttribLocation)); - GL_CALL(glEnableVertexAttribArrayARB(kTexCoordAttribLocation)); - } else { -#endif - // Enable rendering with vertex and coord arrays. - GL_CALL(glEnableClientState(GL_VERTEX_ARRAY)); - GL_CALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); -#if !USE_FORCED_GLES - } -#endif - GL_CALL(glEnable(GL_TEXTURE_2D)); #endif #if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 @@ -87,56 +100,39 @@ void Context::initializePipeline() { } void Context::setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.type == kContextGLES2) { +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (HAS_SHADERS_CHECK) { #endif -#if !USE_FORCED_GL && !USE_FORCED_GLES +#if !USE_FORCED_GLES GL_CALL(glVertexAttrib4f(kColorAttribLocation, r, g, b, a)); #endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 } else { #endif #if !USE_FORCED_GLES2 -#if !USE_FORCED_GLES - if (g_context.shadersSupported) { - GL_CALL(glVertexAttrib4fARB(kColorAttribLocation, r, g, b, a)); - } else { -#endif - GL_CALL(glColor4f(r, g, b, a)); -#if !USE_FORCED_GLES - } + GL_CALL(glColor4f(r, g, b, a)); #endif -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 } #endif } void Context::setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords) { -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.type == kContextGLES2) { +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + if (HAS_SHADERS_CHECK) { #endif -#if !USE_FORCED_GL && !USE_FORCED_GLES +#if !USE_FORCED_GLES GL_CALL(glVertexAttribPointer(kTexCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, texCoords)); GL_CALL(glVertexAttribPointer(kPositionAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, vertices)); #endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 } else { #endif #if !USE_FORCED_GLES2 -#if !USE_FORCED_GLES - if (g_context.shadersSupported) { - GL_CALL(glVertexAttribPointerARB(kTexCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, texCoords)); - GL_CALL(glVertexAttribPointerARB(kPositionAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, vertices)); - } else { -#endif - GL_CALL(glTexCoordPointer(2, GL_FLOAT, 0, texCoords)); - GL_CALL(glVertexPointer(2, GL_FLOAT, 0, vertices)); -#if !USE_FORCED_GLES - } + GL_CALL(glTexCoordPointer(2, GL_FLOAT, 0, texCoords)); + GL_CALL(glVertexPointer(2, GL_FLOAT, 0, vertices)); #endif -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 } #endif } @@ -164,17 +160,30 @@ void OpenGLGraphicsManager::initializeGLContext() { // See backends/plugins/sdl/sdl-provider.cpp for more information. assert(sizeof(void (*)()) == sizeof(void *)); void *fn = nullptr; -#define GL_EXT_FUNC_DEF(ret, name, param) \ - fn = getProcAddress(#name); \ + +#define LOAD_FUNC(name, loadName) \ + fn = getProcAddress(#loadName); \ memcpy(&g_context.name, &fn, sizeof(fn)) + +#define GL_EXT_FUNC_DEF(ret, name, param) LOAD_FUNC(name, name) + #ifdef USE_BUILTIN_OPENGL #define GL_FUNC_DEF(ret, name, param) g_context.name = &name +#define GL_FUNC_2_DEF GL_FUNC_DEF #else #define GL_FUNC_DEF GL_EXT_FUNC_DEF +#define GL_FUNC_2_DEF(ret, name, extName, param) \ + if (g_context.type == kContextGL) { \ + LOAD_FUNC(name, extName); \ + } else { \ + LOAD_FUNC(name, name); \ + } #endif #include "backends/graphics/opengl/opengl-func.h" -#undef GL_EXT_FUNC_DEF +#undef GL_FUNC_2_DEF #undef GL_FUNC_DEF +#undef GL_EXT_FUNC_DEF +#undef LOAD_FUNC const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS); -- cgit v1.2.3 From 9844d89231de0fc2234199620390dbd057e79103 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 2 Jan 2016 02:20:28 +0100 Subject: OPENGL: Move max texture size information to Context. --- backends/graphics/opengl/context.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 2da4cab158..209c38e5f3 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -25,6 +25,7 @@ #include "backends/graphics/opengl/shader.h" #include "common/tokenizer.h" +#include "common/debug.h" namespace OpenGL { @@ -39,6 +40,8 @@ namespace OpenGL { #endif void Context::reset() { + _maxTextureSize = 0; + NPOTSupported = false; #if !USE_FORCED_GLES && !USE_FORCED_GLES2 shadersSupported = false; @@ -185,6 +188,10 @@ void OpenGLGraphicsManager::initializeGLContext() { #undef GL_EXT_FUNC_DEF #undef LOAD_FUNC + // Obtain maximum texture size. + GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_context._maxTextureSize)); + debug(5, "OpenGL maximum texture size: %d", g_context._maxTextureSize); + const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS); #if !USE_FORCED_GLES && !USE_FORCED_GLES2 -- cgit v1.2.3 From e66e9e44d358b0cc90d128c31e695a8ace4177fa Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 2 Jan 2016 14:09:41 +0100 Subject: OPENGL: Accelerate palette lookups with shaders. This currently is limited to GL contexts. --- backends/graphics/opengl/context.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 209c38e5f3..10468f3700 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -45,6 +45,9 @@ void Context::reset() { NPOTSupported = false; #if !USE_FORCED_GLES && !USE_FORCED_GLES2 shadersSupported = false; + multitextureSupported = false; + framebufferObjectSupported = false; + textureRGSupported = false; #endif #define GL_FUNC_DEF(ret, name, param) name = nullptr; @@ -216,6 +219,12 @@ void OpenGLGraphicsManager::initializeGLContext() { ARBVertexShader = true; } else if (token == "GL_ARB_fragment_shader") { ARBFragmentShader = true; + } else if (token == "GL_ARB_multitexture") { + g_context.multitextureSupported = true; + } else if (token == "GL_ARB_texture_rg") { + g_context.textureRGSupported = true; + } else if (token == "GL_EXT_framebuffer_object") { + g_context.framebufferObjectSupported = true; #endif } } -- cgit v1.2.3 From 397ce9b9477f9ed42e73be6c1f997e5d77fef672 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jan 2016 12:29:14 +0100 Subject: OPENGL: Keep feature state for all contexts and log them. --- backends/graphics/opengl/context.cpp | 43 ++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 10468f3700..4dbd16f6b3 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -43,12 +43,10 @@ void Context::reset() { _maxTextureSize = 0; NPOTSupported = false; -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 shadersSupported = false; multitextureSupported = false; framebufferObjectSupported = false; textureRGSupported = false; -#endif #define GL_FUNC_DEF(ret, name, param) name = nullptr; #include "backends/graphics/opengl/opengl-func.h" @@ -197,12 +195,10 @@ void OpenGLGraphicsManager::initializeGLContext() { const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS); -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 bool ARBShaderObjects = false; bool ARBShadingLanguage100 = false; bool ARBVertexShader = false; bool ARBFragmentShader = false; -#endif Common::StringTokenizer tokenizer(extString, " "); while (!tokenizer.empty()) { @@ -210,7 +206,6 @@ void OpenGLGraphicsManager::initializeGLContext() { if (token == "GL_ARB_texture_non_power_of_two") { g_context.NPOTSupported = true; -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 } else if (token == "GL_ARB_shader_objects") { ARBShaderObjects = true; } else if (token == "GL_ARB_shading_language_100") { @@ -225,13 +220,43 @@ void OpenGLGraphicsManager::initializeGLContext() { g_context.textureRGSupported = true; } else if (token == "GL_EXT_framebuffer_object") { g_context.framebufferObjectSupported = true; -#endif } } -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - g_context.shadersSupported = ARBShaderObjects & ARBShadingLanguage100 & ARBVertexShader & ARBFragmentShader; -#endif + if (g_context.type == kContextGLES2) { + // GLES2 always has shader support. + g_context.shadersSupported = true; + + // GLES2 always has multi texture support. + g_context.multitextureSupported = true; + + // GLES2 always has FBO support. + g_context.framebufferObjectSupported = true; + } else { + g_context.shadersSupported = ARBShaderObjects & ARBShadingLanguage100 & ARBVertexShader & ARBFragmentShader; + } + + // Log context type. + switch (g_context.type) { + case kContextGL: + debug(5, "OpenGL: GL context initialized"); + break; + + case kContextGLES: + debug(5, "OpenGL: GLES context initialized"); + break; + + case kContextGLES2: + debug(5, "OpenGL: GLES2 context initialized"); + break; + } + + // Log features supported by GL context. + debug(5, "OpenGL: NPOT texture support: %d", g_context.NPOTSupported); + debug(5, "OpenGL: Shader support: %d", g_context.shadersSupported); + debug(5, "OpenGL: Multitexture support: %d", g_context.multitextureSupported); + debug(5, "OpenGL: Texture RG support: %d", g_context.textureRGSupported); + debug(5, "OpenGL: FBO support: %d", g_context.framebufferObjectSupported); } } // End of namespace OpenGL -- cgit v1.2.3 From 18306ee20602e79a2af4556658dc0f141a4ad78f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jan 2016 12:50:51 +0100 Subject: OPENGL: Simplify shader support checks. --- backends/graphics/opengl/context.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 4dbd16f6b3..478d98c19a 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -29,16 +29,6 @@ namespace OpenGL { -#if USE_FORCED_GL -#define HAS_SHADERS_CHECK shadersSupported -#elif USE_FORCED_GLES -#define HAS_SHADERS_CHECK false -#elif USE_FORCED_GLES2 -#define HAS_SHADERS_CHECK true -#else -#define HAS_SHADERS_CHECK (type == kContextGLES2 || shadersSupported) -#endif - void Context::reset() { _maxTextureSize = 0; @@ -69,7 +59,7 @@ void Context::initializePipeline() { // Enable rendering with vertex and coord arrays. #if !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (HAS_SHADERS_CHECK) { + if (g_context.shadersSupported) { #endif #if !USE_FORCED_GLES GL_CALL(glEnableVertexAttribArray(kPositionAttribLocation)); @@ -105,7 +95,7 @@ void Context::initializePipeline() { void Context::setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { #if !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (HAS_SHADERS_CHECK) { + if (g_context.shadersSupported) { #endif #if !USE_FORCED_GLES GL_CALL(glVertexAttrib4f(kColorAttribLocation, r, g, b, a)); @@ -123,7 +113,7 @@ void Context::setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { void Context::setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords) { #if !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (HAS_SHADERS_CHECK) { + if (g_context.shadersSupported) { #endif #if !USE_FORCED_GLES GL_CALL(glVertexAttribPointer(kTexCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, texCoords)); -- cgit v1.2.3 From bf2735cd53f13d22cf4e6013a251896a3d411b97 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jan 2016 13:54:21 +0100 Subject: OPENGL: Detect NPOT support for GLES. For GLES1+ there exists GL_OES_texture_npot, which indicates that there is NPOT support. GLES2 always had (limited) NPOT support, which is all we require, thus we always enable it. --- backends/graphics/opengl/context.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 478d98c19a..c149b12f19 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -194,7 +194,7 @@ void OpenGLGraphicsManager::initializeGLContext() { while (!tokenizer.empty()) { Common::String token = tokenizer.nextToken(); - if (token == "GL_ARB_texture_non_power_of_two") { + if (token == "GL_ARB_texture_non_power_of_two" || token == "GL_OES_texture_npot") { g_context.NPOTSupported = true; } else if (token == "GL_ARB_shader_objects") { ARBShaderObjects = true; @@ -214,6 +214,9 @@ void OpenGLGraphicsManager::initializeGLContext() { } if (g_context.type == kContextGLES2) { + // GLES2 always has (limited) NPOT support. + g_context.NPOTSupported = true; + // GLES2 always has shader support. g_context.shadersSupported = true; -- cgit v1.2.3 From 08553a09cfa2110d56b200bf6c69d01d5adbc6bb Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jan 2016 14:06:02 +0100 Subject: OPENGL: Support GLSL based CLUT8 look up for GLES2+. --- backends/graphics/opengl/context.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index c149b12f19..89f0ed7910 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -36,7 +36,6 @@ void Context::reset() { shadersSupported = false; multitextureSupported = false; framebufferObjectSupported = false; - textureRGSupported = false; #define GL_FUNC_DEF(ret, name, param) name = nullptr; #include "backends/graphics/opengl/opengl-func.h" @@ -206,8 +205,6 @@ void OpenGLGraphicsManager::initializeGLContext() { ARBFragmentShader = true; } else if (token == "GL_ARB_multitexture") { g_context.multitextureSupported = true; - } else if (token == "GL_ARB_texture_rg") { - g_context.textureRGSupported = true; } else if (token == "GL_EXT_framebuffer_object") { g_context.framebufferObjectSupported = true; } @@ -248,7 +245,6 @@ void OpenGLGraphicsManager::initializeGLContext() { debug(5, "OpenGL: NPOT texture support: %d", g_context.NPOTSupported); debug(5, "OpenGL: Shader support: %d", g_context.shadersSupported); debug(5, "OpenGL: Multitexture support: %d", g_context.multitextureSupported); - debug(5, "OpenGL: Texture RG support: %d", g_context.textureRGSupported); debug(5, "OpenGL: FBO support: %d", g_context.framebufferObjectSupported); } -- cgit v1.2.3 From f5f1b6eba0d409abcda2a3c037a177d6f6e41a2e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 4 Jan 2016 06:41:10 +0100 Subject: OPENGL: Introduce pipeline abstraction to cleanup code. --- backends/graphics/opengl/context.cpp | 92 ++++-------------------------------- 1 file changed, 9 insertions(+), 83 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 89f0ed7910..7402e79ea5 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -23,6 +23,7 @@ #include "backends/graphics/opengl/opengl-sys.h" #include "backends/graphics/opengl/opengl-graphics.h" #include "backends/graphics/opengl/shader.h" +#include "backends/graphics/opengl/pipeline.h" #include "common/tokenizer.h" #include "common/debug.h" @@ -40,94 +41,19 @@ void Context::reset() { #define GL_FUNC_DEF(ret, name, param) name = nullptr; #include "backends/graphics/opengl/opengl-func.h" #undef GL_FUNC_DEF -} - -void Context::initializePipeline() { -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.type != kContextGLES2) { -#endif -#if !USE_FORCED_GLES2 - GL_CALL(glDisable(GL_LIGHTING)); - GL_CALL(glDisable(GL_FOG)); - GL_CALL(glShadeModel(GL_FLAT)); - GL_CALL(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)); -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - } -#endif - // Enable rendering with vertex and coord arrays. -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.shadersSupported) { -#endif -#if !USE_FORCED_GLES - GL_CALL(glEnableVertexAttribArray(kPositionAttribLocation)); - GL_CALL(glEnableVertexAttribArray(kTexCoordAttribLocation)); -#endif -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - } else { -#endif -#if !USE_FORCED_GLES2 - GL_CALL(glEnableClientState(GL_VERTEX_ARRAY)); - GL_CALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); -#endif -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - } -#endif - -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.type == kContextGLES2) { -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES - GL_CALL(glActiveTexture(GL_TEXTURE0)); -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - } else { -#endif -#if !USE_FORCED_GLES2 - GL_CALL(glEnable(GL_TEXTURE_2D)); -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - } -#endif + activePipeline = nullptr; } -void Context::setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.shadersSupported) { -#endif -#if !USE_FORCED_GLES - GL_CALL(glVertexAttrib4f(kColorAttribLocation, r, g, b, a)); -#endif -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - } else { -#endif -#if !USE_FORCED_GLES2 - GL_CALL(glColor4f(r, g, b, a)); -#endif -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - } -#endif -} +Pipeline *Context::setPipeline(Pipeline *pipeline) { + Pipeline *oldPipeline = activePipeline; -void Context::setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords) { -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (g_context.shadersSupported) { -#endif -#if !USE_FORCED_GLES - GL_CALL(glVertexAttribPointer(kTexCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, texCoords)); - GL_CALL(glVertexAttribPointer(kPositionAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, vertices)); -#endif -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 - } else { -#endif -#if !USE_FORCED_GLES2 - GL_CALL(glTexCoordPointer(2, GL_FLOAT, 0, texCoords)); - GL_CALL(glVertexPointer(2, GL_FLOAT, 0, vertices)); -#endif -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 + activePipeline = pipeline; + if (activePipeline) { + activePipeline->activate(); } -#endif + + return oldPipeline; } Context g_context; -- cgit v1.2.3 From c4e65732befdfb675111387c3c7edb616bf2f976 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 4 Jan 2016 10:18:15 +0100 Subject: OPENGL: Introduce abstraction for framebuffer. This allows us to use various framebuffer settings easily. Now the GPU accelerated CLUT8 surface implementation does not need to query former framebuffer state anymore. --- backends/graphics/opengl/context.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 7402e79ea5..d9c40859dc 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -24,6 +24,7 @@ #include "backends/graphics/opengl/opengl-graphics.h" #include "backends/graphics/opengl/shader.h" #include "backends/graphics/opengl/pipeline.h" +#include "backends/graphics/opengl/framebuffer.h" #include "common/tokenizer.h" #include "common/debug.h" @@ -42,9 +43,24 @@ void Context::reset() { #include "backends/graphics/opengl/opengl-func.h" #undef GL_FUNC_DEF + activeFramebuffer = nullptr; activePipeline = nullptr; } +Framebuffer *Context::setFramebuffer(Framebuffer *framebuffer) { + Framebuffer *oldFramebuffer = activeFramebuffer; + if (oldFramebuffer) { + oldFramebuffer->deactivate(); + } + + activeFramebuffer = framebuffer; + if (activeFramebuffer) { + activeFramebuffer->activate(); + } + + return oldFramebuffer; +} + Pipeline *Context::setPipeline(Pipeline *pipeline) { Pipeline *oldPipeline = activePipeline; -- cgit v1.2.3 From 0b46af2f0e5eef939daa73d5b38b6b817c78c7d8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 4 Jan 2016 11:00:58 +0100 Subject: OPENGL: Don't prefix maxTextureSize variable for consistency. --- backends/graphics/opengl/context.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index d9c40859dc..3678abfd09 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -32,7 +32,7 @@ namespace OpenGL { void Context::reset() { - _maxTextureSize = 0; + maxTextureSize = 0; NPOTSupported = false; shadersSupported = false; @@ -121,8 +121,8 @@ void OpenGLGraphicsManager::initializeGLContext() { #undef LOAD_FUNC // Obtain maximum texture size. - GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_context._maxTextureSize)); - debug(5, "OpenGL maximum texture size: %d", g_context._maxTextureSize); + GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_context.maxTextureSize)); + debug(5, "OpenGL maximum texture size: %d", g_context.maxTextureSize); const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS); -- cgit v1.2.3 From 0fe580d10c6fb73a90eccb046c8dcbf84b062b16 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 4 Jan 2016 11:38:21 +0100 Subject: OPENGL: Make shader/framebuffer part of pipeline state. --- backends/graphics/opengl/context.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 3678abfd09..09da353918 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -43,24 +43,9 @@ void Context::reset() { #include "backends/graphics/opengl/opengl-func.h" #undef GL_FUNC_DEF - activeFramebuffer = nullptr; activePipeline = nullptr; } -Framebuffer *Context::setFramebuffer(Framebuffer *framebuffer) { - Framebuffer *oldFramebuffer = activeFramebuffer; - if (oldFramebuffer) { - oldFramebuffer->deactivate(); - } - - activeFramebuffer = framebuffer; - if (activeFramebuffer) { - activeFramebuffer->activate(); - } - - return oldFramebuffer; -} - Pipeline *Context::setPipeline(Pipeline *pipeline) { Pipeline *oldPipeline = activePipeline; -- cgit v1.2.3 From 8a4938f82b05b86c8f0ed010210eb6d1847c04c9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 28 Feb 2016 18:15:00 +0100 Subject: OPENGL: Move pipeline code to pipelines/. --- backends/graphics/opengl/context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 09da353918..d93ecdc517 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -23,7 +23,7 @@ #include "backends/graphics/opengl/opengl-sys.h" #include "backends/graphics/opengl/opengl-graphics.h" #include "backends/graphics/opengl/shader.h" -#include "backends/graphics/opengl/pipeline.h" +#include "backends/graphics/opengl/pipelines/pipeline.h" #include "backends/graphics/opengl/framebuffer.h" #include "common/tokenizer.h" -- cgit v1.2.3 From 8b80e9d36c0705adfcd1af88c16397f2aa01afb8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 2 Mar 2016 14:28:44 +0100 Subject: OPENGL: Properly deactivate old pipeline. --- backends/graphics/opengl/context.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index d93ecdc517..55abdf7dfd 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -48,6 +48,9 @@ void Context::reset() { Pipeline *Context::setPipeline(Pipeline *pipeline) { Pipeline *oldPipeline = activePipeline; + if (oldPipeline) { + oldPipeline->deactivate(); + } activePipeline = pipeline; if (activePipeline) { -- cgit v1.2.3 From 6b2424b6353ca5712afdf80e128a912a3cf78f0c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 16 Mar 2016 21:03:43 +0100 Subject: OPENGL: Log extensions available on debuglevel 5+. --- backends/graphics/opengl/context.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'backends/graphics/opengl/context.cpp') diff --git a/backends/graphics/opengl/context.cpp b/backends/graphics/opengl/context.cpp index 55abdf7dfd..a7f640d37e 100644 --- a/backends/graphics/opengl/context.cpp +++ b/backends/graphics/opengl/context.cpp @@ -113,6 +113,7 @@ void OpenGLGraphicsManager::initializeGLContext() { debug(5, "OpenGL maximum texture size: %d", g_context.maxTextureSize); const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS); + debug(5, "OpenGL extensions: %s", extString); bool ARBShaderObjects = false; bool ARBShadingLanguage100 = false; -- cgit v1.2.3