[Mesa-dev] [PATCH 21/26] i965: Merge qpitch return paths
Topi Pohjolainen
topi.pohjolainen at gmail.com
Tue Oct 11 19:26:53 UTC 2016
Upcoming patches need to consider if additional alignment is
needed for arrayed/mipmapped and single-sampled mcs buffer.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_tex_layout.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 4618bc0..94ded33 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -382,6 +382,8 @@ brw_miptree_get_vertical_slice_pitch(const struct brw_context *brw,
const struct intel_mipmap_tree *mt,
unsigned level)
{
+ unsigned qpitch;
+
if (brw->gen >= 9) {
/* ALL_SLICES_AT_EACH_LOD isn't supported on Gen8+ but this code will
* effectively end up with a packed qpitch anyway whenever
@@ -392,7 +394,7 @@ brw_miptree_get_vertical_slice_pitch(const struct brw_context *brw,
/* On Gen9 we can pick whatever qpitch we like as long as it's aligned
* to the vertical alignment so we don't need to add any extra rows.
*/
- unsigned qpitch = mt->total_height;
+ qpitch = mt->total_height;
/* If the surface might be used as a stencil buffer or HiZ buffer then
* it needs to be a multiple of 8.
@@ -407,19 +409,18 @@ brw_miptree_get_vertical_slice_pitch(const struct brw_context *brw,
if (mt->target == GL_TEXTURE_3D)
qpitch = ALIGN(qpitch, 32);
- return qpitch;
-
} else if (mt->target == GL_TEXTURE_3D ||
(brw->gen == 4 && mt->target == GL_TEXTURE_CUBE_MAP) ||
mt->array_layout == ALL_SLICES_AT_EACH_LOD) {
- return ALIGN_NPOT(minify(mt->physical_height0, level), mt->valign);
-
+ qpitch = ALIGN_NPOT(minify(mt->physical_height0, level), mt->valign);
} else {
const unsigned h0 = ALIGN_NPOT(mt->physical_height0, mt->valign);
const unsigned h1 = ALIGN_NPOT(minify(mt->physical_height0, 1), mt->valign);
- return h0 + h1 + (brw->gen >= 7 ? 12 : 11) * mt->valign;
+ qpitch = h0 + h1 + (brw->gen >= 7 ? 12 : 11) * mt->valign;
}
+
+ return qpitch;
}
static void
--
2.5.5
More information about the mesa-dev
mailing list