Plumb through Dref parameter to sampler

Bug: b/129523279
Test: dEQP-VK.texture.shadow.*
Test: dEQP-VK.glsl.*
Change-Id: I7e8241cb458200aeabb22992c02f0feb86479ac2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30649
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShaderSampling.cpp b/src/Pipeline/SpirvShaderSampling.cpp
index af7c494..7ea5bfc 100644
--- a/src/Pipeline/SpirvShaderSampling.cpp
+++ b/src/Pipeline/SpirvShaderSampling.cpp
@@ -66,7 +66,8 @@
 	samplerState.mipmapFilter = convertMipmapMode(sampler);
 	samplerState.swizzle = imageView->getComponentMapping();
 	samplerState.highPrecisionFiltering = false;
-	samplerState.compare = COMPARE_BYPASS;                  ASSERT(sampler->compareEnable == VK_FALSE);  // TODO(b/129523279)
+	samplerState.compareEnable = (sampler->compareEnable == VK_TRUE);
+	samplerState.compareOp = sampler->compareOp;
 
 	ASSERT(sampler->anisotropyEnable == VK_FALSE);  // TODO(b/129523279)
 	ASSERT(sampler->unnormalizedCoordinates == VK_FALSE);  // TODO(b/129523279)
@@ -104,6 +105,12 @@
 			uvw[i] = in[i];
 		}
 
+		if (instruction.isDref())
+		{
+			q = in[i];
+			i++;
+		}
+
 		// TODO(b/129523279): Currently 1D textures are treated as 2D by setting the second coordinate to 0.
 		// Implement optimized 1D sampling.
 		if(samplerState.textureType == TEXTURE_1D ||