diff options
author | Johannes Schickel | 2016-01-04 11:38:21 +0100 |
---|---|---|
committer | Johannes Schickel | 2016-03-16 20:29:27 +0100 |
commit | 0fe580d10c6fb73a90eccb046c8dcbf84b062b16 (patch) | |
tree | 374a7e245e5b39caa120de0ae9c4e3d19dba60ee /backends/graphics/opengl/opengl-graphics.cpp | |
parent | 0b46af2f0e5eef939daa73d5b38b6b817c78c7d8 (diff) | |
download | scummvm-rg350-0fe580d10c6fb73a90eccb046c8dcbf84b062b16.tar.gz scummvm-rg350-0fe580d10c6fb73a90eccb046c8dcbf84b062b16.tar.bz2 scummvm-rg350-0fe580d10c6fb73a90eccb046c8dcbf84b062b16.zip |
OPENGL: Make shader/framebuffer part of pipeline state.
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 8832597f33..e32753ee3e 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -763,26 +763,6 @@ void OpenGLGraphicsManager::setActualScreenSize(uint width, uint height) { // Setup backbuffer size. _backBuffer.setDimensions(width, height); -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - if (!g_context.shadersSupported) { -#endif -#if !USE_FORCED_GLES2 - GL_CALL(glMatrixMode(GL_PROJECTION)); - GL_CALL(glLoadMatrixf(_backBuffer.getProjectionMatrix())); - - GL_CALL(glMatrixMode(GL_MODELVIEW)); - GL_CALL(glLoadIdentity()); -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - } else { -#endif -#if !USE_FORCED_GLES - ShaderMan.query(ShaderManager::kDefault)->activate(_backBuffer.getProjectionMatrix()); -#endif -#if !USE_FORCED_GL && !USE_FORCED_GLES && !USE_FORCED_GLES2 - } -#endif - uint overlayWidth = width; uint overlayHeight = height; @@ -872,6 +852,14 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def g_context.setPipeline(_pipeline); +#if !USE_FORCED_GLES + if (g_context.shadersSupported) { + ShaderMan.notifyCreate(); + + g_context.activePipeline->setShader(ShaderMan.query(ShaderManager::kDefault)); + } +#endif + // Disable 3D properties. GL_CALL(glDisable(GL_CULL_FACE)); GL_CALL(glDisable(GL_DEPTH_TEST)); @@ -890,7 +878,7 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def // Setup scissor state accordingly. _backBuffer.enableScissorTest(!_overlayVisible); - g_context.setFramebuffer(&_backBuffer); + g_context.activePipeline->setFramebuffer(&_backBuffer); // Clear the whole screen for the first three frames to assure any // leftovers are cleared. @@ -901,13 +889,6 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def // code and that requires the same alignment too. GL_CALL(glPixelStorei(GL_PACK_ALIGNMENT, 4)); -#if !USE_FORCED_GLES - if (g_context.shadersSupported) { - ShaderMan.notifyCreate(); - ShaderMan.query(ShaderManager::kDefault)->activate(_backBuffer.getProjectionMatrix()); - } -#endif - // Refresh the output screen dimensions if some are set up. if (_outputScreenWidth != 0 && _outputScreenHeight != 0) { setActualScreenSize(_outputScreenWidth, _outputScreenHeight); @@ -963,9 +944,6 @@ void OpenGLGraphicsManager::notifyContextDestroy() { } #endif - // Unset back buffer. - g_context.setFramebuffer(nullptr); - // Destroy rendering pipeline. g_context.setPipeline(nullptr); delete _pipeline; |