mesa: Add X1B5G5R5 along with A1B5G5R5.
authorEric Anholt <eric@anholt.net>
Mon, 1 May 2017 18:21:27 +0000 (11:21 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 10 Oct 2017 16:31:29 +0000 (09:31 -0700)
For supporting RGB5 in hardware with A in the low bit (vc4), we need this
format as well.

v2: Add proper _mesa_format_matches_format_and_type() support (from
    Nicolai).

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
src/mesa/main/formats.c
src/mesa/main/formats.csv
src/mesa/main/formats.h
src/mesa/main/texformat.c
src/mesa/swrast/s_texfetch.c

index ecdfd5610359352451a8f2934e007c4c49395ea0..34450003572cbc3ca7e29f5dddcdfcd38609811e 100644 (file)
@@ -875,6 +875,7 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format,
 
    case MESA_FORMAT_A1B5G5R5_UNORM:
    case MESA_FORMAT_A1B5G5R5_UINT:
+   case MESA_FORMAT_X1B5G5R5_UNORM:
       *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
       *comps = 4;
       return;
@@ -1526,6 +1527,10 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
       return format == GL_RGBA && type == GL_UNSIGNED_SHORT_5_5_5_1 &&
          !swapBytes;
 
+   case MESA_FORMAT_X1B5G5R5_UNORM:
+      return format == GL_RGB && type == GL_UNSIGNED_SHORT_5_5_5_1 &&
+         !swapBytes;
+
    case MESA_FORMAT_B5G5R5A1_UNORM:
       return format == GL_BGRA && type == GL_UNSIGNED_SHORT_1_5_5_5_REV &&
          !swapBytes;
index 285921ed44571659dfba92057c4ce614fc7a6e90..ce53f8f056190124092da6740250953662096577 100644 (file)
@@ -68,6 +68,7 @@ MESA_FORMAT_B4G4R4A4_UNORM                , packed, 1, 1, 1, un4 , un4 , un4 , u
 MESA_FORMAT_B4G4R4X4_UNORM                , packed, 1, 1, 1, un4 , un4 , un4 , x4  , zyx1, rgb
 MESA_FORMAT_A4R4G4B4_UNORM                , packed, 1, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb
 MESA_FORMAT_A1B5G5R5_UNORM                , packed, 1, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb
+MESA_FORMAT_X1B5G5R5_UNORM                , packed, 1, 1, 1, x1  , un5 , un5 , un5 , wzy1, rgb
 MESA_FORMAT_B5G5R5A1_UNORM                , packed, 1, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
 MESA_FORMAT_B5G5R5X1_UNORM                , packed, 1, 1, 1, un5 , un5 , un5 , x1  , zyx1, rgb
 MESA_FORMAT_A1R5G5B5_UNORM                , packed, 1, 1, 1, un1 , un5 , un5 , un5 , yzwx, rgb
index fbcbe36b71e68159d16c77f4f354bc2139d1cbfe..b81810fc893893e51a0abae48a139cdaa8c4972e 100644 (file)
@@ -350,6 +350,7 @@ typedef enum
    MESA_FORMAT_B4G4R4X4_UNORM,                       /* xxxx RRRR GGGG BBBB */
    MESA_FORMAT_A4R4G4B4_UNORM,                       /* BBBB GGGG RRRR AAAA */
    MESA_FORMAT_A1B5G5R5_UNORM,                       /* RRRR RGGG GGBB BBBA */
+   MESA_FORMAT_X1B5G5R5_UNORM,                       /* BBBB BGGG GGRR RRRX */
    MESA_FORMAT_B5G5R5A1_UNORM,                       /* ARRR RRGG GGGB BBBB */
    MESA_FORMAT_B5G5R5X1_UNORM,                       /* xRRR RRGG GGGB BBBB */
    MESA_FORMAT_A1R5G5B5_UNORM,                       /* BBBB BGGG GGRR RRRA */
index 13e77b77ecdd1aed5209355e46890a9a224c5fa4..822f80f89edbf0dae1c037c853b8780eeb96f8ea 100644 (file)
@@ -88,6 +88,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       break;
    case GL_RGB5_A1:
       RETURN_IF_SUPPORTED(MESA_FORMAT_B5G5R5A1_UNORM);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A1B5G5R5_UNORM);
       break;
    case GL_RGBA2:
       RETURN_IF_SUPPORTED(MESA_FORMAT_A4R4G4B4_UNORM); /* just to test another format*/
index 4353ea0e471055dc074cda6048b3ec68bc52b501..e2c3c085b5751c83b7f5918a05c4d7529dec975b 100644 (file)
@@ -159,6 +159,7 @@ texfetch_funcs[] =
    FETCH_NULL(B4G4R4X4_UNORM),
    FETCH_FUNCS(A4R4G4B4_UNORM),
    FETCH_FUNCS(A1B5G5R5_UNORM),
+   FETCH_NULL(X1B5G5R5_UNORM),
    FETCH_FUNCS(B5G5R5A1_UNORM),
    FETCH_NULL(B5G5R5X1_UNORM),
    FETCH_FUNCS(A1R5G5B5_UNORM),