gallium/util: fix texture-coordinates for stencil-fallback
Set up texture coordinates for the stencil-fallback blit code. This
worked in the orignal NIR code, but accidentally broke when rewriting to
use TGSI, and my test-case had a constant colored stencil buffer.
Fixes: e8a40715a8b ("gallium/util: add blitter-support for stencil-fallback")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6898>
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index cb810af..25d9ad3 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -2875,6 +2875,13 @@
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 (int i = 0; i < stencil_bits; ++i) {
uint32_t mask = 1 << i;
struct pipe_constant_buffer cb = {
@@ -2890,7 +2897,9 @@
blitter->draw_rectangle(blitter, ctx->velem_state, get_vs_passthrough_pos,
dstx, dsty,
dstx + srcbox->width, dsty + srcbox->height,
- 0, stencil_bits, UTIL_BLITTER_ATTRIB_NONE, NULL);
+ 0, stencil_bits,
+ UTIL_BLITTER_ATTRIB_TEXCOORD_XYZW,
+ &coord);
}
util_blitter_restore_vertex_states(blitter);