/** * Specify the depth stencil format for the draw pipeline. This function * determines the Minimum Resolvable Depth factor for polygon offset. * This factor potentially depends on the number of Z buffer bits, * the rasterization algorithm and the arithmetic performed on Z * values between vertex shading and rasterization. */ void draw_set_zs_format(struct draw_context *draw, enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); draw->floating_point_depth = (util_get_depth_format_type(desc) == UTIL_FORMAT_TYPE_FLOAT); draw->mrd = util_get_depth_format_mrd(desc); }
/** * Set the framebuffer surface info: color buffers, zbuffer, stencil buffer. */ void llvmpipe_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { struct llvmpipe_context *lp = llvmpipe_context(pipe); boolean changed = !util_framebuffer_state_equal(&lp->framebuffer, fb); assert(fb->width <= LP_MAX_WIDTH); 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. * * 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 ); lp->dirty |= LP_NEW_FRAMEBUFFER; } }