Disable filtering on 1x1 textures.

Textures with just one texel don't require filtering. This also avoids precision
issues for pedantic tests which expect exact values.

Bug swiftshader:39

Change-Id: I52c5697e277523e2b8cb2c879ba0a7b2296ee7c5
Reviewed-on: https://swiftshader-review.googlesource.com/9068
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/Sampler.cpp b/src/Renderer/Sampler.cpp
index cd4c614..e2447e0 100644
--- a/src/Renderer/Sampler.cpp
+++ b/src/Renderer/Sampler.cpp
@@ -406,6 +406,15 @@
 
 	FilterType Sampler::getTextureFilter() const
 	{
+		// Don't filter 1x1 textures.
+		if(texture.mipmap[0].width[0] == 1 && texture.mipmap[0].height[0] == 1 && texture.mipmap[0].depth[0] == 1)
+		{
+			if(mipmapFilter() == MIPMAP_NONE)
+			{
+				return FILTER_POINT;
+			}
+		}
+
 		FilterType filter = textureFilter;
 
 		if(gather && Surface::componentCount(internalTextureFormat) == 1)