diff options
author | Brian Paul <[email protected]> | 2010-02-24 11:23:58 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-02-24 11:23:58 -0700 |
commit | 7802ef6f6978c68e732ed419e88d9af9f131b380 (patch) | |
tree | 0c12b578ae6c8615d9595b942dd9f744ef4b7c20 | |
parent | d7de632de39888dbc955055ba0eb3623e5335992 (diff) |
st/mesa: more format code clean-up and removal
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 71 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.h | 15 |
2 files changed, 18 insertions, 68 deletions
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 8789d4b750a..c414c7da614 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -60,11 +60,11 @@ format_max_bits(enum pipe_format format) } -/* - * XXX temporary here +/** + * Return basic GL datatype for the given gallium format. */ -GLboolean -st_get_format_info(enum pipe_format format, struct st_format_info *pinfo) +GLenum +st_format_datatype(enum pipe_format format) { const struct util_format_description *desc; @@ -72,85 +72,50 @@ st_get_format_info(enum pipe_format format, struct st_format_info *pinfo) assert(desc); if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN) { -#if 0 - printf("%s\n", util_format_name( format ) ); -#endif - - /* Data type */ - if (format == PIPE_FORMAT_A1R5G5B5_UNORM || format == PIPE_FORMAT_R5G6B5_UNORM) { - pinfo->datatype = GL_UNSIGNED_SHORT; + if (format == PIPE_FORMAT_A1R5G5B5_UNORM || + format == PIPE_FORMAT_R5G6B5_UNORM) { + return GL_UNSIGNED_SHORT; } else if (format == PIPE_FORMAT_S8Z24_UNORM || format == PIPE_FORMAT_Z24S8_UNORM) { - pinfo->datatype = GL_UNSIGNED_INT_24_8; + return GL_UNSIGNED_INT_24_8; } else { const GLuint size = format_max_bits(format); if (size == 8) { if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) - pinfo->datatype = GL_UNSIGNED_BYTE; + return GL_UNSIGNED_BYTE; else - pinfo->datatype = GL_BYTE; + return GL_BYTE; } else if (size == 16) { if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) - pinfo->datatype = GL_UNSIGNED_SHORT; + return GL_UNSIGNED_SHORT; else - pinfo->datatype = GL_SHORT; + return GL_SHORT; } else { assert( size <= 32 ); if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) - pinfo->datatype = GL_UNSIGNED_INT; + return GL_UNSIGNED_INT; else - pinfo->datatype = GL_INT; + return GL_INT; } } - - pinfo->mesa_format = st_pipe_format_to_mesa_format(format); } else if (format == PIPE_FORMAT_YCBCR) { - pinfo->mesa_format = MESA_FORMAT_YCBCR; - pinfo->datatype = GL_UNSIGNED_SHORT; + return GL_UNSIGNED_SHORT; } else if (format == PIPE_FORMAT_YCBCR_REV) { - pinfo->mesa_format = MESA_FORMAT_YCBCR_REV; - pinfo->datatype = GL_UNSIGNED_SHORT; + return GL_UNSIGNED_SHORT; } else { /* compressed format? */ assert(0); } -#if 0 - printf( - "ST_FORMAT: R(%u), G(%u), B(%u), A(%u), Z(%u), S(%u)\n", - pinfo->red_bits, - pinfo->green_bits, - pinfo->blue_bits, - pinfo->alpha_bits, - pinfo->depth_bits, - pinfo->stencil_bits ); -#endif - - pinfo->format = format; - - return GL_TRUE; -} - - -/** - * Return basic GL datatype for the given format. - */ -GLenum -st_format_datatype(enum pipe_format format) -{ - struct st_format_info info; - if (!st_get_format_info( format, &info )) { - assert( 0 ); - return 0; - } - return info.datatype; + assert(0); + return GL_NONE; } diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 721c6aeb3d8..6cc5a15b1de 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -32,21 +32,6 @@ #include "main/formats.h" -/** - * Information for mapping Mesa formats to Gallium formats. - */ -struct st_format_info -{ - enum pipe_format format; - gl_format mesa_format; - GLenum datatype; -}; - - -GLboolean -st_get_format_info(enum pipe_format format, struct st_format_info *pinfo); - - extern GLenum st_format_datatype(enum pipe_format format); |