Fix overwriting of filter factor

The third coordinate of the 2D sampling code is only used for 2D array
textures, so we don't compute a filter factor. This used to be taken
advantage of by passing the filter factor of the second coordinate to
the addressing method for the third coordinate, and ensuring that the
addressing mode of this component was ADDRESSING_LAYER even for non-
array textures.

Instead of relying on this brittle hack, just specify a third filter
factor. Now that we elide materialization of single-block variables,
this doesn't take any stack space and is zero overhead to the backend.

Bug: b/129523279
Change-Id: Iee6b0f90bf1cc4ccc41672d3bdb706ff5af0a555
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30548
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
diff --git a/src/Pipeline/SamplerCore.cpp b/src/Pipeline/SamplerCore.cpp
index e9a4ac4..48ab75f 100644
--- a/src/Pipeline/SamplerCore.cpp
+++ b/src/Pipeline/SamplerCore.cpp
@@ -1045,11 +1045,11 @@
 		selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
 
 		Int4 x0, x1, y0, y1, z0;
-		Float4 fu, fv;
+		Float4 fu, fv, fw;
 		Int4 filter = computeFilterOffset(lod);
 		address(u, x0, x1, fu, mipmap, offset.x, filter, OFFSET(Mipmap, width), state.addressingModeU, function);
 		address(v, y0, y1, fv, mipmap, offset.y, filter, OFFSET(Mipmap, height), state.addressingModeV, function);
-		address(w, z0, z0, fv, mipmap, offset.z, filter, OFFSET(Mipmap, depth), state.addressingModeW, function);
+		address(w, z0, z0, fw, mipmap, offset.z, filter, OFFSET(Mipmap, depth), state.addressingModeW, function);
 
 		Int4 pitchP = *Pointer<Int4>(mipmap + OFFSET(Mipmap, pitchP), 16);
 		y0 *= pitchP;