From 4be9824dc90b9c258bc5cc4706fa7a50abe1852d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 16 Jul 2021 12:28:57 +1000 Subject: [PATCH] softpipe/aniso: move DDQ calculation to after scaling. I've read the papers on EWA filters and it seems like the calculate DDQ = 2 * A after the scaling of A happens. This seems to make things less blurry and more like real aniso. Fixes: 2135aba8 ("softpipe: Constify variables") Reviewed-by: Timothy Arceri Reviewed-by: Roland Scheidegger Part-of: (cherry picked from commit 57dcfb4e55346ee2d7e3da79e93a7d36a8a5ca17) --- .pick_status.json | 2 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 4d6f697713e..a6da7e38ed5 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -724,7 +724,7 @@ "description": "softpipe/aniso: move DDQ calculation to after scaling.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "2135aba8d99d5b0b5f73d97d4aac6a25d69de57c" }, diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 87259301dce..73721505093 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -2385,15 +2385,6 @@ img_filter_2d_ewa(const struct sp_sampler_view *sp_sview, float weight_buffer[TGSI_QUAD_SIZE]; int j; - /* For each quad, the du and dx values are the same and so the ellipse is - * also the same. Note that texel/image access can only be performed using - * a quad, i.e. it is not possible to get the pixel value for a single - * tex coord. In order to have a better performance, the access is buffered - * using the s_buffer/t_buffer and weight_buffer. Only when the buffer is - * full, then the pixel values are read from the image. - */ - const float ddq = 2 * A; - /* Scale ellipse formula to directly index the Filter Lookup Table. * i.e. scale so that F = WEIGHT_LUT_SIZE-1 */ @@ -2403,6 +2394,15 @@ img_filter_2d_ewa(const struct sp_sampler_view *sp_sview, C *= formScale; /* F *= formScale; */ /* no need to scale F as we don't use it below here */ + /* For each quad, the du and dx values are the same and so the ellipse is + * also the same. Note that texel/image access can only be performed using + * a quad, i.e. it is not possible to get the pixel value for a single + * tex coord. In order to have a better performance, the access is buffered + * using the s_buffer/t_buffer and weight_buffer. Only when the buffer is + * full, then the pixel values are read from the image. + */ + const float ddq = 2 * A; + args.level = level; args.offset = offset;