* \param ptr address of the pixel block (or the texel if uncompressed)
* \param i, j the sub-block pixel coordinates. For non-compressed formats
* these will always be (0, 0).
+ * \param cache optional value pointing to a lp_build_format_cache structure
* \return a 4 element vector with the pixel's RGBA values.
*/
LLVMValueRef
if (format_matches_type(format_desc, type) &&
format_desc->block.bits <= type.width * 4 &&
/* XXX this shouldn't be needed */
- util_is_power_of_two(format_desc->block.bits)) {
+ util_is_power_of_two_or_zero(format_desc->block.bits)) {
LLVMValueRef packed;
LLVMTypeRef dst_vec_type = lp_build_vec_type(gallivm, type);
struct lp_type fetch_type;
util_format_fits_8unorm(format_desc) &&
type.width == 8 && type.norm == 1 && type.sign == 0 &&
type.fixed == 0 && type.floating == 0) {
- LLVMValueRef packed, res, chans[4], rgba[4];
+ LLVMValueRef packed, res = NULL, chans[4], rgba[4];
LLVMTypeRef dst_vec_type, conv_vec_type;
struct lp_type fetch_type, conv_type;
struct lp_build_context bld_conv;
conv_type = lp_type_int_vec(type.width*4, type.width * type.length);
dst_vec_type = lp_build_vec_type(gallivm, type);
conv_vec_type = lp_build_vec_type(gallivm, conv_type);
- lp_build_context_init(&bld, gallivm, conv_type);
+ lp_build_context_init(&bld_conv, gallivm, conv_type);
packed = lp_build_gather(gallivm, type.length/4,
format_desc->block.bits, fetch_type,
format_desc->block.width == 1 &&
format_desc->block.height == 1 &&
/* XXX this shouldn't be needed */
- util_is_power_of_two(format_desc->block.bits) &&
+ util_is_power_of_two_or_zero(format_desc->block.bits) &&
format_desc->block.bits <= 32 &&
format_desc->is_bitmask &&
!format_desc->is_mixed &&
* s3tc rgb formats
*/
- if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC && cache) {
+ if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
struct lp_type tmp_type;
LLVMValueRef tmp;
tmp_type.length = num_pixels * 4;
tmp_type.norm = TRUE;
- tmp = lp_build_fetch_cached_texels(gallivm,
+ tmp = lp_build_fetch_s3tc_rgba_aos(gallivm,
format_desc,
num_pixels,
base_ptr,