{
struct pipe_resource *prsc = &rsc->base;
enum pipe_format format = prsc->format;
- enum util_format_layout layout = util_format_description(format)->layout;
uint32_t level, size = 0;
uint32_t width = prsc->width0;
uint32_t height = prsc->height0;
alignment = 1;
}
+ /* 32 pixel alignment */
+ fdl_set_pitchalign(&rsc->layout, fdl_cpp_shift(&rsc->layout) + 5);
+
for (level = 0; level <= prsc->last_level; level++) {
struct fdl_slice *slice = fd_resource_slice(rsc, level);
- uint32_t blocks;
+ uint32_t pitch = fdl_pitch(&rsc->layout, level);
+ uint32_t nblocksy = util_format_get_nblocksy(format, height);
- if (layout == UTIL_FORMAT_LAYOUT_ASTC)
- width = util_align_npot(width, 32 * util_format_get_blockwidth(format));
- else
- width = align(width, 32);
- slice->pitch = util_format_get_nblocksx(format, width) * rsc->layout.cpp;
slice->offset = size;
- blocks = util_format_get_nblocks(format, width, height);
+
/* 3d textures can have different layer sizes for high levels, but the
* hw auto-sizer is buggy (or at least different than what this code
* does), so as soon as the layer size range gets into range, we stop
(level > 1 && fd_resource_slice(rsc, level - 1)->size0 <= 0xf000))
slice->size0 = fd_resource_slice(rsc, level - 1)->size0;
else
- slice->size0 = align(blocks * rsc->layout.cpp, alignment);
+ slice->size0 = align(nblocksy * pitch, alignment);
size += slice->size0 * depth * layers_in_level;