mesa/st: enable carry/borrow lowering pass
[mesa.git] / src / mesa / main / texstore.c
index 7c478e79e63a63bb2ae4012983fb45f4839a9cb2..764214669e1c173c8e01369f6d6a932fdf66c50c 100644 (file)
@@ -1049,7 +1049,7 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS)
    const GLuint depthScale = 0xffffff;
 
    (void) dims;
-   ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_S8_UINT);
+   ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_X8_UINT);
 
    {
       /* general path */
@@ -1079,7 +1079,7 @@ _mesa_texstore_z24_x8(TEXSTORE_PARAMS)
    const GLuint depthScale = 0xffffff;
 
    (void) dims;
-   ASSERT(dstFormat == MESA_FORMAT_X8Z24_UNORM);
+   ASSERT(dstFormat == MESA_FORMAT_X8_UINT_Z24_UNORM);
 
    {
       /* general path */
@@ -1874,8 +1874,8 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS)
 {
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGB_16 ||
-          dstFormat == MESA_FORMAT_SIGNED_RGBA_16 ||
+   ASSERT(dstFormat == MESA_FORMAT_RGB_SNORM16 ||
+          dstFormat == MESA_FORMAT_RGBA_SNORM16 ||
           dstFormat == MESA_FORMAT_RGBX_SNORM16);
 
    {
@@ -1901,7 +1901,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS)
          GLubyte *dstRow = dstSlices[img];
          for (row = 0; row < srcHeight; row++) {
             GLshort *dstRowS = (GLshort *) dstRow;
-            if (dstFormat == MESA_FORMAT_SIGNED_RGBA_16) {
+            if (dstFormat == MESA_FORMAT_RGBA_SNORM16) {
                for (col = 0; col < srcWidth; col++) {
                   GLuint c;
                   for (c = 0; c < comps; c++) {
@@ -2147,10 +2147,10 @@ _mesa_texstore_snorm8(TEXSTORE_PARAMS)
 {
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_SIGNED_A8 ||
-          dstFormat == MESA_FORMAT_SIGNED_L8 ||
-          dstFormat == MESA_FORMAT_SIGNED_I8 ||
-          dstFormat == MESA_FORMAT_SIGNED_R8);
+   ASSERT(dstFormat == MESA_FORMAT_A_SNORM8 ||
+          dstFormat == MESA_FORMAT_L_SNORM8 ||
+          dstFormat == MESA_FORMAT_I_SNORM8 ||
+          dstFormat == MESA_FORMAT_R_SNORM8);
    ASSERT(_mesa_get_format_bytes(dstFormat) == 1);
 
    {
@@ -2190,9 +2190,9 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS)
 {
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL88 ||
-          dstFormat == MESA_FORMAT_SIGNED_RG88 ||
-          dstFormat == MESA_FORMAT_SIGNED_RG88_REV);
+   ASSERT(dstFormat == MESA_FORMAT_L8A8_SNORM ||
+          dstFormat == MESA_FORMAT_G8R8_SNORM ||
+          dstFormat == MESA_FORMAT_R8G8_SNORM);
    ASSERT(_mesa_get_format_bytes(dstFormat) == 2);
 
    {
@@ -2213,8 +2213,8 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS)
          for (row = 0; row < srcHeight; row++) {
             GLushort *dst = (GLushort *) dstRow;
 
-            if (dstFormat == MESA_FORMAT_SIGNED_AL88 ||
-                dstFormat == MESA_FORMAT_SIGNED_RG88_REV) {
+            if (dstFormat == MESA_FORMAT_L8A8_SNORM ||
+                dstFormat == MESA_FORMAT_R8G8_SNORM) {
                for (col = 0; col < srcWidth; col++) {
                   GLubyte l = FLOAT_TO_BYTE_TEX(src[0]);
                   GLubyte a = FLOAT_TO_BYTE_TEX(src[1]);
@@ -2246,10 +2246,10 @@ _mesa_texstore_snorm16(TEXSTORE_PARAMS)
 {
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_SIGNED_R16 ||
-          dstFormat == MESA_FORMAT_SIGNED_A16 ||
-          dstFormat == MESA_FORMAT_SIGNED_L16 ||
-          dstFormat == MESA_FORMAT_SIGNED_I16);
+   ASSERT(dstFormat == MESA_FORMAT_R_SNORM16 ||
+          dstFormat == MESA_FORMAT_A_SNORM16 ||
+          dstFormat == MESA_FORMAT_L_SNORM16 ||
+          dstFormat == MESA_FORMAT_I_SNORM16);
    ASSERT(_mesa_get_format_bytes(dstFormat) == 2);
 
    {
@@ -2292,9 +2292,9 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS)
 {
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL1616 ||
-          dstFormat == MESA_FORMAT_SIGNED_RG1616 ||
-          dstFormat == MESA_FORMAT_SIGNED_GR1616);
+   ASSERT(dstFormat == MESA_FORMAT_LA_SNORM16 ||
+          dstFormat == MESA_FORMAT_G16R16_SNORM ||
+          dstFormat == MESA_FORMAT_R16G16_SNORM);
    ASSERT(_mesa_get_format_bytes(dstFormat) == 4);
 
    {
@@ -2315,8 +2315,8 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS)
          for (row = 0; row < srcHeight; row++) {
             GLuint *dst = (GLuint *) dstRow;
 
-            if (dstFormat == MESA_FORMAT_SIGNED_AL1616 ||
-                dstFormat == MESA_FORMAT_SIGNED_GR1616) {
+            if (dstFormat == MESA_FORMAT_LA_SNORM16 ||
+                dstFormat == MESA_FORMAT_R16G16_SNORM) {
                for (col = 0; col < srcWidth; col++) {
                   GLushort l, a;
 
@@ -2345,7 +2345,7 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS)
 }
 
 /**
- * Store a texture in MESA_FORMAT_SIGNED_RGBX8888 or
+ * Store a texture in MESA_FORMAT_X8B8G8R8_SNORM or
  * MESA_FORMAT_R8G8B8X8_SNORM.
  */
 static GLboolean
@@ -2353,7 +2353,7 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS)
 {
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBX8888 ||
+   ASSERT(dstFormat == MESA_FORMAT_X8B8G8R8_SNORM ||
           dstFormat == MESA_FORMAT_R8G8B8X8_SNORM);
    ASSERT(_mesa_get_format_bytes(dstFormat) == 4);
 
@@ -2374,7 +2374,7 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS)
          GLbyte *dstRow = (GLbyte *) dstSlices[img];
          for (row = 0; row < srcHeight; row++) {
             GLbyte *dst = dstRow;
-            if (dstFormat == MESA_FORMAT_SIGNED_RGBX8888) {
+            if (dstFormat == MESA_FORMAT_X8B8G8R8_SNORM) {
                for (col = 0; col < srcWidth; col++) {
                   dst[3] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]);
                   dst[2] = FLOAT_TO_BYTE_TEX(srcRow[GCOMP]);
@@ -2405,16 +2405,16 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS)
 
 
 /**
- * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or
- * MESA_FORMAT_SIGNED_RGBA8888_REV
+ * Store a texture in MESA_FORMAT_A8B8G8R8_SNORM or
+ * MESA_FORMAT_R8G8B8A8_SNORM
  */
 static GLboolean
 _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
 {
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 ||
-          dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV);
+   ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_SNORM ||
+          dstFormat == MESA_FORMAT_R8G8B8A8_SNORM);
    ASSERT(_mesa_get_format_bytes(dstFormat) == 4);
 
    {
@@ -2434,7 +2434,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
          GLbyte *dstRow = (GLbyte *) dstSlices[img];
          for (row = 0; row < srcHeight; row++) {
             GLbyte *dst = dstRow;
-            if (dstFormat == MESA_FORMAT_SIGNED_RGBA8888) {
+            if (dstFormat == MESA_FORMAT_A8B8G8R8_SNORM) {
                for (col = 0; col < srcWidth; col++) {
                   dst[3] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]);
                   dst[2] = FLOAT_TO_BYTE_TEX(srcRow[GCOMP]);
@@ -2473,74 +2473,71 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
    const GLint srcRowStride
       = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
    GLint img, row;
+   GLuint *depth = malloc(srcWidth * sizeof(GLuint));
+   GLubyte *stencil = malloc(srcWidth * sizeof(GLubyte));
 
    ASSERT(dstFormat == MESA_FORMAT_S8_UINT_Z24_UNORM);
    ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
           srcFormat == GL_DEPTH_COMPONENT ||
           srcFormat == GL_STENCIL_INDEX);
-   ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
+   ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT ||
+          srcType == GL_UNSIGNED_INT_24_8_EXT ||
+          srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
 
-   if (srcFormat == GL_DEPTH_COMPONENT ||
-       srcFormat == GL_STENCIL_INDEX) {
-      GLuint *depth = malloc(srcWidth * sizeof(GLuint));
-      GLubyte *stencil = malloc(srcWidth * sizeof(GLubyte));
+   if (!depth || !stencil) {
+      free(depth);
+      free(stencil);
+      return GL_FALSE;
+   }
 
-      if (!depth || !stencil) {
-         free(depth);
-         free(stencil);
-         return GL_FALSE;
-      }
+   /* In case we only upload depth we need to preserve the stencil */
+   for (img = 0; img < srcDepth; img++) {
+      GLuint *dstRow = (GLuint *) dstSlices[img];
+      const GLubyte *src
+         = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
+               srcWidth, srcHeight,
+               srcFormat, srcType,
+               img, 0, 0);
+      for (row = 0; row < srcHeight; row++) {
+         GLint i;
+         GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
 
-      /* In case we only upload depth we need to preserve the stencil */
-      for (img = 0; img < srcDepth; img++) {
-        GLuint *dstRow = (GLuint *) dstSlices[img];
-         const GLubyte *src
-            = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
-                  srcWidth, srcHeight,
-                  srcFormat, srcType,
-                  img, 0, 0);
-         for (row = 0; row < srcHeight; row++) {
-            GLint i;
-           GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
+         if (srcFormat == GL_DEPTH_COMPONENT) { /* preserve stencil */
+            keepstencil = GL_TRUE;
+         }
+         else if (srcFormat == GL_STENCIL_INDEX) { /* preserve depth */
+            keepdepth = GL_TRUE;
+         }
 
-           if (srcFormat == GL_DEPTH_COMPONENT) { /* preserve stencil */
-              keepstencil = GL_TRUE;
-           }
-            else if (srcFormat == GL_STENCIL_INDEX) { /* preserve depth */
-              keepdepth = GL_TRUE;
-           }
+         if (keepdepth == GL_FALSE)
+            /* the 24 depth bits will be in the low position: */
+            _mesa_unpack_depth_span(ctx, srcWidth,
+                                    GL_UNSIGNED_INT, /* dst type */
+                                    keepstencil ? depth : dstRow, /* dst addr */
+                                    depthScale,
+                                    srcType, src, srcPacking);
 
-           if (keepdepth == GL_FALSE)
-              /* the 24 depth bits will be in the low position: */
-              _mesa_unpack_depth_span(ctx, srcWidth,
-                                      GL_UNSIGNED_INT, /* dst type */
-                                      keepstencil ? depth : dstRow, /* dst addr */
-                                      depthScale,
-                                      srcType, src, srcPacking);
-
-           if (keepstencil == GL_FALSE)
-              /* get the 8-bit stencil values */
-              _mesa_unpack_stencil_span(ctx, srcWidth,
-                                        GL_UNSIGNED_BYTE, /* dst type */
-                                        stencil, /* dst addr */
-                                        srcType, src, srcPacking,
-                                        ctx->_ImageTransferState);
-
-           for (i = 0; i < srcWidth; i++) {
-              if (keepstencil)
-                 dstRow[i] = depth[i] << 8 | (dstRow[i] & 0x000000FF);
-              else
-                 dstRow[i] = (dstRow[i] & 0xFFFFFF00) | (stencil[i] & 0xFF);
-           }
+         if (keepstencil == GL_FALSE)
+            /* get the 8-bit stencil values */
+            _mesa_unpack_stencil_span(ctx, srcWidth,
+                                      GL_UNSIGNED_BYTE, /* dst type */
+                                      stencil, /* dst addr */
+                                      srcType, src, srcPacking,
+                                      ctx->_ImageTransferState);
 
-            src += srcRowStride;
-            dstRow += dstRowStride / sizeof(GLuint);
+         for (i = 0; i < srcWidth; i++) {
+            if (keepstencil)
+               dstRow[i] = depth[i] << 8 | (dstRow[i] & 0x000000FF);
+            else
+               dstRow[i] = (dstRow[i] & 0xFFFFFF00) | (stencil[i] & 0xFF);
          }
+         src += srcRowStride;
+         dstRow += dstRowStride / sizeof(GLuint);
       }
-
-      free(depth);
-      free(stencil);
    }
+
+   free(depth);
+   free(stencil);
    return GL_TRUE;
 }
 
@@ -2558,12 +2555,13 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
    GLuint *depth;
    GLubyte *stencil;
 
-   ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_X8_UINT);
+   ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_S8_UINT);
    ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
           srcFormat == GL_DEPTH_COMPONENT ||
           srcFormat == GL_STENCIL_INDEX);
    ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT ||
-          srcType == GL_UNSIGNED_INT_24_8_EXT);
+          srcType == GL_UNSIGNED_INT_24_8_EXT ||
+          srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
 
    depth = malloc(srcWidth * sizeof(GLuint));
    stencil = malloc(srcWidth * sizeof(GLubyte));
@@ -2828,10 +2826,10 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS)
       components = 4;
    }
 
-   ASSERT(dstFormat == MESA_FORMAT_R_INT8 ||
-          dstFormat == MESA_FORMAT_RG_INT8 ||
-          dstFormat == MESA_FORMAT_RGB_INT8 ||
-          dstFormat == MESA_FORMAT_RGBA_INT8 ||
+   ASSERT(dstFormat == MESA_FORMAT_R_SINT8 ||
+          dstFormat == MESA_FORMAT_RG_SINT8 ||
+          dstFormat == MESA_FORMAT_RGB_SINT8 ||
+          dstFormat == MESA_FORMAT_RGBA_SINT8 ||
           dstFormat == MESA_FORMAT_A_SINT8 ||
           dstFormat == MESA_FORMAT_I_SINT8 ||
           dstFormat == MESA_FORMAT_L_SINT8 ||
@@ -2899,10 +2897,10 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS)
       components = 4;
    }
 
-   ASSERT(dstFormat == MESA_FORMAT_R_INT16 ||
-          dstFormat == MESA_FORMAT_RG_INT16 ||
-          dstFormat == MESA_FORMAT_RGB_INT16 ||
-          dstFormat == MESA_FORMAT_RGBA_INT16 ||
+   ASSERT(dstFormat == MESA_FORMAT_R_SINT16 ||
+          dstFormat == MESA_FORMAT_RG_SINT16 ||
+          dstFormat == MESA_FORMAT_RGB_SINT16 ||
+          dstFormat == MESA_FORMAT_RGBA_SINT16 ||
           dstFormat == MESA_FORMAT_A_SINT16 ||
           dstFormat == MESA_FORMAT_L_SINT16 ||
           dstFormat == MESA_FORMAT_I_SINT16 ||
@@ -2970,10 +2968,10 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS)
       components = 4;
    }
 
-   ASSERT(dstFormat == MESA_FORMAT_R_INT32 ||
-          dstFormat == MESA_FORMAT_RG_INT32 ||
-          dstFormat == MESA_FORMAT_RGB_INT32 ||
-          dstFormat == MESA_FORMAT_RGBA_INT32 ||
+   ASSERT(dstFormat == MESA_FORMAT_R_SINT32 ||
+          dstFormat == MESA_FORMAT_RG_SINT32 ||
+          dstFormat == MESA_FORMAT_RGB_SINT32 ||
+          dstFormat == MESA_FORMAT_RGBA_SINT32 ||
           dstFormat == MESA_FORMAT_A_SINT32 ||
           dstFormat == MESA_FORMAT_I_SINT32 ||
           dstFormat == MESA_FORMAT_L_SINT32 ||
@@ -3260,19 +3258,10 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS)
    GLboolean k;
 
    ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_SRGB ||
-          dstFormat == MESA_FORMAT_R8G8B8X8_SRGB);
+          dstFormat == MESA_FORMAT_R8G8B8X8_SRGB ||
+          dstFormat == MESA_FORMAT_R8G8B8A8_SRGB);
 
-   /* reuse normal rgba texstore code */
-   if (dstFormat == MESA_FORMAT_A8B8G8R8_SRGB) {
-      newDstFormat = MESA_FORMAT_A8B8G8R8_UNORM;
-   }
-   else if (dstFormat == MESA_FORMAT_R8G8B8X8_SRGB) {
-      newDstFormat = MESA_FORMAT_R8G8B8X8_UNORM;
-   }
-   else {
-      ASSERT(0);
-      return GL_TRUE;
-   }
+   newDstFormat = _mesa_get_srgb_format_linear(dstFormat);
 
    k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat,
                                newDstFormat,
@@ -3290,10 +3279,10 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS)
    mesa_format newDstFormat;
    GLboolean k;
 
-   ASSERT(dstFormat == MESA_FORMAT_B8G8R8A8_SRGB);
+   assert(dstFormat == MESA_FORMAT_B8G8R8A8_SRGB ||
+          dstFormat == MESA_FORMAT_B8G8R8X8_SRGB);
 
-   /* reuse normal rgba texstore code */
-   newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM;
+   newDstFormat = _mesa_get_srgb_format_linear(dstFormat);
 
    k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
                                newDstFormat,
@@ -3426,49 +3415,47 @@ _mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS)
 static GLboolean
 _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS)
 {
+   GLint img, row;
+   const GLint srcRowStride
+      = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
+      / sizeof(uint64_t);
+
    ASSERT(dstFormat == MESA_FORMAT_Z32_FLOAT_S8X24_UINT);
    ASSERT(srcFormat == GL_DEPTH_STENCIL ||
           srcFormat == GL_DEPTH_COMPONENT ||
           srcFormat == GL_STENCIL_INDEX);
    ASSERT(srcFormat != GL_DEPTH_STENCIL ||
+          srcType == GL_UNSIGNED_INT_24_8 ||
           srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
 
-   if (srcFormat == GL_DEPTH_COMPONENT ||
-       srcFormat == GL_STENCIL_INDEX) {
-      GLint img, row;
-      const GLint srcRowStride
-         = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
-         / sizeof(uint64_t);
+   /* In case we only upload depth we need to preserve the stencil */
+   for (img = 0; img < srcDepth; img++) {
+      uint64_t *dstRow = (uint64_t *) dstSlices[img];
+      const uint64_t *src
+         = (const uint64_t *) _mesa_image_address(dims, srcPacking, srcAddr,
+               srcWidth, srcHeight,
+               srcFormat, srcType,
+               img, 0, 0);
+      for (row = 0; row < srcHeight; row++) {
+         /* The unpack functions with:
+          *    dstType = GL_FLOAT_32_UNSIGNED_INT_24_8_REV
+          * only write their own dword, so the other dword (stencil
+          * or depth) is preserved. */
+         if (srcFormat != GL_STENCIL_INDEX)
+            _mesa_unpack_depth_span(ctx, srcWidth,
+                                    GL_FLOAT_32_UNSIGNED_INT_24_8_REV, /* dst type */
+                                    dstRow, /* dst addr */
+                                    ~0U, srcType, src, srcPacking);
 
-      /* In case we only upload depth we need to preserve the stencil */
-      for (img = 0; img < srcDepth; img++) {
-         uint64_t *dstRow = (uint64_t *) dstSlices[img];
-         const uint64_t *src
-            = (const uint64_t *) _mesa_image_address(dims, srcPacking, srcAddr,
-                  srcWidth, srcHeight,
-                  srcFormat, srcType,
-                  img, 0, 0);
-         for (row = 0; row < srcHeight; row++) {
-            /* The unpack functions with:
-             *    dstType = GL_FLOAT_32_UNSIGNED_INT_24_8_REV
-             * only write their own dword, so the other dword (stencil
-             * or depth) is preserved. */
-            if (srcFormat != GL_STENCIL_INDEX)
-               _mesa_unpack_depth_span(ctx, srcWidth,
-                                       GL_FLOAT_32_UNSIGNED_INT_24_8_REV, /* dst type */
-                                       dstRow, /* dst addr */
-                                       ~0U, srcType, src, srcPacking);
-
-            if (srcFormat != GL_DEPTH_COMPONENT)
-               _mesa_unpack_stencil_span(ctx, srcWidth,
-                                         GL_FLOAT_32_UNSIGNED_INT_24_8_REV, /* dst type */
-                                         dstRow, /* dst addr */
-                                         srcType, src, srcPacking,
-                                         ctx->_ImageTransferState);
+         if (srcFormat != GL_DEPTH_COMPONENT)
+            _mesa_unpack_stencil_span(ctx, srcWidth,
+                                      GL_FLOAT_32_UNSIGNED_INT_24_8_REV, /* dst type */
+                                      dstRow, /* dst addr */
+                                      srcType, src, srcPacking,
+                                      ctx->_ImageTransferState);
 
-            src += srcRowStride;
-            dstRow += dstRowStride / sizeof(uint64_t);
-         }
+         src += srcRowStride;
+         dstRow += dstRowStride / sizeof(uint64_t);
       }
    }
    return GL_TRUE;
@@ -3699,10 +3686,10 @@ _mesa_get_texstore_func(mesa_format format)
       table[MESA_FORMAT_G16R16_UNORM] = _mesa_texstore_unorm1616;
       table[MESA_FORMAT_B10G10R10A2_UNORM] = _mesa_texstore_argb2101010;
       table[MESA_FORMAT_S8_UINT_Z24_UNORM] = _mesa_texstore_z24_s8;
-      table[MESA_FORMAT_Z24_UNORM_X8_UINT] = _mesa_texstore_s8_z24;
+      table[MESA_FORMAT_Z24_UNORM_S8_UINT] = _mesa_texstore_s8_z24;
       table[MESA_FORMAT_Z_UNORM16] = _mesa_texstore_z16;
-      table[MESA_FORMAT_Z24_UNORM_S8_UINT] = _mesa_texstore_x8_z24;
-      table[MESA_FORMAT_X8Z24_UNORM] = _mesa_texstore_z24_x8;
+      table[MESA_FORMAT_Z24_UNORM_X8_UINT] = _mesa_texstore_x8_z24;
+      table[MESA_FORMAT_X8_UINT_Z24_UNORM] = _mesa_texstore_z24_x8;
       table[MESA_FORMAT_Z_UNORM32] = _mesa_texstore_z32;
       table[MESA_FORMAT_S_UINT8] = _mesa_texstore_s8;
       table[MESA_FORMAT_BGR_SRGB8] = _mesa_texstore_srgb8;
@@ -3737,24 +3724,24 @@ _mesa_get_texstore_func(mesa_format format)
       table[MESA_FORMAT_RG_FLOAT32] = _mesa_texstore_rgba_float32;
       table[MESA_FORMAT_RG_FLOAT16] = _mesa_texstore_rgba_float16;
       table[MESA_FORMAT_DUDV8] = _mesa_texstore_dudv8;
-      table[MESA_FORMAT_SIGNED_R8] = _mesa_texstore_snorm8;
-      table[MESA_FORMAT_SIGNED_RG88_REV] = _mesa_texstore_snorm88;
-      table[MESA_FORMAT_SIGNED_RGBX8888] = _mesa_texstore_signed_rgbx8888;
-      table[MESA_FORMAT_SIGNED_RGBA8888] = _mesa_texstore_signed_rgba8888;
-      table[MESA_FORMAT_SIGNED_RGBA8888_REV] = _mesa_texstore_signed_rgba8888;
-      table[MESA_FORMAT_SIGNED_R16] = _mesa_texstore_snorm16;
-      table[MESA_FORMAT_SIGNED_GR1616] = _mesa_texstore_snorm1616;
-      table[MESA_FORMAT_SIGNED_RGB_16] = _mesa_texstore_signed_rgba_16;
-      table[MESA_FORMAT_SIGNED_RGBA_16] = _mesa_texstore_signed_rgba_16;
+      table[MESA_FORMAT_R_SNORM8] = _mesa_texstore_snorm8;
+      table[MESA_FORMAT_R8G8_SNORM] = _mesa_texstore_snorm88;
+      table[MESA_FORMAT_X8B8G8R8_SNORM] = _mesa_texstore_signed_rgbx8888;
+      table[MESA_FORMAT_A8B8G8R8_SNORM] = _mesa_texstore_signed_rgba8888;
+      table[MESA_FORMAT_R8G8B8A8_SNORM] = _mesa_texstore_signed_rgba8888;
+      table[MESA_FORMAT_R_SNORM16] = _mesa_texstore_snorm16;
+      table[MESA_FORMAT_R16G16_SNORM] = _mesa_texstore_snorm1616;
+      table[MESA_FORMAT_RGB_SNORM16] = _mesa_texstore_signed_rgba_16;
+      table[MESA_FORMAT_RGBA_SNORM16] = _mesa_texstore_signed_rgba_16;
       table[MESA_FORMAT_RGBA_UNORM16] = _mesa_texstore_rgba_16;
-      table[MESA_FORMAT_RED_RGTC1] = _mesa_texstore_red_rgtc1;
-      table[MESA_FORMAT_SIGNED_RED_RGTC1] = _mesa_texstore_signed_red_rgtc1;
-      table[MESA_FORMAT_RG_RGTC2] = _mesa_texstore_rg_rgtc2;
-      table[MESA_FORMAT_SIGNED_RG_RGTC2] = _mesa_texstore_signed_rg_rgtc2;
-      table[MESA_FORMAT_L_LATC1] = _mesa_texstore_red_rgtc1;
-      table[MESA_FORMAT_SIGNED_L_LATC1] = _mesa_texstore_signed_red_rgtc1;
-      table[MESA_FORMAT_LA_LATC2] = _mesa_texstore_rg_rgtc2;
-      table[MESA_FORMAT_SIGNED_LA_LATC2] = _mesa_texstore_signed_rg_rgtc2;
+      table[MESA_FORMAT_R_RGTC1_UNORM] = _mesa_texstore_red_rgtc1;
+      table[MESA_FORMAT_R_RGTC1_SNORM] = _mesa_texstore_signed_red_rgtc1;
+      table[MESA_FORMAT_RG_RGTC2_UNORM] = _mesa_texstore_rg_rgtc2;
+      table[MESA_FORMAT_RG_RGTC2_SNORM] = _mesa_texstore_signed_rg_rgtc2;
+      table[MESA_FORMAT_L_LATC1_UNORM] = _mesa_texstore_red_rgtc1;
+      table[MESA_FORMAT_L_LATC1_SNORM] = _mesa_texstore_signed_red_rgtc1;
+      table[MESA_FORMAT_LA_LATC2_UNORM] = _mesa_texstore_rg_rgtc2;
+      table[MESA_FORMAT_LA_LATC2_SNORM] = _mesa_texstore_signed_rg_rgtc2;
       table[MESA_FORMAT_ETC1_RGB8] = _mesa_texstore_etc1_rgb8;
       table[MESA_FORMAT_ETC2_RGB8] = _mesa_texstore_etc2_rgb8;
       table[MESA_FORMAT_ETC2_SRGB8] = _mesa_texstore_etc2_srgb8;
@@ -3768,14 +3755,14 @@ _mesa_get_texstore_func(mesa_format format)
          _mesa_texstore_etc2_rgb8_punchthrough_alpha1;
       table[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1] =
          _mesa_texstore_etc2_srgb8_punchthrough_alpha1;
-      table[MESA_FORMAT_SIGNED_A8] = _mesa_texstore_snorm8;
-      table[MESA_FORMAT_SIGNED_L8] = _mesa_texstore_snorm8;
-      table[MESA_FORMAT_SIGNED_AL88] = _mesa_texstore_snorm88;
-      table[MESA_FORMAT_SIGNED_I8] = _mesa_texstore_snorm8;
-      table[MESA_FORMAT_SIGNED_A16] = _mesa_texstore_snorm16;
-      table[MESA_FORMAT_SIGNED_L16] = _mesa_texstore_snorm16;
-      table[MESA_FORMAT_SIGNED_AL1616] = _mesa_texstore_snorm1616;
-      table[MESA_FORMAT_SIGNED_I16] = _mesa_texstore_snorm16;
+      table[MESA_FORMAT_A_SNORM8] = _mesa_texstore_snorm8;
+      table[MESA_FORMAT_L_SNORM8] = _mesa_texstore_snorm8;
+      table[MESA_FORMAT_L8A8_SNORM] = _mesa_texstore_snorm88;
+      table[MESA_FORMAT_I_SNORM8] = _mesa_texstore_snorm8;
+      table[MESA_FORMAT_A_SNORM16] = _mesa_texstore_snorm16;
+      table[MESA_FORMAT_L_SNORM16] = _mesa_texstore_snorm16;
+      table[MESA_FORMAT_LA_SNORM16] = _mesa_texstore_snorm1616;
+      table[MESA_FORMAT_I_SNORM16] = _mesa_texstore_snorm16;
       table[MESA_FORMAT_R9G9B9E5_FLOAT] = _mesa_texstore_rgb9_e5;
       table[MESA_FORMAT_R11G11B10_FLOAT] = _mesa_texstore_r11_g11_b10f;
       table[MESA_FORMAT_Z_FLOAT32] = _mesa_texstore_z32;
@@ -3809,18 +3796,18 @@ _mesa_get_texstore_func(mesa_format format)
       table[MESA_FORMAT_LA_SINT16] = _mesa_texstore_rgba_int16;
       table[MESA_FORMAT_LA_SINT32] = _mesa_texstore_rgba_int32;
 
-      table[MESA_FORMAT_R_INT8] = _mesa_texstore_rgba_int8;
-      table[MESA_FORMAT_RG_INT8] = _mesa_texstore_rgba_int8;
-      table[MESA_FORMAT_RGB_INT8] = _mesa_texstore_rgba_int8;
-      table[MESA_FORMAT_RGBA_INT8] = _mesa_texstore_rgba_int8;
-      table[MESA_FORMAT_R_INT16] = _mesa_texstore_rgba_int16;
-      table[MESA_FORMAT_RG_INT16] = _mesa_texstore_rgba_int16;
-      table[MESA_FORMAT_RGB_INT16] = _mesa_texstore_rgba_int16;
-      table[MESA_FORMAT_RGBA_INT16] = _mesa_texstore_rgba_int16;
-      table[MESA_FORMAT_R_INT32] = _mesa_texstore_rgba_int32;
-      table[MESA_FORMAT_RG_INT32] = _mesa_texstore_rgba_int32;
-      table[MESA_FORMAT_RGB_INT32] = _mesa_texstore_rgba_int32;
-      table[MESA_FORMAT_RGBA_INT32] = _mesa_texstore_rgba_int32;
+      table[MESA_FORMAT_R_SINT8] = _mesa_texstore_rgba_int8;
+      table[MESA_FORMAT_RG_SINT8] = _mesa_texstore_rgba_int8;
+      table[MESA_FORMAT_RGB_SINT8] = _mesa_texstore_rgba_int8;
+      table[MESA_FORMAT_RGBA_SINT8] = _mesa_texstore_rgba_int8;
+      table[MESA_FORMAT_R_SINT16] = _mesa_texstore_rgba_int16;
+      table[MESA_FORMAT_RG_SINT16] = _mesa_texstore_rgba_int16;
+      table[MESA_FORMAT_RGB_SINT16] = _mesa_texstore_rgba_int16;
+      table[MESA_FORMAT_RGBA_SINT16] = _mesa_texstore_rgba_int16;
+      table[MESA_FORMAT_R_SINT32] = _mesa_texstore_rgba_int32;
+      table[MESA_FORMAT_RG_SINT32] = _mesa_texstore_rgba_int32;
+      table[MESA_FORMAT_RGB_SINT32] = _mesa_texstore_rgba_int32;
+      table[MESA_FORMAT_RGBA_SINT32] = _mesa_texstore_rgba_int32;
 
       table[MESA_FORMAT_R_UINT8] = _mesa_texstore_rgba_uint8;
       table[MESA_FORMAT_RG_UINT8] = _mesa_texstore_rgba_uint8;
@@ -3842,6 +3829,7 @@ _mesa_get_texstore_func(mesa_format format)
       table[MESA_FORMAT_B5G5R5X1_UNORM] = store_ubyte_texture;
       table[MESA_FORMAT_R8G8B8X8_SNORM] = _mesa_texstore_signed_rgbx8888;
       table[MESA_FORMAT_R8G8B8X8_SRGB] = _mesa_texstore_srgba8;
+      table[MESA_FORMAT_R8G8B8A8_SRGB] = _mesa_texstore_srgba8;
       table[MESA_FORMAT_RGBX_UINT8] = _mesa_texstore_rgba_uint8;
       table[MESA_FORMAT_RGBX_SINT8] = _mesa_texstore_rgba_int8;
       table[MESA_FORMAT_B10G10R10X2_UNORM] = _mesa_texstore_argb2101010;
@@ -3856,8 +3844,10 @@ _mesa_get_texstore_func(mesa_format format)
 
       table[MESA_FORMAT_R10G10B10A2_UNORM] = _mesa_texstore_abgr2101010;
 
-      table[MESA_FORMAT_SIGNED_RG88] = _mesa_texstore_snorm88;
-      table[MESA_FORMAT_SIGNED_RG1616] = _mesa_texstore_snorm1616;
+      table[MESA_FORMAT_G8R8_SNORM] = _mesa_texstore_snorm88;
+      table[MESA_FORMAT_G16R16_SNORM] = _mesa_texstore_snorm1616;
+
+      table[MESA_FORMAT_B8G8R8X8_SRGB] = _mesa_texstore_sargb8;
 
       initialized = GL_TRUE;
    }