Rectangle texture addressing fix
Texture rectangle coordinates were clamped in the [0, dim - 1] range,
but should have been sampled in the [0.5, dim - 0.5 range] according
to the spec (a related comment was added in the code).
Also, by having getAddressingModeW() return ADDRESSING_LAYER for
rectangle textures, the 3rd texture coordinate computation will be
skipped entirely, preventing the temporary variable 'fv' from being
overwritten.
Change-Id: I4bbc30b2a2b747eae2f2a1dfb710a986bff7849b
Reviewed-on: https://swiftshader-review.googlesource.com/18768
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Renderer/Sampler.cpp b/src/Renderer/Sampler.cpp
index 85448b9..979079c 100644
--- a/src/Renderer/Sampler.cpp
+++ b/src/Renderer/Sampler.cpp
@@ -478,7 +478,8 @@
{
if(textureType == TEXTURE_2D_ARRAY ||
textureType == TEXTURE_2D ||
- textureType == TEXTURE_CUBE)
+ textureType == TEXTURE_CUBE ||
+ textureType == TEXTURE_RECTANGLE)
{
return ADDRESSING_LAYER;
}