Fix SpirvShader::Interpolate() for Centroid without multisampling
Centroid mode is only used when using multisampling. When we're not
using multisampling, Centroid is essentially ignored, and we have to
use regular interpolation in that case.
Tests: dEQP-VK.pipeline.monolithic.multisample_interpolation.reinterpolation_consistency.interpolate_at_centroid
Bug: b/210468952
Change-Id: Iab10ed9de3a1470194a9ce1b8fb3f4b7d0451963
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/66011
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShaderGLSLstd450.cpp b/src/Pipeline/SpirvShaderGLSLstd450.cpp
index 75bcc06..fd09c9e 100644
--- a/src/Pipeline/SpirvShaderGLSLstd450.cpp
+++ b/src/Pipeline/SpirvShaderGLSLstd450.cpp
@@ -1023,18 +1023,28 @@
SIMD::Float y;
SIMD::Float rhw;
+ bool multisample = (state->getMultiSampleCount() > 1);
switch(type)
{
case Centroid:
- x = interpolationData.xCentroid;
- y = interpolationData.yCentroid;
- rhw = interpolationData.rhwCentroid;
+ if(multisample)
+ {
+ x = interpolationData.xCentroid;
+ y = interpolationData.yCentroid;
+ rhw = interpolationData.rhwCentroid;
+ }
+ else
+ {
+ x = interpolationData.x;
+ y = interpolationData.y;
+ rhw = interpolationData.rhw;
+ }
break;
case AtSample:
x = SIMD::Float(0.0f);
y = SIMD::Float(0.0f);
- if(state->getMultiSampleCount() > 1)
+ if(multisample)
{
static constexpr int NUM_SAMPLES = 4;
ASSERT(state->getMultiSampleCount() == NUM_SAMPLES);