From c6dc6acf27d7a1708348bb1434903d40949fb3dd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 Mar 2015 12:39:34 +1000 Subject: [PATCH] renderer: fix layered depth clears. fixes: gl-3.2-layered-rendering-clear-depth --- src/vrend_renderer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 68ea039..da2c265 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1186,7 +1186,7 @@ void vrend_fb_bind_texture(struct vrend_resource *res, static void vrend_hw_set_zsurf_texture(struct vrend_context *ctx) { struct vrend_resource *tex; - + int first_layer, last_layer; if (!ctx->sub->zsurf) { glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0); @@ -1197,7 +1197,11 @@ static void vrend_hw_set_zsurf_texture(struct vrend_context *ctx) if (!tex) return; - vrend_fb_bind_texture(tex, 0, ctx->sub->zsurf->val0, ctx->sub->zsurf->val1 & 0xffff); + first_layer = ctx->sub->zsurf->val1 & 0xffff; + last_layer = (ctx->sub->zsurf->val1 >> 16) & 0xffff; + + vrend_fb_bind_texture(tex, 0, ctx->sub->zsurf->val0, + first_layer != last_layer ? 0xffffffff : first_layer); } static void vrend_hw_set_color_surface(struct vrend_context *ctx, int index)