Patch makes sure in conservative way that the depth_clear_value is correct and represents max depth of current depth buffer.
This fixes the case where user has 16bit color buffer but 24bit depth buffer and 'fb->_DepthMax' has a wrong value. I'm currently investigating how to get _DepthMax corrected on mesa side, but meanwhile this patch will enable correct rendering results for 16bit benchmarks instead of displaying only white color on the screen. This bug does not happen with user created framebuffers, only with window system ones. Signed-off-by: Tapani Pälli <tapani.pa...@intel.com> --- src/mesa/drivers/dri/i965/brw_clear.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c index 2b999bf..28dd872 100644 --- a/src/mesa/drivers/dri/i965/brw_clear.c +++ b/src/mesa/drivers/dri/i965/brw_clear.c @@ -129,6 +129,9 @@ brw_fast_clear_depth(struct gl_context *ctx) } uint32_t depth_clear_value; + struct gl_renderbuffer *depth_rb = + ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + uint32_t depth_bits = _mesa_get_format_bits(depth_rb->Format, GL_DEPTH_BITS); switch (mt->format) { case MESA_FORMAT_Z32_FLOAT_X24S8: case MESA_FORMAT_S8_Z24: @@ -161,7 +164,7 @@ brw_fast_clear_depth(struct gl_context *ctx) /* FALLTHROUGH */ default: - depth_clear_value = fb->_DepthMax * ctx->Depth.Clear; + depth_clear_value = ((1 << depth_bits) - 1) * ctx->Depth.Clear; break; } -- 1.8.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev