[Scummvm-cvs-logs] scummvm master -> 5883f4cc3fe5861c314afedb00c692f31f1a1124
lordhoto
lordhoto at gmail.com
Wed Feb 12 18:08:34 CET 2014
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2cab30ee80 OPENGL: Move RGBA8888 (logical layout) to OpenGL specific formats.
5d78542ab8 OPENGL: Always support RGBA8888 (memory layout).
5883f4cc3f OPENGL/SDL: Default to RGBA8888 (memory layout).
Commit: 2cab30ee80a7611945ac5e9260c63d6b86f658cf
https://github.com/scummvm/scummvm/commit/2cab30ee80a7611945ac5e9260c63d6b86f658cf
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T09:06:29-08:00
Commit Message:
OPENGL: Move RGBA8888 (logical layout) to OpenGL specific formats.
The reason here is that GL_UNSIGNED_INT_8_8_8_8 is not supported by the GLES
standard. Thus we cannot use it outside OpenGL specific code paths.
Changed paths:
backends/graphics/opengl/opengl-graphics.cpp
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index dfba14a..d7d37a2 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -918,12 +918,7 @@ Texture *OpenGLGraphicsManager::createTexture(const Graphics::PixelFormat &forma
}
bool OpenGLGraphicsManager::getGLPixelFormat(const Graphics::PixelFormat &pixelFormat, GLenum &glIntFormat, GLenum &glFormat, GLenum &glType) const {
- if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) { // RGBA8888
- glIntFormat = GL_RGBA;
- glFormat = GL_RGBA;
- glType = GL_UNSIGNED_INT_8_8_8_8;
- return true;
- } else if (pixelFormat == Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) { // RGB565
+ if (pixelFormat == Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) { // RGB565
glIntFormat = GL_RGB;
glFormat = GL_RGB;
glType = GL_UNSIGNED_SHORT_5_6_5;
@@ -939,6 +934,11 @@ bool OpenGLGraphicsManager::getGLPixelFormat(const Graphics::PixelFormat &pixelF
glType = GL_UNSIGNED_SHORT_4_4_4_4;
return true;
#ifndef USE_GLES
+ } else if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) { // RGBA8888
+ glIntFormat = GL_RGBA;
+ glFormat = GL_RGBA;
+ glType = GL_UNSIGNED_INT_8_8_8_8;
+ return true;
} else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555
// GL_BGRA does not exist in every GLES implementation so should not be configured if
// USE_GLES is set.
Commit: 5d78542ab8c6a76e266a453b8590bf6bbd70b631
https://github.com/scummvm/scummvm/commit/5d78542ab8c6a76e266a453b8590bf6bbd70b631
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T09:06:29-08:00
Commit Message:
OPENGL: Always support RGBA8888 (memory layout).
Changed paths:
backends/graphics/opengl/opengl-graphics.cpp
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index d7d37a2..0a03412 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -918,7 +918,16 @@ Texture *OpenGLGraphicsManager::createTexture(const Graphics::PixelFormat &forma
}
bool OpenGLGraphicsManager::getGLPixelFormat(const Graphics::PixelFormat &pixelFormat, GLenum &glIntFormat, GLenum &glFormat, GLenum &glType) const {
- if (pixelFormat == Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) { // RGB565
+#ifdef SCUMM_LITTLE_ENDIAN
+ if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)) { // ABGR8888
+#else
+ if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) { // RGBA8888
+#endif
+ glIntFormat = GL_RGBA;
+ glFormat = GL_RGBA;
+ glType = GL_UNSIGNED_BYTE;
+ return true;
+ } else if (pixelFormat == Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) { // RGB565
glIntFormat = GL_RGB;
glFormat = GL_RGB;
glType = GL_UNSIGNED_SHORT_5_6_5;
@@ -934,11 +943,13 @@ bool OpenGLGraphicsManager::getGLPixelFormat(const Graphics::PixelFormat &pixelF
glType = GL_UNSIGNED_SHORT_4_4_4_4;
return true;
#ifndef USE_GLES
+#ifdef SCUMM_LITTLE_ENDIAN
} else if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) { // RGBA8888
glIntFormat = GL_RGBA;
glFormat = GL_RGBA;
glType = GL_UNSIGNED_INT_8_8_8_8;
return true;
+#endif
} else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555
// GL_BGRA does not exist in every GLES implementation so should not be configured if
// USE_GLES is set.
@@ -956,11 +967,13 @@ bool OpenGLGraphicsManager::getGLPixelFormat(const Graphics::PixelFormat &pixelF
glFormat = GL_BGRA;
glType = GL_UNSIGNED_SHORT_4_4_4_4_REV;
return true;
+#ifdef SCUMM_BIG_ENDIAN
} else if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)) { // ABGR8888
glIntFormat = GL_RGBA;
glFormat = GL_RGBA;
glType = GL_UNSIGNED_INT_8_8_8_8_REV;
return true;
+#endif
} else if (pixelFormat == Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0)) { // BGRA8888
glIntFormat = GL_RGBA;
glFormat = GL_BGRA;
Commit: 5883f4cc3fe5861c314afedb00c692f31f1a1124
https://github.com/scummvm/scummvm/commit/5883f4cc3fe5861c314afedb00c692f31f1a1124
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T09:06:29-08:00
Commit Message:
OPENGL/SDL: Default to RGBA8888 (memory layout).
This makes sure the default mode also works for OpenGL ES contexts.
Changed paths:
backends/graphics/openglsdl/openglsdl-graphics.cpp
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 6df67d0..9540a19 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);
}
More information about the Scummvm-git-logs
mailing list