diff options
author | Johannes Schickel | 2014-02-12 18:06:29 +0100 |
---|---|---|
committer | Johannes Schickel | 2014-02-12 18:06:29 +0100 |
commit | 5883f4cc3fe5861c314afedb00c692f31f1a1124 (patch) | |
tree | 1b3305a940d4fa8bde4b8bfd1ec59a885271fa99 /backends/graphics/openglsdl/openglsdl-graphics.cpp | |
parent | 5d78542ab8c6a76e266a453b8590bf6bbd70b631 (diff) | |
download | scummvm-rg350-5883f4cc3fe5861c314afedb00c692f31f1a1124.tar.gz scummvm-rg350-5883f4cc3fe5861c314afedb00c692f31f1a1124.tar.bz2 scummvm-rg350-5883f4cc3fe5861c314afedb00c692f31f1a1124.zip |
OPENGL/SDL: Default to RGBA8888 (memory layout).
This makes sure the default mode also works for OpenGL ES contexts.
Diffstat (limited to 'backends/graphics/openglsdl/openglsdl-graphics.cpp')
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index 6df67d0c1d..9540a19e9e 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -158,8 +158,18 @@ void OpenGLSdlGraphicsManager::resetGraphicsScale() { Common::List<Graphics::PixelFormat> OpenGLSdlGraphicsManager::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 @@ -168,6 +178,13 @@ Common::List<Graphics::PixelFormat> OpenGLSdlGraphicsManager::getSupportedFormat formats.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)); #ifndef USE_GLES +#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 // ARGB8888, this should not be here, but Sword25 requires it. :-/ formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24)); @@ -327,7 +344,17 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) { } if (_hwScreen) { - const Graphics::PixelFormat rgba8888 = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); + // This is pretty confusing since RGBA8888 talks about the memory + // layout here. This is a different logical layout depending on + // whether we run on little endian or big endian. However, we can + // only safely assume that RGBA8888 in memory layout is supported. + // Thus, we chose this one. + const Graphics::PixelFormat rgba8888 = +#ifdef SCUMM_LITTLE_ENDIAN + Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24); +#else + Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); +#endif notifyContextCreate(rgba8888, rgba8888); setActualScreenSize(_hwScreen->w, _hwScreen->h); } |