anv/image: Handle compressed format stride and size
authorNanley Chery <nanley.g.chery@intel.com>
Tue, 29 Sep 2015 00:51:30 +0000 (17:51 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Mon, 9 Nov 2015 23:41:41 +0000 (15:41 -0800)
These formulas did not take compressed formats into account.

Reviewed-by: Chad Versace <chad.versace@intel.com>
src/vulkan/anv_image.c

index 8aa74c2e191a56f7fb0bc11a6d184401977eed0e..7051ac746f29c71cb9f197ac83483dfcc821b9df 100644 (file)
@@ -225,11 +225,13 @@ anv_image_make_surface(const struct anv_image_create_info *create_info,
     */
    assert(anv_is_aligned(qpitch, j));
 
-   uint32_t stride = align_u32(mt_width * format->bs, tile_info->width);
+   uint32_t stride = align_u32(mt_width * format->bs / format->bw,
+                               tile_info->width);
    if (create_info->stride > 0)
       stride = create_info->stride;
 
-   const uint32_t size = stride * align_u32(mt_height, tile_info->height);
+   const uint32_t size = stride * align_u32(mt_height / format->bh,
+                                            tile_info->height);
    const uint32_t offset = align_u32(*inout_image_size,
                                      tile_info->surface_alignment);