[Scummvm-git-logs] scummvm master -> f00b6fc1954cf125312049726f2543fbc047af7b
aquadran
aquadran at gmail.com
Sat Jan 2 07:05:31 UTC 2021
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:
f00b6fc195 SDL: Remove the Capabilities structure
Commit: f00b6fc1954cf125312049726f2543fbc047af7b
https://github.com/scummvm/scummvm/commit/f00b6fc1954cf125312049726f2543fbc047af7b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-01-02T08:05:27+01:00
Commit Message:
SDL: Remove the Capabilities structure
Changed paths:
backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
backends/graphics3d/openglsdl/openglsdl-graphics3d.h
backends/platform/sdl/sdl.cpp
backends/platform/sdl/sdl.h
diff --git a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
index 2f7f820e25..7ba75a991b 100644
--- a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
+++ b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
@@ -44,12 +44,12 @@
#include "image/bmp.h"
#endif
-OpenGLSdlGraphics3dManager::OpenGLSdlGraphics3dManager(SdlEventSource *eventSource, SdlWindow *window, const Capabilities &capabilities)
+OpenGLSdlGraphics3dManager::OpenGLSdlGraphics3dManager(SdlEventSource *eventSource, SdlWindow *window, bool supportsFrameBuffer)
: SdlGraphics3dManager(eventSource, window),
#if SDL_VERSION_ATLEAST(2, 0, 0)
_glContext(nullptr),
#endif
- _capabilities(capabilities),
+ _supportsFrameBuffer(supportsFrameBuffer),
_overlayVisible(false),
_overlayScreen(nullptr),
_overlayBackground(nullptr),
@@ -504,7 +504,7 @@ bool OpenGLSdlGraphics3dManager::createOrUpdateGLContext(uint gameWidth, uint ga
bool OpenGLSdlGraphics3dManager::shouldRenderToFramebuffer() const {
bool engineSupportsArbitraryResolutions = !g_engine || g_engine->hasFeature(Engine::kSupportsArbitraryResolutions);
- return !engineSupportsArbitraryResolutions && _capabilities.openGLFrameBuffer;
+ return !engineSupportsArbitraryResolutions && _supportsFrameBuffer;
}
bool OpenGLSdlGraphics3dManager::isVSyncEnabled() const {
diff --git a/backends/graphics3d/openglsdl/openglsdl-graphics3d.h b/backends/graphics3d/openglsdl/openglsdl-graphics3d.h
index 1c5977c20d..608344e575 100644
--- a/backends/graphics3d/openglsdl/openglsdl-graphics3d.h
+++ b/backends/graphics3d/openglsdl/openglsdl-graphics3d.h
@@ -41,22 +41,7 @@ namespace OpenGL {
*/
class OpenGLSdlGraphics3dManager : public SdlGraphics3dManager {
public:
- /**
- * Capabilities of the current device
- */
- struct Capabilities {
- /**
- * Is the device capable of rendering to OpenGL framebuffers
- */
- bool openGLFrameBuffer;
-
- /** Supported levels of MSAA when using the OpenGL renderers */
- Common::Array<uint> openGLAntiAliasLevels;
-
- Capabilities() : openGLFrameBuffer(false) {}
- };
-
- OpenGLSdlGraphics3dManager(SdlEventSource *eventSource, SdlWindow *window, const Capabilities &capabilities);
+ OpenGLSdlGraphics3dManager(SdlEventSource *eventSource, SdlWindow *window, bool supportsFrameBuffer);
virtual ~OpenGLSdlGraphics3dManager();
// GraphicsManager API - Features
@@ -109,7 +94,7 @@ protected:
void deinitializeRenderer();
#endif
- const Capabilities &_capabilities;
+ bool _supportsFrameBuffer;
Math::Rect2d _gameRect;
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index efa1458730..31d87bf423 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -306,10 +306,10 @@ void OSystem_SDL::initBackend() {
#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
void OSystem_SDL::detectFramebufferSupport() {
- _capabilities.openGLFrameBuffer = false;
+ _supportsFrameBuffer = false;
#if defined(USE_GLES2)
// Framebuffers are always available with GLES2
- _capabilities.openGLFrameBuffer = true;
+ _supportsFrameBuffer = true;
#elif !defined(AMIGAOS)
// Spawn a 32x32 window off-screen with a GL context to test if framebuffers are supported
#if SDL_VERSION_ATLEAST(2, 0, 0)
@@ -318,7 +318,7 @@ void OSystem_SDL::detectFramebufferSupport() {
SDL_GLContext glContext = SDL_GL_CreateContext(window);
if (glContext) {
OpenGLContext.initialize(OpenGL::kOGLContextGL);
- _capabilities.openGLFrameBuffer = OpenGLContext.framebufferObjectSupported;
+ _supportsFrameBuffer = OpenGLContext.framebufferObjectSupported;
OpenGLContext.reset();
SDL_GL_DeleteContext(glContext);
}
@@ -329,7 +329,7 @@ void OSystem_SDL::detectFramebufferSupport() {
SDL_SetVideoMode(32, 32, 0, SDL_OPENGL);
SDL_putenv(const_cast<char *>("SDL_VIDEO_WINDOW_POS=center"));
OpenGLContext.initialize(OpenGL::kOGLContextGL);
- _capabilities.openGLFrameBuffer = OpenGLContext.framebufferObjectSupported;
+ _supportsFrameBuffer = OpenGLContext.framebufferObjectSupported;
OpenGLContext.reset();
#endif
#endif
@@ -337,7 +337,7 @@ void OSystem_SDL::detectFramebufferSupport() {
void OSystem_SDL::detectAntiAliasingSupport() {
#ifndef NINTENDO_SWITCH
- _capabilities.openGLAntiAliasLevels.clear();
+ _antiAliasLevels.clear();
int requestedSamples = 2;
while (requestedSamples <= 32) {
@@ -353,7 +353,7 @@ void OSystem_SDL::detectAntiAliasingSupport() {
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &actualSamples);
if (actualSamples == requestedSamples) {
- _capabilities.openGLAntiAliasLevels.push_back(requestedSamples);
+ _antiAliasLevels.push_back(requestedSamples);
}
SDL_GL_DeleteContext(glContext);
@@ -370,7 +370,7 @@ void OSystem_SDL::detectAntiAliasingSupport() {
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &actualSamples);
if (actualSamples == requestedSamples) {
- _capabilities.openGLAntiAliasLevels.push_back(requestedSamples);
+ _antiAliasLevels.push_back(requestedSamples);
}
#endif
@@ -477,7 +477,7 @@ void OSystem_SDL::setWindowCaption(const Common::U32String &caption) {
#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
Common::Array<uint> OSystem_SDL::getSupportedAntiAliasingLevels() const {
- return _capabilities.openGLAntiAliasLevels;
+ return _antiAliasLevels;
}
#endif
@@ -777,7 +777,7 @@ bool OSystem_SDL::setGraphicsMode(int mode, uint flags) {
sdlGraphics3dManager->deactivateManager();
delete sdlGraphics3dManager;
}
- _graphicsManager = sdlGraphics3dManager = new OpenGLSdlGraphics3dManager(_eventSource, _window, _capabilities);
+ _graphicsManager = sdlGraphics3dManager = new OpenGLSdlGraphics3dManager(_eventSource, _window, _supportsFrameBuffer);
switchedManager = true;
}
#endif
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 3460230cfb..125d26f89d 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -36,9 +36,6 @@
#ifdef USE_DISCORD
class DiscordPresence;
#endif
-#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
-#include "backends/graphics3d/openglsdl/openglsdl-graphics3d.h"
-#endif
/**
* Base OSystem class for all SDL ports.
@@ -132,7 +129,9 @@ protected:
// Graphics capabilities
void detectFramebufferSupport();
void detectAntiAliasingSupport();
- OpenGLSdlGraphics3dManager::Capabilities _capabilities;
+
+ bool _supportsFrameBuffer;
+ Common::Array<uint> _antiAliasLevels;
#endif
/**
More information about the Scummvm-git-logs
mailing list