static void fd_set_framebuffer_state(struct pipe_context *pctx, const struct pipe_framebuffer_state *framebuffer) { struct fd_context *ctx = fd_context(pctx); struct pipe_framebuffer_state *cso; DBG("%ux%u, %u layers, %u samples", framebuffer->width, framebuffer->height, framebuffer->layers, framebuffer->samples); cso = &ctx->framebuffer; if (util_framebuffer_state_equal(cso, framebuffer)) return; util_copy_framebuffer_state(cso, framebuffer); cso->samples = util_framebuffer_get_num_samples(cso); if (ctx->screen->reorder) { struct fd_batch *old_batch = NULL; fd_batch_reference(&old_batch, ctx->batch); if (likely(old_batch)) fd_batch_set_stage(old_batch, FD_STAGE_NULL); fd_batch_reference(&ctx->batch, NULL); fd_context_all_dirty(ctx); if (old_batch && old_batch->blit && !old_batch->back_blit) { /* for blits, there is not really much point in hanging on * to the uncommitted batch (ie. you probably don't blit * multiple times to the same surface), so we might as * well go ahead and flush this one: */ fd_batch_flush(old_batch, false, false); } fd_batch_reference(&old_batch, NULL); } else { DBG("%d: cbufs[0]=%p, zsbuf=%p", ctx->batch->needs_flush, framebuffer->cbufs[0], framebuffer->zsbuf); fd_batch_flush(ctx->batch, false, false); util_copy_framebuffer_state(&ctx->batch->framebuffer, cso); } ctx->dirty |= FD_DIRTY_FRAMEBUFFER; ctx->disabled_scissor.minx = 0; ctx->disabled_scissor.miny = 0; ctx->disabled_scissor.maxx = cso->width; ctx->disabled_scissor.maxy = cso->height; ctx->dirty |= FD_DIRTY_SCISSOR; }
/** * 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 (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); } lp_setup_bind_framebuffer( lp->setup, &lp->framebuffer ); lp->dirty |= LP_NEW_FRAMEBUFFER; } }
/** * 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; } }