gallium: add pipe_blit_info::dst_sample, update u_blitter to write that sample
A new radeonsi blit test will use it to upload different sample values into MSAA textures. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17694>
This commit is contained in:
@@ -1790,7 +1790,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
|
||||
util_blitter_blit_generic(blitter, dst_view, &dstbox,
|
||||
src_view, srcbox, src->width0, src->height0,
|
||||
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
|
||||
false, false);
|
||||
false, false, 0);
|
||||
|
||||
pipe_surface_reference(&dst_view, NULL);
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
@@ -1843,7 +1843,8 @@ static void do_blits(struct blitter_context_priv *ctx,
|
||||
unsigned src_height0,
|
||||
const struct pipe_box *srcbox,
|
||||
bool is_zsbuf,
|
||||
bool uses_txf, bool sample0_only)
|
||||
bool uses_txf, bool sample0_only,
|
||||
unsigned dst_sample)
|
||||
{
|
||||
struct pipe_context *pipe = ctx->base.pipe;
|
||||
unsigned src_samples = src->texture->nr_samples;
|
||||
@@ -1873,7 +1874,7 @@ static void do_blits(struct blitter_context_priv *ctx,
|
||||
pipe->set_framebuffer_state(pipe, &fb_state);
|
||||
|
||||
/* Draw. */
|
||||
pipe->set_sample_mask(pipe, ~0);
|
||||
pipe->set_sample_mask(pipe, dst_sample ? BITFIELD_BIT(dst_sample - 1) : ~0);
|
||||
if (pipe->set_min_samples)
|
||||
pipe->set_min_samples(pipe, sample_shading ? dst_samples : 1);
|
||||
blitter_draw_tex(ctx, dstbox->x, dstbox->y,
|
||||
@@ -1932,6 +1933,7 @@ static void do_blits(struct blitter_context_priv *ctx,
|
||||
unsigned i, max_sample = sample0_only ? 0 : dst_samples - 1;
|
||||
|
||||
if (sample_shading) {
|
||||
assert(dst_sample == 0);
|
||||
pipe->set_sample_mask(pipe, ~0);
|
||||
if (pipe->set_min_samples)
|
||||
pipe->set_min_samples(pipe, max_sample);
|
||||
@@ -1963,7 +1965,7 @@ static void do_blits(struct blitter_context_priv *ctx,
|
||||
}
|
||||
} else {
|
||||
/* Normal copy, MSAA upsampling, or MSAA resolve. */
|
||||
pipe->set_sample_mask(pipe, ~0);
|
||||
pipe->set_sample_mask(pipe, dst_sample ? BITFIELD_BIT(dst_sample - 1) : ~0);
|
||||
if (pipe->set_min_samples)
|
||||
pipe->set_min_samples(pipe, 1);
|
||||
blitter_draw_tex(ctx, dstbox->x, dstbox->y,
|
||||
@@ -1998,7 +2000,8 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
|
||||
unsigned src_width0, unsigned src_height0,
|
||||
unsigned mask, unsigned filter,
|
||||
const struct pipe_scissor_state *scissor,
|
||||
bool alpha_blend, bool sample0_only)
|
||||
bool alpha_blend, bool sample0_only,
|
||||
unsigned dst_sample)
|
||||
{
|
||||
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
|
||||
struct pipe_context *pipe = ctx->base.pipe;
|
||||
@@ -2207,7 +2210,8 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
|
||||
blitter_set_common_draw_rect_state(ctx, scissor != NULL, dst_samples > 1);
|
||||
|
||||
do_blits(ctx, dst, dstbox, src, src_width0, src_height0,
|
||||
srcbox, dst_has_depth || dst_has_stencil, use_txf, sample0_only);
|
||||
srcbox, dst_has_depth || dst_has_stencil, use_txf, sample0_only,
|
||||
dst_sample);
|
||||
|
||||
util_blitter_restore_vertex_states(blitter);
|
||||
util_blitter_restore_fragment_states(blitter);
|
||||
@@ -2247,7 +2251,8 @@ util_blitter_blit(struct blitter_context *blitter,
|
||||
src_view, &info->src.box, src->width0, src->height0,
|
||||
info->mask, info->filter,
|
||||
info->scissor_enable ? &info->scissor : NULL,
|
||||
info->alpha_blend, info->sample0_only);
|
||||
info->alpha_blend, info->sample0_only,
|
||||
info->dst_sample);
|
||||
|
||||
pipe_surface_reference(&dst_view, NULL);
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
@@ -2345,7 +2350,7 @@ void util_blitter_generate_mipmap(struct blitter_context *blitter,
|
||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, false, &src_view);
|
||||
|
||||
do_blits(ctx, dst_view, &dstbox, src_view, tex->width0, tex->height0,
|
||||
&srcbox, is_depth, false, false);
|
||||
&srcbox, is_depth, false, false, 0);
|
||||
|
||||
pipe_surface_reference(&dst_view, NULL);
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
|
@@ -271,7 +271,8 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
|
||||
unsigned src_width0, unsigned src_height0,
|
||||
unsigned mask, unsigned filter,
|
||||
const struct pipe_scissor_state *scissor,
|
||||
bool alpha_blend, bool sample0_only);
|
||||
bool alpha_blend, bool sample0_only,
|
||||
unsigned dst_sample);
|
||||
|
||||
void util_blitter_blit(struct blitter_context *blitter,
|
||||
const struct pipe_blit_info *info);
|
||||
|
@@ -166,7 +166,7 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
|
||||
util_blitter_blit_generic(
|
||||
ctx->blitter, dst_view, &info->dst.box, src_view, &info->src.box,
|
||||
src->width0, src->height0, info->mask, info->filter,
|
||||
info->scissor_enable ? &info->scissor : NULL, info->alpha_blend, false);
|
||||
info->scissor_enable ? &info->scissor : NULL, info->alpha_blend, false, 0);
|
||||
|
||||
pipe_surface_reference(&dst_view, NULL);
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
|
@@ -118,7 +118,7 @@ i915_surface_copy_render(struct pipe_context *pipe, struct pipe_resource *dst,
|
||||
|
||||
util_blitter_blit_generic(i915->blitter, dst_view, &dstbox, src_view,
|
||||
src_box, src_width0, src_height0, PIPE_MASK_RGBAZS,
|
||||
PIPE_TEX_FILTER_NEAREST, NULL, false, false);
|
||||
PIPE_TEX_FILTER_NEAREST, NULL, false, false, 0);
|
||||
return;
|
||||
|
||||
fallback:
|
||||
|
@@ -685,7 +685,7 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
|
||||
util_blitter_blit_generic(r300->blitter, dst_view, &dstbox,
|
||||
src_view, src_box, src_width0, src_height0,
|
||||
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
|
||||
FALSE, FALSE);
|
||||
FALSE, FALSE, 0);
|
||||
r300_blitter_end(r300);
|
||||
|
||||
pipe_surface_reference(&dst_view, NULL);
|
||||
|
@@ -806,7 +806,7 @@ void r600_resource_copy_region(struct pipe_context *ctx,
|
||||
util_blitter_blit_generic(rctx->blitter, dst_view, &dstbox,
|
||||
src_view, src_box, src_width0, src_height0,
|
||||
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
|
||||
FALSE, FALSE);
|
||||
FALSE, FALSE, 0);
|
||||
r600_blitter_end(ctx);
|
||||
|
||||
pipe_surface_reference(&dst_view, NULL);
|
||||
|
@@ -1039,7 +1039,8 @@ void si_resource_copy_region(struct pipe_context *ctx, struct pipe_resource *dst
|
||||
/* Copy. */
|
||||
si_blitter_begin(sctx, SI_COPY);
|
||||
util_blitter_blit_generic(sctx->blitter, dst_view, &dstbox, src_view, src_box, src->width0,
|
||||
src->height0, PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL, false, false);
|
||||
src->height0, PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
|
||||
false, false, 0);
|
||||
si_blitter_end(sctx);
|
||||
|
||||
pipe_surface_reference(&dst_view, NULL);
|
||||
|
@@ -195,7 +195,7 @@ v3d_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
||||
PIPE_MASK_R,
|
||||
PIPE_TEX_FILTER_NEAREST,
|
||||
info->scissor_enable ? &info->scissor : NULL,
|
||||
info->alpha_blend, false);
|
||||
info->alpha_blend, false, 0);
|
||||
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
|
@@ -701,7 +701,7 @@ zink_begin_render_pass(struct zink_context *ctx)
|
||||
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);
|
||||
false, false, 0);
|
||||
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
csurf->transient_init = true;
|
||||
|
@@ -895,6 +895,7 @@ struct pipe_blit_info
|
||||
|
||||
unsigned mask; /**< bitmask of PIPE_MASK_R/G/B/A/Z/S */
|
||||
unsigned filter; /**< PIPE_TEX_FILTER_* */
|
||||
uint8_t dst_sample; /**< if non-zero, set sample_mask to (1 << (dst_sample - 1)) */
|
||||
bool sample0_only;
|
||||
bool scissor_enable;
|
||||
struct pipe_scissor_state scissor;
|
||||
|
Reference in New Issue
Block a user