softpipe: Fix anisotropic sampling aliasing bug

"Backport" of the llvmpip fix.

Nearest sampling was being done using coordinates
on texel boundaries, which caused aliasing bugs.
Shift coordinates by half a texel to correct this.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31562>
This commit is contained in:
Aleksi Sapon 2024-10-08 10:58:54 -04:00 committed by Marge Bot
parent 5947e3d760
commit e7a851e6cf

View file

@ -2444,8 +2444,8 @@ img_filter_2d_ewa(const struct sp_sampler_view *sp_sview,
const float weight = weightLut[qClamped];
weight_buffer[buffer_next] = weight;
s_buffer[buffer_next] = u / ((float) width);
t_buffer[buffer_next] = v / ((float) height);
s_buffer[buffer_next] = (u + 0.5f) / width;
t_buffer[buffer_next] = (v + 0.5f) / height;
buffer_next++;
if (buffer_next == TGSI_QUAD_SIZE) {