summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2015-05-31 13:29:41 -0700
committerNanley Chery <[email protected]>2015-08-26 14:36:43 -0700
commit9a759a6ee002203a045e9df1f91823204609fd4a (patch)
tree1a1593ca26230b3885851b579e16f6e20ddee9ac /src
parent42ee16176dca797c395592b0245f370ea58ca3a8 (diff)
swrast: add a new macro, FETCH_COMPRESSED
This patch creates a new macro, FETCH_COMPRESSED - similar in nature to the other FETCH_* macros. This reduces repetition in the code that deals with compressed textures. Reviewed-by: Anuj Phogat <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/swrast/s_texfetch.c239
1 files changed, 41 insertions, 198 deletions
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index 754d982bcd5..acb06e6ae92 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -116,6 +116,14 @@ static void fetch_null_texelf( const struct swrast_texture_image *texImage,
NULL \
}
+#define FETCH_COMPRESSED(NAME) \
+ { \
+ MESA_FORMAT_ ## NAME, \
+ fetch_compressed, \
+ fetch_compressed, \
+ fetch_compressed \
+ }
+
/**
* Table to map MESA_FORMAT_ to texel fetch/store funcs.
*/
@@ -344,214 +352,49 @@ texfetch_funcs[] =
FETCH_NULL(RGBX_SINT32),
/* DXT compressed formats */
- {
- MESA_FORMAT_RGB_DXT1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_RGBA_DXT1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_RGBA_DXT3,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_RGBA_DXT5,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
+ FETCH_COMPRESSED(RGB_DXT1),
+ FETCH_COMPRESSED(RGBA_DXT1),
+ FETCH_COMPRESSED(RGBA_DXT3),
+ FETCH_COMPRESSED(RGBA_DXT5),
/* DXT sRGB compressed formats */
- {
- MESA_FORMAT_SRGB_DXT1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_SRGBA_DXT1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_SRGBA_DXT3,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_SRGBA_DXT5,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
+ FETCH_COMPRESSED(SRGB_DXT1),
+ FETCH_COMPRESSED(SRGBA_DXT1),
+ FETCH_COMPRESSED(SRGBA_DXT3),
+ FETCH_COMPRESSED(SRGBA_DXT5),
/* FXT1 compressed formats */
- {
- MESA_FORMAT_RGB_FXT1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_RGBA_FXT1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
+ FETCH_COMPRESSED(RGB_FXT1),
+ FETCH_COMPRESSED(RGBA_FXT1),
/* RGTC compressed formats */
- {
- MESA_FORMAT_R_RGTC1_UNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_R_RGTC1_SNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_RG_RGTC2_UNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_RG_RGTC2_SNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
+ FETCH_COMPRESSED(R_RGTC1_UNORM),
+ FETCH_COMPRESSED(R_RGTC1_SNORM),
+ FETCH_COMPRESSED(RG_RGTC2_UNORM),
+ FETCH_COMPRESSED(RG_RGTC2_SNORM),
/* LATC1/2 compressed formats */
- {
- MESA_FORMAT_L_LATC1_UNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_L_LATC1_SNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_LA_LATC2_UNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_LA_LATC2_SNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
+ FETCH_COMPRESSED(L_LATC1_UNORM),
+ FETCH_COMPRESSED(L_LATC1_SNORM),
+ FETCH_COMPRESSED(LA_LATC2_UNORM),
+ FETCH_COMPRESSED(LA_LATC2_SNORM),
/* ETC1/2 compressed formats */
- {
- MESA_FORMAT_ETC1_RGB8,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_RGB8,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_SRGB8,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_RGBA8_EAC,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_R11_EAC,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_RG11_EAC,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_SIGNED_R11_EAC,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_SIGNED_RG11_EAC,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_BPTC_RGBA_UNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
- {
- MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT,
- fetch_compressed,
- fetch_compressed,
- fetch_compressed
- },
+ FETCH_COMPRESSED(ETC1_RGB8),
+ FETCH_COMPRESSED(ETC2_RGB8),
+ FETCH_COMPRESSED(ETC2_SRGB8),
+ FETCH_COMPRESSED(ETC2_RGBA8_EAC),
+ FETCH_COMPRESSED(ETC2_SRGB8_ALPHA8_EAC),
+ FETCH_COMPRESSED(ETC2_R11_EAC),
+ FETCH_COMPRESSED(ETC2_RG11_EAC),
+ FETCH_COMPRESSED(ETC2_SIGNED_R11_EAC),
+ FETCH_COMPRESSED(ETC2_SIGNED_RG11_EAC),
+ FETCH_COMPRESSED(ETC2_RGB8_PUNCHTHROUGH_ALPHA1),
+ FETCH_COMPRESSED(ETC2_SRGB8_PUNCHTHROUGH_ALPHA1),
+ FETCH_COMPRESSED(BPTC_RGBA_UNORM),
+ FETCH_COMPRESSED(BPTC_SRGB_ALPHA_UNORM),
+ FETCH_COMPRESSED(BPTC_RGB_SIGNED_FLOAT),
+ FETCH_COMPRESSED(BPTC_RGB_UNSIGNED_FLOAT),
/* ASTC compressed formats */
FETCH_NULL(RGBA_ASTC_4x4),