aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl
diff options
context:
space:
mode:
authorCameron Cawley2019-06-21 16:12:23 +0100
committerFilippos Karapetis2019-06-22 01:15:39 +0300
commit0ddfe927cec767631161a23d55b9c07fff925745 (patch)
tree0d4cfb762a1b3358da3824df465eb6d1ac3d2ed4 /backends/graphics/opengl
parent6d2da5c6f1c3ecebe73d070637b912edbf486ffd (diff)
downloadscummvm-rg350-0ddfe927cec767631161a23d55b9c07fff925745.tar.gz
scummvm-rg350-0ddfe927cec767631161a23d55b9c07fff925745.tar.bz2
scummvm-rg350-0ddfe927cec767631161a23d55b9c07fff925745.zip
OPENGLSDL: Move getSupportedFormats into OpenGLGraphicsManager
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp48
-rw-r--r--backends/graphics/opengl/opengl-graphics.h2
2 files changed, 49 insertions, 1 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 6eb961a9d4..c603070751 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -184,6 +184,54 @@ int OpenGLGraphicsManager::getGraphicsMode() const {
Graphics::PixelFormat OpenGLGraphicsManager::getScreenFormat() const {
return _currentState.gameFormat;
}
+
+Common::List<Graphics::PixelFormat> OpenGLGraphicsManager::getSupportedFormats() const {
+ Common::List<Graphics::PixelFormat> formats;
+
+ // Our default mode is (memory layout wise) RGBA8888 which is a different
+ // logical layout depending on the endianness. We chose this mode because
+ // it is the only 32bit color mode we can safely assume to be present in
+ // OpenGL and OpenGL ES implementations. Thus, we need to supply different
+ // logical formats based on endianness.
+#ifdef SCUMM_LITTLE_ENDIAN
+ // ABGR8888
+ formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
+#else
+ // RGBA8888
+ formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+#endif
+ // RGB565
+ formats.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+ // RGBA5551
+ formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
+ // RGBA4444
+ formats.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0));
+
+#if !USE_FORCED_GLES && !USE_FORCED_GLES2
+#if !USE_FORCED_GL
+ if (!isGLESContext()) {
+#endif
+#ifdef SCUMM_LITTLE_ENDIAN
+ // RGBA8888
+ formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+#else
+ // ABGR8888
+ formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
+#endif
+#if !USE_FORCED_GL
+ }
+#endif
+#endif
+
+ // RGB555, this is used by SCUMM HE 16 bit games.
+ // This is not natively supported by OpenGL ES implementations, we convert
+ // the pixel format internally.
+ formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
+
+ formats.push_back(Graphics::PixelFormat::createFormatCLUT8());
+
+ return formats;
+}
#endif
void OpenGLGraphicsManager::beginGFXTransaction() {
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index df968aa67e..2e1df99534 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -72,7 +72,7 @@ public:
#ifdef USE_RGB_COLOR
virtual Graphics::PixelFormat getScreenFormat() const override;
- virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const override = 0;
+ virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const override;
#endif
virtual void beginGFXTransaction() override;