From: José Fonseca Date: Mon, 29 Mar 2010 16:29:27 +0000 (+0100) Subject: util: Distinguish between the different compression formats. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b9ad95d3ee9178dce9320d28b20d23d97370f7bd;p=mesa.git util: Distinguish between the different compression formats. In particular, all current uses of util_format_is_compressed() actually mean s3tc. --- diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index d2a925141b1..d819bbbde1c 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -110,14 +110,18 @@ PIPE_FORMAT_UYVY , subsampled, 2, 1, x32 , , , , xyz PIPE_FORMAT_YUYV , subsampled, 2, 1, x32 , , , , xyz1, yuv # Compressed formats -PIPE_FORMAT_DXT1_RGB , compressed, 4, 4, x64 , , , , xyz1, rgb -PIPE_FORMAT_DXT1_RGBA , compressed, 4, 4, x64 , , , , xyzw, rgb -PIPE_FORMAT_DXT3_RGBA , compressed, 4, 4, x128, , , , xyzw, rgb -PIPE_FORMAT_DXT5_RGBA , compressed, 4, 4, x128, , , , xyzw, rgb -PIPE_FORMAT_DXT1_SRGB , compressed, 4, 4, x64 , , , , xyz1, srgb -PIPE_FORMAT_DXT1_SRGBA , compressed, 4, 4, x64 , , , , xyzw, srgb -PIPE_FORMAT_DXT3_SRGBA , compressed, 4, 4, x128, , , , xyzw, srgb -PIPE_FORMAT_DXT5_SRGBA , compressed, 4, 4, x128, , , , xyzw, srgb +# - http://en.wikipedia.org/wiki/S3_Texture_Compression +# - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt +# - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt +# - http://msdn.microsoft.com/en-us/library/bb694531.aspx +PIPE_FORMAT_DXT1_RGB , s3tc, 4, 4, x64 , , , , xyz1, rgb +PIPE_FORMAT_DXT1_RGBA , s3tc, 4, 4, x64 , , , , xyzw, rgb +PIPE_FORMAT_DXT3_RGBA , s3tc, 4, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_DXT5_RGBA , s3tc, 4, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_DXT1_SRGB , s3tc, 4, 4, x64 , , , , xyz1, srgb +PIPE_FORMAT_DXT1_SRGBA , s3tc, 4, 4, x64 , , , , xyzw, srgb +PIPE_FORMAT_DXT3_SRGBA , s3tc, 4, 4, x128, , , , xyzw, srgb +PIPE_FORMAT_DXT5_SRGBA , s3tc, 4, 4, x128, , , , xyzw, srgb # Straightforward D3D10-like formats (also used for # vertex buffer element description) diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index c08fdcafcc8..98d4b98ebb5 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -56,15 +56,23 @@ enum util_format_layout { * * This is for formats like YV12 where there is less than one sample per * pixel. - * - * XXX: This could actually b */ UTIL_FORMAT_LAYOUT_SUBSAMPLED = 3, /** - * An unspecified compression algorithm. + * S3 Texture Compression formats. + */ + UTIL_FORMAT_LAYOUT_S3TC = 4, + + /** + * Red-Green Texture Compression formats. + */ + UTIL_FORMAT_LAYOUT_RGTC = 5, + + /** + * Everything else that doesn't fit in any of the above layouts. */ - UTIL_FORMAT_LAYOUT_COMPRESSED = 4 + UTIL_FORMAT_LAYOUT_OTHER = 6 }; @@ -210,7 +218,7 @@ util_format_name(enum pipe_format format) } static INLINE boolean -util_format_is_compressed(enum pipe_format format) +util_format_is_s3tc(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); @@ -219,7 +227,7 @@ util_format_is_compressed(enum pipe_format format) return FALSE; } - return desc->layout == UTIL_FORMAT_LAYOUT_COMPRESSED ? TRUE : FALSE; + return desc->layout == UTIL_FORMAT_LAYOUT_S3TC ? TRUE : FALSE; } static INLINE boolean