Evaluate interpolants at pixel center when multisampling disabled
Bug: b/142965928
Change-Id: I0c2e7054d51a1dd3d1e0915384b5cfbdaffda178
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40349
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Device/PixelProcessor.cpp b/src/Device/PixelProcessor.cpp
index cba29ae..d8d407d 100644
--- a/src/Device/PixelProcessor.cpp
+++ b/src/Device/PixelProcessor.cpp
@@ -138,7 +138,7 @@
state.enableMultiSampling = (state.multiSampleCount > 1) &&
!(context->isDrawLine(true) && (context->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT));
- if(state.multiSampleCount > 1 && context->pixelShader)
+ if(state.enableMultiSampling && context->pixelShader)
{
state.centroid = context->pixelShader->getModes().NeedsCentroid;
}
diff --git a/src/Device/QuadRasterizer.cpp b/src/Device/QuadRasterizer.cpp
index b652b59..edda271 100644
--- a/src/Device/QuadRasterizer.cpp
+++ b/src/Device/QuadRasterizer.cpp
@@ -129,7 +129,7 @@
{
Float4 y = yyyy;
- if(state.multiSampleCount > 1)
+ if(state.enableMultiSampling)
{
y -= *Pointer<Float4>(constants + OFFSET(Constants, Y) + q * sizeof(float4));
}
diff --git a/src/Pipeline/PixelRoutine.cpp b/src/Pipeline/PixelRoutine.cpp
index 1f382e6..ffb81b8 100644
--- a/src/Pipeline/PixelRoutine.cpp
+++ b/src/Pipeline/PixelRoutine.cpp
@@ -80,7 +80,7 @@
{
Float4 x = xxxx;
- if(state.multiSampleCount > 1)
+ if(state.enableMultiSampling)
{
x -= *Pointer<Float4>(constants + OFFSET(Constants, X) + q * sizeof(float4));
}
@@ -144,7 +144,7 @@
auto const &input = spirvShader->inputs[interpolant];
if(input.Type != SpirvShader::ATTRIBTYPE_UNUSED)
{
- if(input.Centroid && state.multiSampleCount > 1)
+ if(input.Centroid && state.enableMultiSampling)
{
routine.inputs[interpolant] =
interpolateCentroid(XXXX, YYYY, rhwCentroid,
@@ -172,10 +172,9 @@
auto clipMask = SignMask(CmpGE(distance, SIMD::Float(0)));
for(auto ms = 0u; ms < state.multiSampleCount; ms++)
{
- // TODO: Fragments discarded by clipping do not exist at
- // all -- they should not be counted in queries or have
- // their Z/S effects performed when early fragment tests
- // are enabled.
+ // FIXME(b/148105887): Fragments discarded by clipping do not exist at
+ // all -- they should not be counted in queries or have their Z/S effects
+ // performed when early fragment tests are enabled.
cMask[ms] &= clipMask;
}