From acfb1583a560339b500a94bc13bf73675e7ed422 Mon Sep 17 00:00:00 2001 From: Neha Bhende Date: Thu, 20 Jul 2017 13:59:36 -0700 Subject: svga: fix unnormalized->normalized texture coordinate conversion Sometimes, converting unnormalized coordinates to normalized coordinates requires an epsilon value to produce the right texels with nearest filtering. Adding 0.0001 to the coordinates when the min/mag filter is nearest fixes the issue. Fixes piglit test fbo-blit-scaled-linear Tested with mtt-piglit, mtt-glretrace Reviewed-by: Brian Paul Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_shader.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gallium/drivers/svga/svga_shader.c') diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c index 74c829eefc1..9e2b65771cd 100644 --- a/src/gallium/drivers/svga/svga_shader.c +++ b/src/gallium/drivers/svga/svga_shader.c @@ -246,6 +246,11 @@ svga_init_shader_key_common(const struct svga_context *svga, key->tex[i].width_height_idx = idx++; key->tex[i].unnormalized = TRUE; ++key->num_unnormalized_coords; + + if (sampler->magfilter == SVGA3D_TEX_FILTER_NEAREST || + sampler->minfilter == SVGA3D_TEX_FILTER_NEAREST) { + key->tex[i].texel_bias = TRUE; + } } } } -- cgit v1.2.3