Mesa (master): v3d: reinterpret stencil data as uint texture in stencil blit path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 7 16:33:47 UTC 2021


Module: Mesa
Branch: master
Commit: 4d0b8a9d323ebc316ba3cf7fbd2c2ee08e901347
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d0b8a9d323ebc316ba3cf7fbd2c2ee08e901347

Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date:   Tue Jan  5 13:05:20 2021 +0100

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 at igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8361>

---

 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. */



More information about the mesa-commit mailing list