for (unsigned f = first_face; f <= last_face; ++f) {
pointers_and_strides[idx++] =
panfrost_get_texture_address(rsrc, l, w*face_mult + f)
- + afbc_bit;
+ + afbc_bit + view->astc_stretch;
if (has_manual_stride) {
pointers_and_strides[idx++] =
}
}
+static uint8_t
+panfrost_compute_astc_stretch(
+ const struct util_format_description *desc)
+{
+ unsigned width = desc->block.width;
+ unsigned height = desc->block.height;
+ assert(width >= 4 && width <= 12);
+ assert(height >= 4 && height <= 12);
+ if (width == 12)
+ width = 11;
+ if (height == 12)
+ height = 11;
+ return ((height - 4) * 8) + (width - 4);
+}
+
static struct pipe_sampler_view *
panfrost_create_sampler_view(
struct pipe_context *pctx,
enum mali_format format = panfrost_find_format(desc);
+ if (format == MALI_ASTC_HDR_SUPP || format == MALI_ASTC_SRGB_SUPP)
+ so->astc_stretch = panfrost_compute_astc_stretch(desc);
+
/* Check if we need to set a custom stride by computing the "expected"
* stride and comparing it to what the BO actually wants. Only applies
* to linear textures, since tiled/compressed textures have strict
break;
}
+ if (desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
+ if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
+ return MALI_ASTC_SRGB_SUPP;
+ else
+ return MALI_ASTC_HDR_SUPP;
+ }
+
/* Formats must match in channel count */
assert(desc->nr_channels >= 1 && desc->nr_channels <= 4);
unsigned format = MALI_NR_CHANNELS(desc->nr_channels);
MALI_ETC2_R11_SNORM = MALI_FORMAT_COMPRESSED | 0x11,
MALI_ETC2_RG11_SNORM = MALI_FORMAT_COMPRESSED | 0x12,
MALI_ETC2_RGB8A1 = MALI_FORMAT_COMPRESSED | 0x13,
+ MALI_ASTC_SRGB_SUPP = MALI_FORMAT_COMPRESSED | 0x16,
+ MALI_ASTC_HDR_SUPP = MALI_FORMAT_COMPRESSED | 0x17,
MALI_RGB565 = MALI_FORMAT_SPECIAL | 0x0,
MALI_RGB5_A1_UNORM = MALI_FORMAT_SPECIAL | 0x2,