diff options
author | Brian Paul <[email protected]> | 2012-12-08 15:19:44 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-12-14 06:33:08 -0700 |
commit | ccbe7db1e6ab4a731fbd11445c7b5c2aca00fc4e (patch) | |
tree | c2206a32b8f3653a89262cb0cfbf79cf72dbd3f9 | |
parent | ad3e39bb6dcb139c3eb6a460833f30ba0fb3e974 (diff) |
mesa: added _mesa_get_compressed_fetch_func()
-rw-r--r-- | src/mesa/main/texcompress.c | 33 | ||||
-rw-r--r-- | src/mesa/main/texcompress.h | 3 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 372a483faaa..9ad6a8b2e53 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -523,6 +523,39 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, /** + * Return a texel-fetch function for the given format, or NULL if + * invalid format. + */ +compressed_fetch_func +_mesa_get_compressed_fetch_func(gl_format format) +{ + switch (format) { + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_RGBA_DXT5: + return _mesa_get_dxt_fetch_func(format); + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: + return _mesa_get_fxt_fetch_func(format); + case MESA_FORMAT_RED_RGTC1: + case MESA_FORMAT_L_LATC1: + case MESA_FORMAT_SIGNED_RED_RGTC1: + case MESA_FORMAT_SIGNED_L_LATC1: + case MESA_FORMAT_RG_RGTC2: + case MESA_FORMAT_LA_LATC2: + case MESA_FORMAT_SIGNED_RG_RGTC2: + case MESA_FORMAT_SIGNED_LA_LATC2: + return _mesa_get_compressed_rgtc_func(format); + case MESA_FORMAT_ETC1_RGB8: + return _mesa_get_etc_fetch_func(format); + default: + return NULL; + } +} + + +/** * Decompress a compressed texture image, returning a GL_RGBA/GL_FLOAT image. * \param srcRowStride stride in bytes between rows of blocks in the * compressed source image. diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 7e3de0e9d5b..b45e7cf1b88 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -56,6 +56,9 @@ typedef void (*compressed_fetch_func)(const GLubyte *map, GLint i, GLint j, GLint k, GLfloat *texel); +extern compressed_fetch_func +_mesa_get_compressed_fetch_func(gl_format format); + extern void _mesa_decompress_image(gl_format format, GLuint width, GLuint height, |