mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
zink: add a context flag to indicate when blitter is running
...or blitter-like functionality Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19077>
This commit is contained in:
parent
07017aa137
commit
58f09f5993
5 changed files with 17 additions and 2 deletions
|
|
@ -344,6 +344,7 @@ zink_blit(struct pipe_context *pctx,
|
|||
/* this will draw a full-resource quad, so ignore existing data */
|
||||
if (util_blit_covers_whole_resource(info))
|
||||
pctx->invalidate_resource(pctx, info->dst.resource);
|
||||
ctx->blitting = true;
|
||||
zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS | ZINK_BLIT_SAVE_TEXTURES);
|
||||
|
||||
if (stencil_blit) {
|
||||
|
|
@ -368,6 +369,7 @@ zink_blit(struct pipe_context *pctx,
|
|||
} else {
|
||||
util_blitter_blit(ctx->blitter, info);
|
||||
}
|
||||
ctx->blitting = false;
|
||||
end:
|
||||
if (needs_present_readback)
|
||||
zink_kopper_present_readback(ctx, src);
|
||||
|
|
|
|||
|
|
@ -451,8 +451,10 @@ zink_clear_texture(struct pipe_context *pctx,
|
|||
surf = create_clear_surface(pctx, pres, level, box);
|
||||
util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
|
||||
set_clear_fb(pctx, surf, NULL);
|
||||
ctx->blitting = true;
|
||||
pctx->clear(pctx, PIPE_CLEAR_COLOR0, &scissor, &color, 0, 0);
|
||||
util_blitter_restore_fb_state(ctx->blitter);
|
||||
ctx->blitting = false;
|
||||
} else {
|
||||
float depth = 0.0;
|
||||
uint8_t stencil = 0;
|
||||
|
|
@ -470,9 +472,11 @@ zink_clear_texture(struct pipe_context *pctx,
|
|||
flags |= PIPE_CLEAR_STENCIL;
|
||||
surf = create_clear_surface(pctx, pres, level, box);
|
||||
util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
|
||||
ctx->blitting = true;
|
||||
set_clear_fb(pctx, NULL, surf);
|
||||
pctx->clear(pctx, flags, &scissor, NULL, depth, stencil);
|
||||
util_blitter_restore_fb_state(ctx->blitter);
|
||||
ctx->blitting = false;
|
||||
}
|
||||
/* this will never destroy the surface */
|
||||
pipe_surface_reference(&surf, NULL);
|
||||
|
|
@ -538,8 +542,10 @@ zink_clear_render_target(struct pipe_context *pctx, struct pipe_surface *dst,
|
|||
util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
|
||||
set_clear_fb(pctx, dst, NULL);
|
||||
struct pipe_scissor_state scissor = {dstx, dsty, dstx + width, dsty + height};
|
||||
ctx->blitting = true;
|
||||
pctx->clear(pctx, PIPE_CLEAR_COLOR0, &scissor, color, 0, 0);
|
||||
util_blitter_restore_fb_state(ctx->blitter);
|
||||
ctx->blitting = false;
|
||||
if (!render_condition_enabled && render_condition_active)
|
||||
zink_start_conditional_render(ctx);
|
||||
ctx->render_condition_active = render_condition_active;
|
||||
|
|
@ -565,11 +571,14 @@ zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst,
|
|||
if (!cur_attachment) {
|
||||
util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state);
|
||||
set_clear_fb(pctx, NULL, dst);
|
||||
ctx->blitting = true;
|
||||
}
|
||||
struct pipe_scissor_state scissor = {dstx, dsty, dstx + width, dsty + height};
|
||||
pctx->clear(pctx, clear_flags, &scissor, NULL, depth, stencil);
|
||||
if (!cur_attachment)
|
||||
if (!cur_attachment) {
|
||||
util_blitter_restore_fb_state(ctx->blitter);
|
||||
ctx->blitting = false;
|
||||
}
|
||||
if (!render_condition_enabled && render_condition_active)
|
||||
zink_start_conditional_render(ctx);
|
||||
ctx->render_condition_active = render_condition_active;
|
||||
|
|
|
|||
|
|
@ -3612,8 +3612,10 @@ zink_flush(struct pipe_context *pctx,
|
|||
ctx->fbfetch_outputs = 0;
|
||||
ctx->rp_changed = true;
|
||||
}
|
||||
ctx->blitting = true;
|
||||
/* start rp to do all the clears */
|
||||
zink_batch_rp(ctx);
|
||||
ctx->blitting = false;
|
||||
ctx->fbfetch_outputs = fbfetch_outputs;
|
||||
ctx->rp_changed |= fbfetch_outputs > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -697,11 +697,12 @@ zink_begin_render_pass(struct zink_context *ctx)
|
|||
src_view = ctx->base.create_sampler_view(&ctx->base, src, &src_templ);
|
||||
|
||||
zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS | ZINK_BLIT_SAVE_TEXTURES);
|
||||
ctx->blitting = true;
|
||||
util_blitter_blit_generic(ctx->blitter, dst_view, &dstbox,
|
||||
src_view, &dstbox, ctx->fb_state.width, ctx->fb_state.height,
|
||||
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
|
||||
false, false, 0);
|
||||
|
||||
ctx->blitting = false;
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
csurf->transient_init = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1665,6 +1665,7 @@ struct zink_context {
|
|||
|
||||
bool is_device_lost;
|
||||
bool primitive_restart;
|
||||
bool blitting : 1;
|
||||
bool vertex_state_changed : 1;
|
||||
bool blend_state_changed : 1;
|
||||
bool sample_mask_changed : 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue