util/blitter: iterate samples in stencil_fallback

this matches handling in do_blits and fixes multisampled stencil blits

fixes (nv):
GTF-GL45.gtf44.GL31Tests.texture_stencil8.texture_stencil8_gl44

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27988>
(cherry picked from commit 2665badcfe)
This commit is contained in:
Mike Blumenkrantz 2024-03-05 09:10:34 -05:00 committed by Eric Engestrom
parent d12ea6f472
commit 14a15f8265
2 changed files with 28 additions and 25 deletions

View file

@ -54,7 +54,7 @@
"description": "util/blitter: iterate samples in stencil_fallback",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -2952,33 +2952,36 @@ util_blitter_stencil_fallback(struct blitter_context *blitter,
struct pipe_stencil_ref sr = { { (1u << stencil_bits) - 1 } };
pipe->set_stencil_ref(pipe, sr);
union blitter_attrib coord;
get_texcoords(src_view, src->width0, src->height0,
srcbox->x, srcbox->y,
srcbox->x + srcbox->width, srcbox->y + srcbox->height,
srcbox->z, 0, true,
&coord);
for (unsigned i = 0; i <= util_res_sample_count(dst) - 1; i++) {
pipe->set_sample_mask(pipe, 1 << i);
union blitter_attrib coord;
get_texcoords(src_view, src->width0, src->height0,
srcbox->x, srcbox->y,
srcbox->x + srcbox->width, srcbox->y + srcbox->height,
srcbox->z, i, true,
&coord);
for (int i = 0; i < stencil_bits; ++i) {
uint32_t mask = 1 << i;
struct pipe_constant_buffer cb = {
.user_buffer = &mask,
.buffer_size = sizeof(mask),
};
pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, blitter->cb_slot,
false, &cb);
for (int i = 0; i < stencil_bits; ++i) {
uint32_t mask = 1 << i;
struct pipe_constant_buffer cb = {
.user_buffer = &mask,
.buffer_size = sizeof(mask),
};
pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, blitter->cb_slot,
false, &cb);
pipe->bind_depth_stencil_alpha_state(pipe,
get_stencil_blit_fallback_dsa(ctx, i));
pipe->bind_depth_stencil_alpha_state(pipe,
get_stencil_blit_fallback_dsa(ctx, i));
blitter->draw_rectangle(blitter, ctx->velem_state,
get_vs_passthrough_pos_generic,
dstbox->x, dstbox->y,
dstbox->x + dstbox->width,
dstbox->y + dstbox->height,
0, 1,
UTIL_BLITTER_ATTRIB_TEXCOORD_XYZW,
&coord);
blitter->draw_rectangle(blitter, ctx->velem_state,
get_vs_passthrough_pos_generic,
dstbox->x, dstbox->y,
dstbox->x + dstbox->width,
dstbox->y + dstbox->height,
0, 1,
UTIL_BLITTER_ATTRIB_TEXCOORD_XYZW,
&coord);
}
}
if (scissor)