Lines Matching refs:ctx
54 struct zink_context *ctx = zink_context(pctx);
55 struct pipe_framebuffer_state *fb = &ctx->fb_state;
103 struct zink_batch *batch = &ctx->batch;
117 if (ctx->fbfetch_outputs)
118 ctx->base.texture_barrier(&ctx->base, PIPE_TEXTURE_BARRIER_FRAMEBUFFER);
130 get_clear_data(struct zink_context *ctx, struct zink_framebuffer_clear *fb_clear, const struct pipe_scissor_state *scissor_state)
187 struct zink_context *ctx = zink_context(pctx);
188 struct pipe_framebuffer_state *fb = &ctx->fb_state;
189 struct zink_batch *batch = &ctx->batch;
192 if (unlikely(!zink_screen(pctx->screen)->info.have_EXT_conditional_rendering && !zink_check_conditional_render(ctx)))
200 if (unlikely(ctx->fb_layer_mismatch)) {
209 unsigned w = ctx->fb_state.width;
210 unsigned h = ctx->fb_state.height;
218 for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
219 if (ctx->fb_state.cbufs[i] &&
220 (ctx->fb_layer_mismatch & clear_buffers & BITFIELD_BIT(i))) {
221 if (ctx->void_clears & (PIPE_CLEAR_COLOR0 << i)) {
225 pctx->clear_render_target(pctx, ctx->fb_state.cbufs[i], &color,
227 ctx->fb_state.cbufs[i]->width, ctx->fb_state.cbufs[i]->height,
228 ctx->render_condition_active);
230 pctx->clear_render_target(pctx, ctx->fb_state.cbufs[i], pcolor,
231 x, y, w, h, ctx->render_condition_active);
234 if (ctx->fb_state.zsbuf && (buffers & PIPE_CLEAR_DEPTHSTENCIL))
235 pctx->clear_depth_stencil(pctx, ctx->fb_state.zsbuf, buffers & PIPE_CLEAR_DEPTHSTENCIL, depth, stencil,
236 x, y, w, h, ctx->render_condition_active);
244 unsigned rp_clears_enabled = ctx->rp_clears_enabled;
246 if (ctx->void_clears & buffers) {
247 unsigned void_clears = ctx->void_clears & buffers;
248 ctx->void_clears &= ~buffers;
254 struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[i];
283 struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[i];
284 struct zink_framebuffer_clear_data *clear = get_clear_data(ctx, fb_clear, needs_rp ? scissor_state : NULL);
286 ctx->clears_enabled |= PIPE_CLEAR_COLOR0 << i;
287 clear->conditional = ctx->render_condition_active;
294 ctx->rp_clears_enabled &= ~(PIPE_CLEAR_COLOR0 << i);
296 ctx->rp_clears_enabled |= PIPE_CLEAR_COLOR0 << i;
302 struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[PIPE_MAX_COLOR_BUFS];
303 struct zink_framebuffer_clear_data *clear = get_clear_data(ctx, fb_clear, needs_rp ? scissor_state : NULL);
304 ctx->clears_enabled |= PIPE_CLEAR_DEPTHSTENCIL;
305 clear->conditional = ctx->render_condition_active;
315 ctx->rp_clears_enabled &= ~PIPE_CLEAR_DEPTHSTENCIL;
317 ctx->rp_clears_enabled |= (buffers & PIPE_CLEAR_DEPTHSTENCIL);
319 assert(!ctx->batch.in_rp);
320 ctx->rp_changed |= ctx->rp_clears_enabled != rp_clears_enabled;
330 zink_clear_framebuffer(struct zink_context *ctx, unsigned clear_buffers)
333 struct pipe_framebuffer_state *fb_state = &ctx->fb_state;
335 assert(!(clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) || zink_fb_clear_enabled(ctx, PIPE_MAX_COLOR_BUFS));
337 assert(!(clear_buffers & (PIPE_CLEAR_COLOR0 << i)) || zink_fb_clear_enabled(ctx, i));
345 struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[i];
376 struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[PIPE_MAX_COLOR_BUFS];
405 zink_clear(&ctx->base, clear_bits,
414 zink_clear(&ctx->base, clear->zs.bits,
424 for (int i = 0; i < ARRAY_SIZE(ctx->fb_clears); i++)
425 zink_fb_clear_reset(ctx, i);
459 struct zink_context *ctx = zink_context(pctx);
470 util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
473 util_blitter_restore_fb_state(ctx->blitter);
490 util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
493 util_blitter_restore_fb_state(ctx->blitter);
507 struct zink_context *ctx = zink_context(pctx);
521 struct zink_batch *batch = &ctx->batch;
522 zink_batch_no_rp(ctx);
525 zink_resource_buffer_barrier(ctx, res, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
552 struct zink_context *ctx = zink_context(pctx);
553 bool render_condition_active = ctx->render_condition_active;
555 zink_stop_conditional_render(ctx);
556 ctx->render_condition_active = false;
558 util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
562 util_blitter_restore_fb_state(ctx->blitter);
564 zink_start_conditional_render(ctx);
565 ctx->render_condition_active = render_condition_active;
574 struct zink_context *ctx = zink_context(pctx);
575 bool render_condition_active = ctx->render_condition_active;
577 zink_stop_conditional_render(ctx);
578 ctx->render_condition_active = false;
580 bool cur_attachment = zink_csurface(ctx->fb_state.zsbuf) == zink_csurface(dst);
581 if (dstx > ctx->fb_state.width || dsty > ctx->fb_state.height ||
582 dstx + width > ctx->fb_state.width ||
583 dsty + height > ctx->fb_state.height)
586 util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
592 util_blitter_restore_fb_state(ctx->blitter);
594 zink_start_conditional_render(ctx);
595 ctx->render_condition_active = render_condition_active;
615 fb_clears_apply_internal(struct zink_context *ctx, struct pipe_resource *pres, int i)
617 if (!zink_fb_clear_enabled(ctx, i))
619 if (ctx->batch.in_rp)
620 zink_clear_framebuffer(ctx, BITFIELD_BIT(i));
623 zink_batch_rp(ctx);
624 zink_fb_clear_reset(ctx, i);
628 zink_fb_clear_reset(struct zink_context *ctx, unsigned i)
630 unsigned rp_clears_enabled = ctx->clears_enabled;
631 util_dynarray_clear(&ctx->fb_clears[i].clears);
633 ctx->clears_enabled &= ~PIPE_CLEAR_DEPTHSTENCIL;
634 ctx->rp_clears_enabled &= ~PIPE_CLEAR_DEPTHSTENCIL;
636 ctx->clears_enabled &= ~(PIPE_CLEAR_COLOR0 << i);
637 ctx->rp_clears_enabled &= ~(PIPE_CLEAR_COLOR0 << i);
639 if (ctx->rp_clears_enabled != rp_clears_enabled)
640 ctx->rp_loadop_changed = true;
644 zink_fb_clears_apply(struct zink_context *ctx, struct pipe_resource *pres)
647 for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
648 if (ctx->fb_state.cbufs[i] && ctx->fb_state.cbufs[i]->texture == pres) {
649 fb_clears_apply_internal(ctx, pres, i);
653 if (ctx->fb_state.zsbuf && ctx->fb_state.zsbuf->texture == pres) {
654 fb_clears_apply_internal(ctx, pres, PIPE_MAX_COLOR_BUFS);
660 zink_fb_clears_discard(struct zink_context *ctx, struct pipe_resource *pres)
663 for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
664 if (ctx->fb_state.cbufs[i] && ctx->fb_state.cbufs[i]->texture == pres) {
665 if (zink_fb_clear_enabled(ctx, i)) {
666 zink_fb_clear_reset(ctx, i);
671 if (zink_fb_clear_enabled(ctx, PIPE_MAX_COLOR_BUFS) && ctx->fb_state.zsbuf && ctx->fb_state.zsbuf->texture == pres) {
673 zink_fb_clear_reset(ctx, i);
679 zink_clear_apply_conditionals(struct zink_context *ctx)
681 for (int i = 0; i < ARRAY_SIZE(ctx->fb_clears); i++) {
682 struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[i];
683 if (!zink_fb_clear_enabled(ctx, i))
690 surf = ctx->fb_state.cbufs[i];
692 surf = ctx->fb_state.zsbuf;
694 fb_clears_apply_internal(ctx, surf->texture, i);
696 zink_fb_clear_reset(ctx, i);
704 fb_clears_apply_or_discard_internal(struct zink_context *ctx, struct pipe_resource *pres, struct u_rect region, bool discard_only, bool invert, int i)
706 struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[i];
707 if (zink_fb_clear_enabled(ctx, i)) {
710 fb_clears_apply_internal(ctx, pres, i);
713 zink_fb_clears_discard(ctx, pres);
723 fb_clears_apply_internal(ctx, pres, i);
729 zink_fb_clears_discard(ctx, pres);
734 zink_fb_clears_apply_or_discard(struct zink_context *ctx, struct pipe_resource *pres, struct u_rect region, bool discard_only)
737 for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
738 if (ctx->fb_state.cbufs[i] && ctx->fb_state.cbufs[i]->texture == pres) {
739 fb_clears_apply_or_discard_internal(ctx, pres, region, discard_only, false, i);
743 if (zink_fb_clear_enabled(ctx, PIPE_MAX_COLOR_BUFS) && ctx->fb_state.zsbuf && ctx->fb_state.zsbuf->texture == pres) {
744 fb_clears_apply_or_discard_internal(ctx, pres, region, discard_only, false, PIPE_MAX_COLOR_BUFS);
750 zink_fb_clears_apply_region(struct zink_context *ctx, struct pipe_resource *pres, struct u_rect region)
753 for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
754 if (ctx->fb_state.cbufs[i] && ctx->fb_state.cbufs[i]->texture == pres) {
755 fb_clears_apply_or_discard_internal(ctx, pres, region, false, true, i);
759 if (ctx->fb_state.zsbuf && ctx->fb_state.zsbuf->texture == pres) {
760 fb_clears_apply_or_discard_internal(ctx, pres, region, false, true, PIPE_MAX_COLOR_BUFS);