[Mesa-dev] [PATCH 4/4] st/mesa: use R10G10B10X2 format where applicable

Nicolai Hähnle nhaehnle at gmail.com
Fri Sep 29 11:30:16 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

This is the last step of fixing
dEQP-GLES3.functional.fbo.completeness.renderable.texture.color0.rgb_unsigned_int_2_10_10_10_rev
for radeonsi.
---
 src/mesa/state_tracker/st_format.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 348853affd8..84b744e3df5 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -82,20 +82,22 @@ st_mesa_format_to_pipe_format(const struct st_context *st, mesa_format mesaForma
    case MESA_FORMAT_B4G4R4A4_UNORM:
       return PIPE_FORMAT_B4G4R4A4_UNORM;
    case MESA_FORMAT_B5G6R5_UNORM:
       return PIPE_FORMAT_B5G6R5_UNORM;
    case MESA_FORMAT_B2G3R3_UNORM:
       return PIPE_FORMAT_B2G3R3_UNORM;
    case MESA_FORMAT_B10G10R10A2_UNORM:
       return PIPE_FORMAT_B10G10R10A2_UNORM;
    case MESA_FORMAT_R10G10B10A2_UNORM:
       return PIPE_FORMAT_R10G10B10A2_UNORM;
+   case MESA_FORMAT_R10G10B10X2_UNORM:
+      return PIPE_FORMAT_R10G10B10X2_UNORM;
    case MESA_FORMAT_L4A4_UNORM:
       return PIPE_FORMAT_L4A4_UNORM;
    case MESA_FORMAT_L8A8_UNORM:
       return PIPE_FORMAT_LA88_UNORM;
    case MESA_FORMAT_A8L8_UNORM:
       return PIPE_FORMAT_AL88_UNORM;
    case MESA_FORMAT_L16A16_UNORM:
       return PIPE_FORMAT_LA1616_UNORM;
    case MESA_FORMAT_A16L16_UNORM:
       return PIPE_FORMAT_AL1616_UNORM;
@@ -559,20 +561,22 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
    case PIPE_FORMAT_B4G4R4A4_UNORM:
       return MESA_FORMAT_B4G4R4A4_UNORM;
    case PIPE_FORMAT_B5G6R5_UNORM:
       return MESA_FORMAT_B5G6R5_UNORM;
    case PIPE_FORMAT_B2G3R3_UNORM:
       return MESA_FORMAT_B2G3R3_UNORM;
    case PIPE_FORMAT_B10G10R10A2_UNORM:
       return MESA_FORMAT_B10G10R10A2_UNORM;
    case PIPE_FORMAT_R10G10B10A2_UNORM:
       return MESA_FORMAT_R10G10B10A2_UNORM;
+   case PIPE_FORMAT_R10G10B10X2_UNORM:
+      return MESA_FORMAT_R10G10B10X2_UNORM;
    case PIPE_FORMAT_L4A4_UNORM:
       return MESA_FORMAT_L4A4_UNORM;
    case PIPE_FORMAT_LA88_UNORM:
       return MESA_FORMAT_L8A8_UNORM;
    case PIPE_FORMAT_AL88_UNORM:
       return MESA_FORMAT_A8L8_UNORM;
    case PIPE_FORMAT_LA1616_UNORM:
       return MESA_FORMAT_L16A16_UNORM;
    case PIPE_FORMAT_AL1616_UNORM:
       return MESA_FORMAT_A16L16_UNORM;
@@ -1051,21 +1055,21 @@ test_format_conversion(struct st_context *st)
    }
 }
 
 
 /**
  * Map GL texture formats to Gallium pipe formats.
  */
 struct format_mapping
 {
    GLenum glFormats[18];       /**< list of GLenum formats, 0-terminated */
-   enum pipe_format pipeFormats[13]; /**< list of pipe formats, 0-terminated */
+   enum pipe_format pipeFormats[14]; /**< list of pipe formats, 0-terminated */
 };
 
 
 #define DEFAULT_RGBA_FORMATS \
       PIPE_FORMAT_R8G8B8A8_UNORM, \
       PIPE_FORMAT_B8G8R8A8_UNORM, \
       PIPE_FORMAT_A8R8G8B8_UNORM, \
       PIPE_FORMAT_A8B8G8R8_UNORM, \
       0
 
@@ -1103,22 +1107,23 @@ struct format_mapping
 
 /**
  * This table maps OpenGL texture format enums to Gallium pipe_format enums.
  * Multiple GL enums might map to multiple pipe_formats.
  * The first pipe format in the list that's supported is the one that's chosen.
  */
 static const struct format_mapping format_map[] = {
    /* Basic RGB, RGBA formats */
    {
       { GL_RGB10, 0 },
-      { PIPE_FORMAT_B10G10R10X2_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM,
-        PIPE_FORMAT_R10G10B10A2_UNORM, DEFAULT_RGB_FORMATS }
+      { PIPE_FORMAT_R10G10B10X2_UNORM, PIPE_FORMAT_B10G10R10X2_UNORM,
+        PIPE_FORMAT_R10G10B10A2_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM,
+        DEFAULT_RGB_FORMATS }
    },
    {
       { GL_RGB10_A2, 0 },
       { PIPE_FORMAT_R10G10B10A2_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM,
         DEFAULT_RGBA_FORMATS }
    },
    {
       { 4, GL_RGBA, GL_RGBA8, 0 },
       { PIPE_FORMAT_R8G8B8A8_UNORM, DEFAULT_RGBA_FORMATS }
    },
-- 
2.11.0



More information about the mesa-dev mailing list