[Mesa-stable] [PATCH] mesa: change state query return value for RGB565

Chad Versace chad at kiwitree.net
Fri Aug 12 22:36:53 UTC 2016


From: Haixia Shi <hshi at chromium.org>

The GL_BGR and GL_UNSIGNED_SHORT_5_6_5_REV are not defined anywhere in
OpenGL ES 3.2 (or earlier) specification, and there are no known extensions
in the Khronos registry that would add these enums as valid responses for
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE) and
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT) queries.

Note that this patch does not change the bit layout returned by the query. As
defined by the GL spec, the bit layout of GL_RGB + GL_UNSIGNED_SHORT_5_6_5 and
GL_BGR + GL_UNSIGNED_SHORT_5_6_5_REV are identical.

TEST=dEQP-GLES3.functional.state_query.integers.*

Signed-off-by: Haixia Shi <hshi at chromium.org>
Reviewed-by: Chad Versace <chadversary at chromium.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Cc: Stéphane Marchesin <marcheu at chromium.org>
Change-Id: I81bbc8ccdc7e125edaeae443baf6fa8fdefcc6b6
(cherry picked from commit 8c56ff643b1d6d18d81d82a4d23103a1cd51500a)
---
 src/mesa/main/framebuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 38bd680..f024f5e 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -857,7 +857,7 @@ _mesa_get_color_read_format(struct gl_context *ctx)
       if (format == MESA_FORMAT_B8G8R8A8_UNORM)
          return GL_BGRA;
       else if (format == MESA_FORMAT_B5G6R5_UNORM)
-         return GL_BGR;
+         return GL_RGB;
       else if (format == MESA_FORMAT_R_UNORM8)
          return GL_RED;
 
@@ -892,7 +892,7 @@ _mesa_get_color_read_type(struct gl_context *ctx)
       const GLenum data_type = _mesa_get_format_datatype(format);
 
       if (format == MESA_FORMAT_B5G6R5_UNORM)
-         return GL_UNSIGNED_SHORT_5_6_5_REV;
+         return GL_UNSIGNED_SHORT_5_6_5;
 
       switch (data_type) {
       case GL_SIGNED_NORMALIZED:
-- 
2.9.2



More information about the mesa-stable mailing list