summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2015-10-05 17:27:32 -0700
committerNanley Chery <[email protected]>2015-11-09 15:41:41 -0800
commit381f602c6bca3d2eeef8bbeb6a96260bf93327a9 (patch)
tree324e0590b1f1d9b731c41f81a22ffcdb9379a74e /src/vulkan
parent300f7c2be34f9d20497b4127020d520de1c09ba5 (diff)
anv/image: Handle compressed format qpitch and padding
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/anv_image.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c
index 7051ac746f2..affabd1aebf 100644
--- a/src/vulkan/anv_image.c
+++ b/src/vulkan/anv_image.c
@@ -185,7 +185,8 @@ anv_image_make_surface(const struct anv_image_create_info *create_info,
* Views >> Common Surface Formats >> Surface Layout >> 2D Surfaces >>
* Surface Arrays >> For All Surface Other Than Separate Stencil Buffer:
*/
- qpitch = h0 + h1 + 11 * j;
+ assert(format->bh == 1 || format->bh == 4);
+ qpitch = (h0 + h1 + 11 * j) / format->bh;
mt_width = MAX(w0, w1 + w2);
mt_height = array_size * qpitch;
}
@@ -230,8 +231,12 @@ anv_image_make_surface(const struct anv_image_create_info *create_info,
if (create_info->stride > 0)
stride = create_info->stride;
- const uint32_t size = stride * align_u32(mt_height / format->bh,
- tile_info->height);
+ /* The padding requirement is found in the Broadwell PRM >> Volume 5: Memory
+ * Views >> Common Surface Formats >> Surface Padding Requirements >>
+ * Sampling Engine Surfaces >> Buffer Padding Requirements:
+ */
+ const uint32_t mem_rows = align_u32(mt_height / format->bh, 2 * format->bh);
+ const uint32_t size = stride * align_u32(mem_rows, tile_info->height);
const uint32_t offset = align_u32(*inout_image_size,
tile_info->surface_alignment);