[Mesa-dev] [PATCH 6/8] mesa: check for !swapBytes in _mesa_format_matches_format_and_type

Marek Olšák maraeo at gmail.com
Tue Jan 29 05:43:54 PST 2013


This is extracted from the texstore code. I'm not sure at all if it's needed.
---
 src/mesa/main/formats.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 9c1a0ff..c54fd5d 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -3004,18 +3004,18 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
       return format == GL_RGB && type == GL_UNSIGNED_BYTE_3_3_2;
 
    case MESA_FORMAT_A8:
-      return format == GL_ALPHA && type == GL_UNSIGNED_BYTE;
+      return format == GL_ALPHA && type == GL_UNSIGNED_BYTE && !swapBytes;
    case MESA_FORMAT_A16:
       return format == GL_ALPHA && type == GL_UNSIGNED_SHORT &&
          littleEndian && !swapBytes;
    case MESA_FORMAT_L8:
    case MESA_FORMAT_SL8:
-      return format == GL_LUMINANCE && type == GL_UNSIGNED_BYTE;
+      return format == GL_LUMINANCE && type == GL_UNSIGNED_BYTE && !swapBytes;
    case MESA_FORMAT_L16:
       return format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT &&
          littleEndian && !swapBytes;
    case MESA_FORMAT_I8:
-      return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE;
+      return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE && !swapBytes;
    case MESA_FORMAT_I16:
       return format == GL_INTENSITY && type == GL_UNSIGNED_SHORT &&
          littleEndian && !swapBytes;
@@ -3029,7 +3029,7 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
              !swapBytes;
 
    case MESA_FORMAT_R8:
-      return format == GL_RED && type == GL_UNSIGNED_BYTE;
+      return format == GL_RED && type == GL_UNSIGNED_BYTE && !swapBytes;
    case MESA_FORMAT_GR88:
       return format == GL_RG && type == GL_UNSIGNED_BYTE && littleEndian;
    case MESA_FORMAT_RG88:
@@ -3067,14 +3067,13 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
          !swapBytes;
 
    case MESA_FORMAT_S8:
-      return format == GL_STENCIL_INDEX && type == GL_UNSIGNED_BYTE;
+      return format == GL_STENCIL_INDEX && type == GL_UNSIGNED_BYTE &&
+             !swapBytes;
 
    case MESA_FORMAT_SRGB_DXT1:
    case MESA_FORMAT_SRGBA_DXT1:
    case MESA_FORMAT_SRGBA_DXT3:
    case MESA_FORMAT_SRGBA_DXT5:
-      return GL_FALSE;
-
    case MESA_FORMAT_RGB_FXT1:
    case MESA_FORMAT_RGBA_FXT1:
    case MESA_FORMAT_RGB_DXT1:
-- 
1.7.10.4



More information about the mesa-dev mailing list