zink: add more clear hooks

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11466>
This commit is contained in:
Mike Blumenkrantz
2021-06-18 11:47:23 -04:00
committed by Marge Bot
parent 3f420b3f55
commit 6cc2929e87
3 changed files with 42 additions and 0 deletions
+27
View File
@@ -22,6 +22,7 @@
*/
#include "zink_context.h"
#include "zink_query.h"
#include "zink_resource.h"
#include "zink_screen.h"
@@ -468,6 +469,32 @@ zink_clear_buffer(struct pipe_context *pctx,
pipe_buffer_unmap(pctx, xfer);
}
void
zink_clear_render_target(struct pipe_context *pctx, struct pipe_surface *dst,
const union pipe_color_union *color, unsigned dstx,
unsigned dsty, unsigned width, unsigned height,
bool render_condition_enabled)
{
struct zink_context *ctx = zink_context(pctx);
zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS | (render_condition_enabled ? 0 : ZINK_BLIT_NO_COND_RENDER));
util_blitter_clear_render_target(ctx->blitter, dst, color, dstx, dsty, width, height);
if (!render_condition_enabled && ctx->render_condition_active)
zink_start_conditional_render(ctx);
}
void
zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst,
unsigned clear_flags, double depth, unsigned stencil,
unsigned dstx, unsigned dsty, unsigned width, unsigned height,
bool render_condition_enabled)
{
struct zink_context *ctx = zink_context(pctx);
zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS | (render_condition_enabled ? 0 : ZINK_BLIT_NO_COND_RENDER));
util_blitter_clear_depth_stencil(ctx->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height);
if (!render_condition_enabled && ctx->render_condition_active)
zink_start_conditional_render(ctx);
}
bool
zink_fb_clear_needs_explicit(struct zink_framebuffer_clear *fb_clear)
{
+13
View File
@@ -72,6 +72,19 @@ zink_clear_buffer(struct pipe_context *pctx,
unsigned size,
const void *clear_value,
int clear_value_size);
void
zink_clear_render_target(struct pipe_context *ctx, struct pipe_surface *dst,
const union pipe_color_union *color, unsigned dstx,
unsigned dsty, unsigned width, unsigned height,
bool render_condition_enabled);
void
zink_clear_depth_stencil(struct pipe_context *ctx, struct pipe_surface *dst,
unsigned clear_flags, double depth, unsigned stencil,
unsigned dstx, unsigned dsty, unsigned width, unsigned height,
bool render_condition_enabled);
bool
zink_fb_clear_needs_explicit(struct zink_framebuffer_clear *fb_clear);
+2
View File
@@ -3378,6 +3378,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->base.clear = zink_clear;
ctx->base.clear_texture = zink_clear_texture;
ctx->base.clear_buffer = zink_clear_buffer;
ctx->base.clear_render_target = zink_clear_render_target;
ctx->base.clear_depth_stencil = zink_clear_depth_stencil;
ctx->base.draw_vbo = zink_draw_vbo;
ctx->base.launch_grid = zink_launch_grid;