anv/image: Determine the alignment units for compressed formats
authorNanley Chery <nanley.g.chery@intel.com>
Fri, 2 Oct 2015 23:11:24 +0000 (16:11 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Mon, 9 Nov 2015 23:41:41 +0000 (15:41 -0800)
Alignment units, i and j, match the compressed format block
width and height respectively.

v2: Don't assert against HALIGN* and VALIGN* enums (Chad)

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

index affabd1aebf7cc12e8ad4035bcde507d6b936575..247a75dd8f47bcfb6d22064832acb5362513e747 100644 (file)
@@ -152,8 +152,10 @@ anv_image_make_surface(const struct anv_image_create_info *create_info,
    const struct anv_tile_info *tile_info =
        &anv_tile_info_table[tile_mode];
 
-   const uint32_t i = 4; /* FINISHME: Stop hardcoding subimage alignment */
-   const uint32_t j = 4; /* FINISHME: Stop hardcoding subimage alignment */
+   const uint32_t i = MAX(4, format->bw); /* FINISHME: Stop hardcoding subimage alignment */
+   const uint32_t j = MAX(4, format->bh); /* FINISHME: Stop hardcoding subimage alignment */
+   assert(i == 4 || i == 8 || i == 16);
+   assert(j == 4 || j == 8 || j == 16);
 
    uint16_t qpitch = min_qpitch;
    uint32_t mt_width = 0;