diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c index ca9d91932ac..625d8d85897 100644 --- a/src/mesa/main/format_utils.c +++ b/src/mesa/main/format_utils.c @@ -666,127 +666,6 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride, } } -static const uint8_t map_identity[7] = { 0, 1, 2, 3, 4, 5, 6 }; -#if UTIL_ARCH_BIG_ENDIAN -static const uint8_t map_3210[7] = { 3, 2, 1, 0, 4, 5, 6 }; -static const uint8_t map_1032[7] = { 1, 0, 3, 2, 4, 5, 6 }; -#endif - -/** - * Describes a format as an array format, if possible - * - * A helper function for figuring out if a (possibly packed) format is - * actually an array format and, if so, what the array parameters are. - * - * \param[in] format the mesa format - * \param[out] type the GL type of the array (GL_BYTE, etc.) - * \param[out] num_components the number of components in the array - * \param[out] swizzle a swizzle describing how to get from the - * given format to RGBA - * \param[out] normalized for integer formats, this represents whether - * the format is a normalized integer or a - * regular integer - * \return true if this format is an array format, false otherwise - */ -bool -_mesa_format_to_array(mesa_format format, GLenum *type, int *num_components, - uint8_t swizzle[4], bool *normalized) -{ - int i; - GLuint format_components; - uint8_t packed_swizzle[4]; - const uint8_t *endian; - - if (_mesa_is_format_compressed(format)) - return false; - - *normalized = !_mesa_is_format_integer(format); - - _mesa_uncompressed_format_to_type_and_comps(format, type, &format_components); - - switch (_mesa_get_format_layout(format)) { - case MESA_FORMAT_LAYOUT_ARRAY: - *num_components = format_components; - _mesa_get_format_swizzle(format, swizzle); - return true; - case MESA_FORMAT_LAYOUT_PACKED: - switch (*type) { - case GL_UNSIGNED_BYTE: - case GL_BYTE: - if (_mesa_get_format_max_bits(format) != 8) - return false; - *num_components = _mesa_get_format_bytes(format); - switch (*num_components) { - case 1: - endian = map_identity; - break; - case 2: -#if UTIL_ARCH_LITTLE_ENDIAN - endian = map_identity; -#else - endian = map_1032; -#endif - break; - case 4: -#if UTIL_ARCH_LITTLE_ENDIAN - endian = map_identity; -#else - endian = map_3210; -#endif - break; - default: - endian = map_identity; - assert(!"Invalid number of components"); - } - break; - case GL_UNSIGNED_SHORT: - case GL_SHORT: - case GL_HALF_FLOAT: - if (_mesa_get_format_max_bits(format) != 16) - return false; - *num_components = _mesa_get_format_bytes(format) / 2; - switch (*num_components) { - case 1: - endian = map_identity; - break; - case 2: -#if UTIL_ARCH_LITTLE_ENDIAN - endian = map_identity; -#else - endian = map_1032; -#endif - break; - default: - endian = map_identity; - assert(!"Invalid number of components"); - } - break; - case GL_UNSIGNED_INT: - case GL_INT: - case GL_FLOAT: - /* This isn't packed. At least not really. */ - assert(format_components == 1); - if (_mesa_get_format_max_bits(format) != 32) - return false; - *num_components = format_components; - endian = map_identity; - break; - default: - return false; - } - - _mesa_get_format_swizzle(format, packed_swizzle); - - for (i = 0; i < 4; ++i) - swizzle[i] = endian[packed_swizzle[i]]; - - return true; - case MESA_FORMAT_LAYOUT_OTHER: - default: - return false; - } -} - /** * Attempts to perform the given swizzle-and-convert operation with memcpy * diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h index b4e8f99fe60..d19ee408a48 100644 --- a/src/mesa/main/format_utils.h +++ b/src/mesa/main/format_utils.h @@ -43,10 +43,6 @@ extern const mesa_array_format RGBA8_UBYTE; extern const mesa_array_format RGBA32_UINT; extern const mesa_array_format RGBA32_INT; -bool -_mesa_format_to_array(mesa_format, GLenum *type, int *num_components, - uint8_t swizzle[4], bool *normalized); - void _mesa_swizzle_and_convert(void *dst, enum mesa_array_format_datatype dst_type,