summaryrefslogtreecommitdiffstats
path: root/src/isl/isl.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2016-01-04 16:31:10 -0800
committerChad Versace <[email protected]>2016-01-04 16:48:58 -0800
commit8cc21d3aeaf14e16f2431ff3bdd5fa7c2e780b77 (patch)
tree81afc0a4d121de47ba6c3d1dc65e84bf84986de5 /src/isl/isl.c
parent151694228d818db2ba3124acfe2eb1eeaff4dd2f (diff)
isl: Align single-level 2D surfaces to compression block
This fixes an assertion failure at isl.c:1003. Reported-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/isl/isl.c')
-rw-r--r--src/isl/isl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/isl/isl.c b/src/isl/isl.c
index 00eb249b23f..eee612826ce 100644
--- a/src/isl/isl.c
+++ b/src/isl/isl.c
@@ -519,24 +519,30 @@ isl_calc_phys_slice0_extent_sa_gen4_2d(
const struct isl_extent4d *phys_level0_sa,
struct isl_extent2d *phys_slice0_sa)
{
+ const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
+
assert(phys_level0_sa->depth == 1);
- if (info->levels == 1) {
- /* Do not align single-level surfaces to the image alignment.
+ if (info->levels == 1 && msaa_layout != ISL_MSAA_LAYOUT_INTERLEAVED) {
+ /* Do not pad the surface to the image alignment. Instead, pad it only
+ * to the pixel format's block alignment.
*
- * For tiled surfaces, skipping the alignment here avoids wasting CPU
- * cycles on the below mipmap layout caluclations. Skipping the
+ * For tiled surfaces, using a reduced alignment here avoids wasting CPU
+ * cycles on the below mipmap layout caluclations. Reducing the
* alignment here is safe because we later align the row pitch and array
* pitch to the tile boundary. It is safe even for
* ISL_MSAA_LAYOUT_INTERLEAVED, because phys_level0_sa is already scaled
* to accomodate the interleaved samples.
*
- * For linear surfaces, skipping the alignment here permits us to later
+ * For linear surfaces, reducing the alignment here permits us to later
* choose an arbitrary, non-aligned row pitch. If the surface backs
* a VkBuffer, then an arbitrary pitch may be needed to accomodate
* VkBufferImageCopy::bufferRowLength.
*/
- *phys_slice0_sa = isl_extent2d(phys_level0_sa->w, phys_level0_sa->h);
+ *phys_slice0_sa = (struct isl_extent2d) {
+ .w = isl_align_npot(phys_level0_sa->w, fmtl->bw),
+ .h = isl_align_npot(phys_level0_sa->h, fmtl->bh),
+ };
return;
}