[Scummvm-git-logs] scummvm master -> 252d9f20e32c48793c8900f90e8f1b16914f472e

lephilousophe noreply at scummvm.org
Sat Sep 24 07:14:13 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
252d9f20e3 OPENGL: Fix crash in forced GLES2 mode


Commit: 252d9f20e32c48793c8900f90e8f1b16914f472e
    https://github.com/scummvm/scummvm/commit/252d9f20e32c48793c8900f90e8f1b16914f472e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-09-24T09:14:08+02:00

Commit Message:
OPENGL: Fix crash in forced GLES2 mode

Changed paths:
    backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp


diff --git a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
index 67aedfd16d9..ebaf7ae5aa0 100644
--- a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
+++ b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
@@ -390,7 +390,6 @@ void OpenGLSdlGraphics3dManager::createOrUpdateScreen() {
 	int obtainedHeight = effectiveHeight;
 #endif
 
-	initializeOpenGLContext();
 	_surfaceRenderer = OpenGL::createBestSurfaceRenderer();
 	_overlayFormat = OpenGL::TextureGL::getRGBAPixelFormat();
 
@@ -487,6 +486,8 @@ bool OpenGLSdlGraphics3dManager::createOrUpdateGLContext(uint gameWidth, uint ga
 	pixelFormats.push_back(OpenGLPixelFormat(16, 5, 5, 5, 1, 0));
 	pixelFormats.push_back(OpenGLPixelFormat(16, 5, 6, 5, 0, 0));
 
+	bool clear = false;
+
 	// Unfortunately, SDL does not provide a list of valid pixel formats
 	// for the current OpenGL implementation and hardware.
 	// SDL may not be able to create a screen with the preferred pixel format.
@@ -546,7 +547,7 @@ bool OpenGLSdlGraphics3dManager::createOrUpdateGLContext(uint gameWidth, uint ga
 			if (!_glContext) {
 				_glContext = SDL_GL_CreateContext(_window->getSDLWindow());
 				if (_glContext) {
-					glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+					clear = true;
 				}
 			}
 
@@ -581,7 +582,15 @@ bool OpenGLSdlGraphics3dManager::createOrUpdateGLContext(uint gameWidth, uint ga
 		        wantsAA && !gotAA ? " without AA" : "");
 	}
 
-	return it != pixelFormats.end();
+	if (it == pixelFormats.end())
+		return false;
+
+	initializeOpenGLContext();
+
+	if (clear)
+		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+
+	return true;
 }
 
 bool OpenGLSdlGraphics3dManager::shouldRenderToFramebuffer() const {




More information about the Scummvm-git-logs mailing list