[Mesa-dev] [PATCH] [RFC] mesa/formats: add rest of integer formats.

Dave Airlie airlied at gmail.com
Tue Sep 27 12:54:44 PDT 2011


From: Dave Airlie <airlied at redhat.com>

This is taken from reading EXT_texture_integer + EXT_texture_rg in combination,

Comments on necessity of each format, naming of formats and bugs in the
formats tables please.

Is there any formats I've missed?

will look at actually using this info in another step, just want to
make sure I've identified all the formats upfront.

Dave.
---
 src/mesa/main/formats.c |  382 ++++++++++++++++++++++++++++++++++++++++++++++-
 src/mesa/main/formats.h |   46 ++++++
 2 files changed, 426 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 11d6706..0a93007 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -756,6 +756,251 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    },
 
    /* unnormalized signed int formats */
+   /* unnormalized unsigned int formats */
+   {
+      MESA_FORMAT_ALPHA_UINT8,
+      "MESA_FORMAT_ALPHA_UINT8",
+      GL_ALPHA,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 8,
+      0, 0, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_ALPHA_UINT16,
+      "MESA_FORMAT_ALPHA_UINT16",
+      GL_ALPHA,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 16,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_ALPHA_UINT32,
+      "MESA_FORMAT_ALPHA_UINT32",
+      GL_ALPHA,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 32,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_ALPHA_INT8,
+      "MESA_FORMAT_ALPHA_INT8",
+      GL_ALPHA,
+      GL_INT,
+      0, 0, 0, 8,
+      0, 0, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_ALPHA_INT16,
+      "MESA_FORMAT_ALPHA_INT16",
+      GL_ALPHA,
+      GL_INT,
+      0, 0, 0, 16,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_ALPHA_INT32,
+      "MESA_FORMAT_ALPHA_INT32",
+      GL_ALPHA,
+      GL_INT,
+      0, 0, 0, 32,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_INTENSITY_UINT8,
+      "MESA_FORMAT_INTENSITY_UINT8",
+      GL_INTENSITY,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 0,
+      0, 8, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_INTENSITY_UINT16,
+      "MESA_FORMAT_INTENSITY_UINT16",
+      GL_INTENSITY,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 0,
+      0, 16, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_INTENSITY_UINT32,
+      "MESA_FORMAT_INTENSITY_UINT32",
+      GL_INTENSITY,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 0,
+      0, 32, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_INTENSITY_INT8,
+      "MESA_FORMAT_INTENSITY_INT8",
+      GL_INTENSITY,
+      GL_INT,
+      0, 0, 0, 0,
+      0, 8, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_INTENSITY_INT16,
+      "MESA_FORMAT_INTENSITY_INT16",
+      GL_INTENSITY,
+      GL_INT,
+      0, 0, 0, 0,
+      0, 16, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_INTENSITY_INT32,
+      "MESA_FORMAT_INTENSITY_INT32",
+      GL_INTENSITY,
+      GL_INT,
+      0, 0, 0, 0,
+      0, 32, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_LUMINANCE_UINT8,
+      "MESA_FORMAT_LUMINANCE_UINT8",
+      GL_LUMINANCE,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 0,
+      8, 0, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_LUMINANCE_UINT16,
+      "MESA_FORMAT_LUMINANCE_UINT16",
+      GL_LUMINANCE,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 0,
+      16, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_LUMINANCE_UINT32,
+      "MESA_FORMAT_LUMINANCE_UINT32",
+      GL_LUMINANCE,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 0,
+      32, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_LUMINANCE_INT8,
+      "MESA_FORMAT_LUMINANCE_INT8",
+      GL_LUMINANCE,
+      GL_INT,
+      0, 0, 0, 0,
+      8, 0, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_LUMINANCE_INT16,
+      "MESA_FORMAT_LUMINANCE_INT16",
+      GL_LUMINANCE,
+      GL_INT,
+      0, 0, 0, 0,
+      16, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_LUMINANCE_INT32,
+      "MESA_FORMAT_LUMINANCE_INT32",
+      GL_LUMINANCE,
+      GL_INT,
+      0, 0, 0, 0,
+      32, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_UINT8,
+      "MESA_FORMAT_LUMINANCE_ALPHA_UINT8",
+      GL_LUMINANCE_ALPHA,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 8,
+      8, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_UINT16,
+      "MESA_FORMAT_LUMINANCE_ALPHA_UINT16",
+      GL_LUMINANCE_ALPHA,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 16,
+      16, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_UINT32,
+      "MESA_FORMAT_LUMINANCE_ALPHA_UINT32",
+      GL_LUMINANCE_ALPHA,
+      GL_UNSIGNED_INT,
+      0, 0, 0, 32,
+      32, 0, 0, 0, 0,
+      1, 1, 8
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_INT8,
+      "MESA_FORMAT_LUMINANCE_ALPHA_INT8",
+      GL_LUMINANCE_ALPHA,
+      GL_INT,
+      0, 0, 0, 8,
+      8, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_INT16,
+      "MESA_FORMAT_LUMINANCE_ALPHA_INT16",
+      GL_LUMINANCE_ALPHA,
+      GL_INT,
+      0, 0, 0, 16,
+      16, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_INT32,
+      "MESA_FORMAT_LUMINANCE_ALPHA_INT32",
+      GL_LUMINANCE_ALPHA,
+      GL_INT,
+      0, 0, 0, 32,
+      32, 0, 0, 0, 0,
+      1, 1, 8
+   },
+
+   {
+      MESA_FORMAT_R_INT8,
+      "MESA_FORMAT_R_INT8",
+      GL_RED,
+      GL_INT,
+      8, 0, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_RG_INT8,
+      "MESA_FORMAT_RG_INT8",
+      GL_RG,
+      GL_INT,
+      8, 8, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_RGB_INT8,
+      "MESA_FORMAT_RGB_INT8",
+      GL_RGB,
+      GL_INT,
+      8, 8, 8, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 3
+   },
    {
       MESA_FORMAT_RGBA_INT8,
       "MESA_FORMAT_RGBA_INT8",
@@ -766,6 +1011,33 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       1, 1, 4
    },
    {
+      MESA_FORMAT_R_INT16,
+      "MESA_FORMAT_R_INT16",
+      GL_RED,
+      GL_INT,
+      16, 0, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_RG_INT16,
+      "MESA_FORMAT_RG_INT16",
+      GL_RG,
+      GL_INT,
+      16, 16, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_RGB_INT16,
+      "MESA_FORMAT_RGB_INT16",
+      GL_RGB,
+      GL_INT,
+      16, 16, 16, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 6
+   },
+   {
       MESA_FORMAT_RGBA_INT16,
       "MESA_FORMAT_RGBA_INT16",
       GL_RGBA,
@@ -775,6 +1047,33 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       1, 1, 8
    },
    {
+      MESA_FORMAT_R_INT32,
+      "MESA_FORMAT_R_INT32",
+      GL_RED,
+      GL_INT,
+      32, 0, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_RG_INT32,
+      "MESA_FORMAT_RG_INT32",
+      GL_RG,
+      GL_INT,
+      32, 32, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 8
+   },
+   {
+      MESA_FORMAT_RGB_INT32,
+      "MESA_FORMAT_RGB_INT32",
+      GL_RGB,
+      GL_INT,
+      32, 32, 32, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 12
+   },
+   {
       MESA_FORMAT_RGBA_INT32,
       "MESA_FORMAT_RGBA_INT32",
       GL_RGBA,
@@ -783,8 +1082,33 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       0, 0, 0, 0, 0,
       1, 1, 16
    },
-
-   /* unnormalized unsigned int formats */
+   {
+      MESA_FORMAT_R_UINT8,
+      "MESA_FORMAT_R_UINT8",
+      GL_RED,
+      GL_UNSIGNED_INT,
+      8, 0, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_RG_UINT8,
+      "MESA_FORMAT_RG_UINT8",
+      GL_RG,
+      GL_UNSIGNED_INT,
+      8, 8, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_RGB_UINT8,
+      "MESA_FORMAT_RGB_UINT8",
+      GL_RGB,
+      GL_UNSIGNED_INT,
+      8, 8, 8, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 3
+   },
    {
       MESA_FORMAT_RGBA_UINT8,
       "MESA_FORMAT_RGBA_UINT8",
@@ -795,6 +1119,33 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       1, 1, 4
    },
    {
+      MESA_FORMAT_R_UINT16,
+      "MESA_FORMAT_R_UINT16",
+      GL_RED,
+      GL_UNSIGNED_INT,
+      16, 0, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_RG_UINT16,
+      "MESA_FORMAT_RG_UINT16",
+      GL_RG,
+      GL_UNSIGNED_INT,
+      16, 16, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_RGB_UINT16,
+      "MESA_FORMAT_RGB_UINT16",
+      GL_RGB,
+      GL_UNSIGNED_INT,
+      16, 16, 16, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 6
+   },
+   {
       MESA_FORMAT_RGBA_UINT16,
       "MESA_FORMAT_RGBA_UINT16",
       GL_RGBA,
@@ -804,6 +1155,33 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       1, 1, 8
    },
    {
+      MESA_FORMAT_R_UINT32,
+      "MESA_FORMAT_R_UINT32",
+      GL_RED,
+      GL_UNSIGNED_INT,
+      32, 0, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_RG_UINT32,
+      "MESA_FORMAT_RG_UINT32",
+      GL_RG,
+      GL_UNSIGNED_INT,
+      32, 32, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 8
+   },
+   {
+      MESA_FORMAT_RGB_UINT32,
+      "MESA_FORMAT_RGB_UINT32",
+      GL_RGB,
+      GL_UNSIGNED_INT,
+      32, 32, 32, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 12
+   },
+   {
       MESA_FORMAT_RGBA_UINT32,
       "MESA_FORMAT_RGBA_UINT32",
       GL_RGBA,
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 610204c..12758f0 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -152,15 +152,61 @@ typedef enum
     * XXX Note: these are just stand-ins for some better hardware
     * formats TBD such as BGRA or ARGB.
     */
+   MESA_FORMAT_ALPHA_UINT8,
+   MESA_FORMAT_ALPHA_UINT16,
+   MESA_FORMAT_ALPHA_UINT32,
+   MESA_FORMAT_ALPHA_INT8,
+   MESA_FORMAT_ALPHA_INT16,
+   MESA_FORMAT_ALPHA_INT32,
+
+   MESA_FORMAT_INTENSITY_UINT8,
+   MESA_FORMAT_INTENSITY_UINT16,
+   MESA_FORMAT_INTENSITY_UINT32,
+   MESA_FORMAT_INTENSITY_INT8,
+   MESA_FORMAT_INTENSITY_INT16,
+   MESA_FORMAT_INTENSITY_INT32,
+
+   MESA_FORMAT_LUMINANCE_UINT8,
+   MESA_FORMAT_LUMINANCE_UINT16,
+   MESA_FORMAT_LUMINANCE_UINT32,
+   MESA_FORMAT_LUMINANCE_INT8,
+   MESA_FORMAT_LUMINANCE_INT16,
+   MESA_FORMAT_LUMINANCE_INT32,
+
+   MESA_FORMAT_LUMINANCE_ALPHA_UINT8,
+   MESA_FORMAT_LUMINANCE_ALPHA_UINT16,
+   MESA_FORMAT_LUMINANCE_ALPHA_UINT32,
+   MESA_FORMAT_LUMINANCE_ALPHA_INT8,
+   MESA_FORMAT_LUMINANCE_ALPHA_INT16,
+   MESA_FORMAT_LUMINANCE_ALPHA_INT32,
+
+   MESA_FORMAT_R_INT8,
+   MESA_FORMAT_RG_INT8,
+   MESA_FORMAT_RGB_INT8,
    MESA_FORMAT_RGBA_INT8,
+   MESA_FORMAT_R_INT16,
+   MESA_FORMAT_RG_INT16,
+   MESA_FORMAT_RGB_INT16,
    MESA_FORMAT_RGBA_INT16,
+   MESA_FORMAT_R_INT32,
+   MESA_FORMAT_RG_INT32,
+   MESA_FORMAT_RGB_INT32,
    MESA_FORMAT_RGBA_INT32,
 
    /**
     * \name Non-normalized unsigned integer formats.
     */
+   MESA_FORMAT_R_UINT8,
+   MESA_FORMAT_RG_UINT8,
+   MESA_FORMAT_RGB_UINT8,
    MESA_FORMAT_RGBA_UINT8,
+   MESA_FORMAT_R_UINT16,
+   MESA_FORMAT_RG_UINT16,
+   MESA_FORMAT_RGB_UINT16,
    MESA_FORMAT_RGBA_UINT16,
+   MESA_FORMAT_R_UINT32,
+   MESA_FORMAT_RG_UINT32,
+   MESA_FORMAT_RGB_UINT32,
    MESA_FORMAT_RGBA_UINT32,
 
                                   /* msb <------ TEXEL BITS -----------> lsb */
-- 
1.7.6.2



More information about the mesa-dev mailing list