aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics
diff options
context:
space:
mode:
authorJohannes Schickel2016-01-03 12:50:51 +0100
committerJohannes Schickel2016-03-16 20:29:26 +0100
commit18306ee20602e79a2af4556658dc0f141a4ad78f (patch)
tree21783e4a4cdb07b8aadb0326c82e81da164e29fd /backends/graphics
parent397ce9b9477f9ed42e73be6c1f997e5d77fef672 (diff)
downloadscummvm-rg350-18306ee20602e79a2af4556658dc0f141a4ad78f.tar.gz
scummvm-rg350-18306ee20602e79a2af4556658dc0f141a4ad78f.tar.bz2
scummvm-rg350-18306ee20602e79a2af4556658dc0f141a4ad78f.zip
OPENGL: Simplify shader support checks.
Diffstat (limited to 'backends/graphics')
-rw-r--r--backends/graphics/opengl/context.cpp16
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp19
2 files changed, 5 insertions, 30 deletions
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));
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 7f4fcf73bb..d9c9377e51 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -773,8 +773,7 @@ void OpenGLGraphicsManager::setActualScreenSize(uint width, uint height) {
};
#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2
- if (g_context.type == kContextGLES
- || (g_context.type == kContextGL && !g_context.shadersSupported)) {
+ if (!g_context.shadersSupported) {
#endif
#if !USE_FORCED_GLES2
GL_CALL(glMatrixMode(GL_PROJECTION));
@@ -901,23 +900,9 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def
#if !USE_FORCED_GLES
if (!_shader) {
-#if !USE_FORCED_GL && !USE_FORCED_GLES2
- if (g_context.type == kContextGLES2) {
-#endif
-#if !USE_FORCED_GL
+ if (g_context.shadersSupported) {
_shader = new Shader(g_defaultVertexShader, g_defaultFragmentShader);
-#endif
-#if !USE_FORCED_GL && !USE_FORCED_GLES2
- } else {
-#endif
-#if !USE_FORCED_GLES2
- if (g_context.shadersSupported) {
- _shader = new Shader(g_defaultVertexShader, g_defaultFragmentShader);
- }
-#endif
-#if !USE_FORCED_GL && !USE_FORCED_GLES2
}
-#endif
}
#endif