Revert sampling parameter initialization workaround 1D image sampling used to be treated as 2D image sampling with the second coordinate being ignored. But a bug was causing us to use the second component of the 'offset' parameter. This was worked around by initializing all parameters provided to the sampling routine. This costs some performance, and since we've fixed the 'offset' bug and have specialized handling of 1D images now, the workaround can be reverted. Change-Id: Id69b68465d7755df35fe12619957971681e4c0b7 Fixes: b/136149446 Bug: b/134669567 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48930 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/SpirvShaderSampling.cpp b/src/Pipeline/SpirvShaderSampling.cpp index c7902cb..75dd51c 100644 --- a/src/Pipeline/SpirvShaderSampling.cpp +++ b/src/Pipeline/SpirvShaderSampling.cpp
@@ -103,13 +103,13 @@ Pointer<SIMD::Float> out = function.Arg<2>(); Pointer<Byte> constants = function.Arg<3>(); - SIMD::Float uvwa[4] = { 0, 0, 0, 0 }; - SIMD::Float dRef = 0; - SIMD::Float lodOrBias = 0; // Explicit level-of-detail, or bias added to the implicit level-of-detail (depending on samplerMethod). - Vector4f dsx = { 0, 0, 0, 0 }; - Vector4f dsy = { 0, 0, 0, 0 }; - Vector4i offset = { 0, 0, 0, 0 }; - SIMD::Int sampleId = 0; + SIMD::Float uvwa[4]; + SIMD::Float dRef; + SIMD::Float lodOrBias; // Explicit level-of-detail, or bias added to the implicit level-of-detail (depending on samplerMethod). + Vector4f dsx; + Vector4f dsy; + Vector4i offset; + SIMD::Int sampleId; SamplerFunction samplerFunction = instruction.getSamplerFunction(); uint32_t i = 0;