mesa,st/mesa: implement GL_RGB565 from ARB_ES2_compatibility
authorMarek Olšák <maraeo@gmail.com>
Thu, 12 Jul 2012 12:07:41 +0000 (14:07 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 12 Jul 2012 23:36:07 +0000 (01:36 +0200)
This was not implemented, because the spec was changed just recently.

Everything has been in place already.

Gallium has PIPE_FORMAT_B5G6R5_UNORM, while Mesa has MESA_FORMAT_RGB565.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/fbobject.c
src/mesa/main/image.c
src/mesa/main/texformat.c
src/mesa/main/teximage.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_format.c

index cfaea62bbad604084d8dfa532242f77462fc61eb..4370c7218c88bfb27c391f1b6a3df4955c90ee9c 100644 (file)
@@ -1296,6 +1296,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
 
    case GL_RGB10_A2UI:
       return ctx->Extensions.ARB_texture_rgb10_a2ui ? GL_RGBA : 0;
+
+   case GL_RGB565:
+      return ctx->Extensions.ARB_ES2_compatibility ? GL_RGB : 0;
    default:
       return 0;
    }
index b6c2645e9b0f9f38607b84e7980fb571316ae298..678dfeb2b074ab14f347dded68969372ea3a941e 100644 (file)
@@ -770,6 +770,7 @@ _mesa_is_color_format(GLenum format)
       case GL_R3_G3_B2:
       case GL_RGB4:
       case GL_RGB5:
+      case GL_RGB565:
       case GL_RGB8:
       case GL_RGB10:
       case GL_RGB12:
index 5fdc2ab1f7957e69bdca1085b36868822c8c82e1..26bcbc10a665508ff7dbc2da360c50e8a8b27f78 100644 (file)
@@ -258,6 +258,16 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
          ; /* fallthrough */
    }
 
+   if (ctx->Extensions.ARB_ES2_compatibility) {
+      switch (internalFormat) {
+         case GL_RGB565:
+            RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
+            break;
+         default:
+         ; /* fallthrough */
+      }
+   }
+
    if (ctx->Extensions.MESA_ycbcr_texture) {
       if (internalFormat == GL_YCBCR_MESA) {
          if (type == GL_UNSIGNED_SHORT_8_8_MESA)
index b16baaf914cb3aeaeb4c0e8e33a1f33c3b08dd18..126386ebed612b1ff5d3f5fa3dc9a9dacf7a92f3 100644 (file)
@@ -138,6 +138,15 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
       }
    }
 
+   if (ctx->Extensions.ARB_ES2_compatibility) {
+      switch (internalFormat) {
+         case GL_RGB565:
+            return GL_RGB;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
    if (ctx->Extensions.ARB_depth_texture) {
       switch (internalFormat) {
          case GL_DEPTH_COMPONENT:
index 10eaa84db793f4fb18f13e06ef22c19f87af7c7f..c5f36316b4c3755aa6a1a39a0d1da1397036c8c9 100644 (file)
@@ -403,6 +403,8 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
 
          case GL_UNSIGNED_SHORT_5_6_5:
          case GL_UNSIGNED_SHORT_5_6_5_REV:
+            return GL_RGB565;
+
          case GL_UNSIGNED_SHORT_5_5_5_1:
          case GL_UNSIGNED_SHORT_1_5_5_5_REV:
             return GL_RGB5_A1;
index 4265d14b4e304a6b5690790a7e47c996b0b926df..57d34411f7d20a5230635fc5870da899333450b0 100644 (file)
@@ -793,6 +793,10 @@ static const struct format_mapping format_map[] = {
       { PIPE_FORMAT_B5G6R5_UNORM, PIPE_FORMAT_B5G5R5A1_UNORM,
         DEFAULT_RGBA_FORMATS }
    },
+   {
+      { GL_RGB565 },
+      { PIPE_FORMAT_B5G6R5_UNORM, DEFAULT_RGBA_FORMATS }
+   },
 
    /* basic Alpha formats */
    {