summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2013-11-19 18:51:48 -0800
committerIan Romanick <ian.d.romanick@intel.com>2013-11-23 12:55:04 -0800
commit79d727e06302e500c5dcb0e766f959a77510eb08 (patch)
treed2d96996d152131ff9236ef1db4256e35b23c341 /src/mesa
parent7f99ae72c402869b76f297f87e8ef5b236f5c113 (diff)
i965: Fix fast clear of depth buffers.
From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec: When the Clear or ClearBuffer* commands are used to clear a layered framebuffer attachment, all layers of the attachment are cleared. This patch fixes the fast depth clear path. Fixes piglit test "spec/!OpenGL 3.2/layered-rendering/clear-depth". Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (cherry picked from commit 08315233509f1fa7dc1e877aed2a8517296cf86e)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clear.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c
index a727e6ec41c..95a6490ccfb 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -181,8 +181,16 @@ brw_fast_clear_depth(struct gl_context *ctx)
*/
intel_batchbuffer_emit_mi_flush(brw);
- intel_hiz_exec(brw, mt, depth_irb->mt_level, depth_irb->mt_layer,
- GEN6_HIZ_OP_DEPTH_CLEAR);
+ if (fb->NumLayers > 0) {
+ assert(fb->NumLayers == depth_irb->mt->level[depth_irb->mt_level].depth);
+ for (unsigned layer = 0; layer < fb->NumLayers; layer++) {
+ intel_hiz_exec(brw, mt, depth_irb->mt_level, layer,
+ GEN6_HIZ_OP_DEPTH_CLEAR);
+ }
+ } else {
+ intel_hiz_exec(brw, mt, depth_irb->mt_level, depth_irb->mt_layer,
+ GEN6_HIZ_OP_DEPTH_CLEAR);
+ }
if (brw->gen == 6) {
/* From the Sandy Bridge PRM, volume 2 part 1, page 314: