[Mesa-dev] [PATCH 1/7] i965: Create local temporaries for depth buffer slice dimensions.
Kenneth Graunke
kenneth at whitecape.org
Wed Sep 19 13:27:54 PDT 2012
We use these in a couple of places, and slice_width/height is a lot
shorter than mt->level[depth_irb->mt_level].width. Saves a few
dereferences as well.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_clear.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c
index ce40e52..c3c75df 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -103,6 +103,9 @@ brw_fast_clear_depth(struct gl_context *ctx)
if (!mt->hiz_mt)
return false;
+ unsigned slice_width = mt->level[depth_irb->mt_level].width;
+ unsigned slice_height = mt->level[depth_irb->mt_level].height;
+
/* We only handle full buffer clears -- otherwise you'd have to track whether
* a previous clear had happened at a different clear value and resolve it
* first.
@@ -116,13 +119,12 @@ brw_fast_clear_depth(struct gl_context *ctx)
/* The rendered area has to be 8x4 samples, not resolved pixels, so we look
* at the miptree slice dimensions instead of renderbuffer size.
*/
- if (mt->level[depth_irb->mt_level].width % 8 != 0 ||
- mt->level[depth_irb->mt_level].height % 4 != 0) {
+ if (slice_width % 8 != 0 || slice_height % 4 != 0) {
perf_debug("Failed to fast clear depth due to width/height %d,%d not "
"being aligned to 8,4. Possible 5%% performance win if "
"avoided\n",
- mt->level[depth_irb->mt_level].width,
- mt->level[depth_irb->mt_level].height);
+ slice_width,
+ slice_height);
return false;
}
--
1.7.11.4
More information about the mesa-dev
mailing list