diff options
author | Matthew McClure <[email protected]> | 2013-10-22 15:48:00 -0700 |
---|---|---|
committer | José Fonseca <[email protected]> | 2013-10-29 15:53:48 +0000 |
commit | be0b67a1436eb2b899f9874725b2a68eb26f9f3f (patch) | |
tree | 0520a19b3579cc98ec2e61fef69934782625602e /src/gallium/drivers/llvmpipe | |
parent | d0eaf6752d6faa8a17e3270b9e64b7c09ef705c2 (diff) |
util,llvmpipe: correctly set the minimum representable depth value
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_surface.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c index e6aac319447..89098410280 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@ -57,31 +57,24 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, assert(fb->height <= LP_MAX_HEIGHT); if (changed) { - util_copy_framebuffer_state(&lp->framebuffer, fb); if (LP_PERF & PERF_NO_DEPTH) { pipe_surface_reference(&lp->framebuffer.zsbuf, NULL); } - /* Tell draw module how deep the Z/depth buffer is */ - /* FIXME: mrd constant isn't right should use a value derived from - * current primitive not a constant (for float depth buffers) */ - if (lp->framebuffer.zsbuf) { - int depth_bits; - double mrd; - depth_bits = util_format_get_component_bits(lp->framebuffer.zsbuf->format, - UTIL_FORMAT_COLORSPACE_ZS, - 0); - if (depth_bits > 16) { - mrd = 0.0000001; - } - else { - mrd = 0.00002; - } - lp->mrd = mrd; - draw_set_mrd(lp->draw, mrd); - } + /* Tell draw module how deep the Z/depth buffer is. + * + * If no depth buffer is bound, send the utility function the default + * format for no bound depth (PIPE_FORMAT_NONE). + * + * FIXME: mrd constant isn't right should use a value derived from + * current primitive not a constant (for float depth buffers) + */ + lp->mrd = util_get_depth_format_mrd((lp->framebuffer.zsbuf) ? + lp->framebuffer.zsbuf->format : PIPE_FORMAT_NONE); + + draw_set_mrd(lp->draw, lp->mrd); lp_setup_bind_framebuffer( lp->setup, &lp->framebuffer ); |