Commit 71a1e015 by Chris Forbes

Always apply the fragment shader if it is present

Previously we tried to avoid applying a shader which didn't do anything useful. Unfortunately we missed various edge cases. Just remove this logic completely. Bug: b/118386749 Test: dEQP-VK.renderpass* Change-Id: I48f2f9f08ad491381db22af9f6f3430f7b4d4db1 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29728Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 32ac8317
...@@ -181,13 +181,14 @@ namespace sw ...@@ -181,13 +181,14 @@ namespace sw
Bool alphaPass = true; Bool alphaPass = true;
if(colorUsed())
{
#if PERF_PROFILE #if PERF_PROFILE
Long shaderTime = Ticks(); Long shaderTime = Ticks();
#endif #endif
if (spirvShader)
{
applyShader(cMask); applyShader(cMask);
}
#if PERF_PROFILE #if PERF_PROFILE
cycles[PERF_SHADER] += Ticks() - shaderTime; cycles[PERF_SHADER] += Ticks() - shaderTime;
...@@ -203,7 +204,6 @@ namespace sw ...@@ -203,7 +204,6 @@ namespace sw
sMask[q] &= cMask[q]; sMask[q] &= cMask[q];
} }
} }
}
If(alphaPass) If(alphaPass)
{ {
...@@ -234,15 +234,12 @@ namespace sw ...@@ -234,15 +234,12 @@ namespace sw
} }
} }
if(colorUsed())
{
#if PERF_PROFILE #if PERF_PROFILE
AddAtomic(Pointer<Long>(&profiler.ropOperations), 4); AddAtomic(Pointer<Long>(&profiler.ropOperations), 4);
#endif #endif
rasterOperation(cBuffer, x, sMask, zMask, cMask); rasterOperation(cBuffer, x, sMask, zMask, cMask);
} }
}
#if PERF_PROFILE #if PERF_PROFILE
cycles[PERF_ROP] += Ticks() - ropTime; cycles[PERF_ROP] += Ticks() - ropTime;
...@@ -2474,9 +2471,4 @@ namespace sw ...@@ -2474,9 +2471,4 @@ namespace sw
return Min(Max(linear, Float4(0.0f)), Float4(1.0f)); return Min(Max(linear, Float4(0.0f)), Float4(1.0f));
} }
bool PixelRoutine::colorUsed()
{
return state.colorWriteMask || state.alphaToCoverage || (spirvShader && spirvShader->getModes().ContainsKill);
}
} }
...@@ -89,8 +89,6 @@ namespace sw ...@@ -89,8 +89,6 @@ namespace sw
void writeDepth32F(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &zMask); void writeDepth32F(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &zMask);
void writeDepth16(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &zMask); void writeDepth16(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &zMask);
bool colorUsed();
}; };
} }
......
...@@ -511,6 +511,11 @@ namespace sw ...@@ -511,6 +511,11 @@ namespace sw
return inputBuiltins.find(b) != inputBuiltins.end(); return inputBuiltins.find(b) != inputBuiltins.end();
} }
bool hasBuiltinOutput(spv::BuiltIn b) const
{
return outputBuiltins.find(b) != outputBuiltins.end();
}
struct Decorations struct Decorations
{ {
int32_t Location = -1; int32_t Location = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment