v3d: reinterpret stencil data as uint texture in stencil blit path

There is a path to blit stencil buffers reinterpreting the stencil data
as an RGBA8888 or R8 float texture.

This works fine except for the case when the stencil buffer is
multisampled, and the blit operation needs to resolve it: an average of
the samples is done, which is incorrect, as only one sample must be
used.

This can be observed n the piglit test
`ext_framebuffer_multisample-unaligned-blit 2 stencil downsample -auto
-fbo`, specifically in the triangles border.

To avoid this averaging, let's reinterpret the stencil data as RGBA8888
or R8 uint texture.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8361>
This commit is contained in:
Juan A. Suarez Romero 2021-01-05 13:05:20 +01:00 committed by Juan A. Suárez
parent cacce76db9
commit 4d0b8a9d32

View file

@ -124,16 +124,16 @@ v3d_stencil_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
if (src->separate_stencil) {
src = src->separate_stencil;
src_format = PIPE_FORMAT_R8_UNORM;
src_format = PIPE_FORMAT_R8_UINT;
} else {
src_format = PIPE_FORMAT_RGBA8888_UNORM;
src_format = PIPE_FORMAT_RGBA8888_UINT;
}
if (dst->separate_stencil) {
dst = dst->separate_stencil;
dst_format = PIPE_FORMAT_R8_UNORM;
dst_format = PIPE_FORMAT_R8_UINT;
} else {
dst_format = PIPE_FORMAT_RGBA8888_UNORM;
dst_format = PIPE_FORMAT_RGBA8888_UINT;
}
/* Initialize the surface. */