From 4d0b8a9d323ebc316ba3cf7fbd2c2ee08e901347 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Tue, 5 Jan 2021 13:05:20 +0100 Subject: [PATCH] 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 Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/v3d/v3d_blit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_blit.c b/src/gallium/drivers/v3d/v3d_blit.c index 51ed8a36106..325f6a7ef92 100644 --- a/src/gallium/drivers/v3d/v3d_blit.c +++ b/src/gallium/drivers/v3d/v3d_blit.c @@ -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. */