uint32_t depth = prsc->depth0;
for (level = 0; level <= prsc->last_level; level++) {
- struct fd_resource_slice *slice = fd_resource_slice(rsc, level);
+ struct fdl_slice *slice = fd_resource_slice(rsc, level);
uint32_t blocks;
/* 32 * 32 block alignment */
height = util_next_power_of_two(height);
}
- slice->pitch = width;
+ slice->pitch = util_format_get_nblocksx(format, width) * rsc->layout.cpp;
slice->offset = size;
blocks = util_format_get_nblocks(format, width, height);
/* 4k aligned size */
- slice->size0 = align(blocks * rsc->cpp, 4096);
+ slice->size0 = align(blocks * rsc->layout.cpp, 4096);
size += slice->size0 * depth * prsc->array_size;
}
return size;
}
+
+unsigned
+fd2_tile_mode(const struct pipe_resource *tmpl)
+{
+ /* disable tiling for cube maps, freedreno uses a 2D array for the staging texture,
+ * (a2xx supports 2D arrays but it is not implemented)
+ */
+ if (tmpl->target == PIPE_TEXTURE_CUBE)
+ return 0;
+ /* we can enable tiling for any resource we can render to */
+ return (tmpl->bind & PIPE_BIND_RENDER_TARGET) ? 1 : 0;
+}