aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Capens <capn@google.com>2020-10-02 23:49:59 -0400
committerNicolas Capens <nicolascapens@google.com>2021-02-22 21:03:51 +0000
commitfda74a680458d8235e0117255f796dd1aa81b368 (patch)
tree1882e9997db8dffe1d8ae19d057a8c91868bbf1a
parent008247a4fa138573d13fc23fdd587577ebece2a7 (diff)
downloadswiftshader-fda74a680458d8235e0117255f796dd1aa81b368.tar.gz
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>
-rw-r--r--src/Pipeline/SpirvShaderSampling.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Pipeline/SpirvShaderSampling.cpp b/src/Pipeline/SpirvShaderSampling.cpp
index c7902cb2b..75dd51c53 100644
--- a/src/Pipeline/SpirvShaderSampling.cpp
+++ b/src/Pipeline/SpirvShaderSampling.cpp
@@ -103,13 +103,13 @@ std::shared_ptr<rr::Routine> SpirvShader::emitSamplerRoutine(ImageInstruction in
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;