Commit 1737a30e by Alexis Hetu Committed by Alexis Hétu

Removed stencil reference from PixelProcessor::States

Changing the stencil reference shouldn't be causing a new fragment shader to compile, since it has no effect on the generated program. This cl removes the front and back stencil reference from the States structure to avoid uselessly generating programs. Improves the run times of a few dEQP.KHR_GLES3 tests with SwANGLE: dEQP.KHR_GLES3/packed_depth_stencil_verify_read_pixels_depth24_stencil8 -> Test runs ~8X faster (from ~4s down to ~500ms) dEQP.KHR_GLES3/packed_depth_stencil_verify_read_pixels_depth32f_stencil8 -> Test runs ~19X faster (from ~3.8s down to ~200ms) Bug: b/143288278 Change-Id: Ic46db6822daa924599de0f0a9e9688f8bacc95ea Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/37568 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent f44f7c06
......@@ -33,6 +33,28 @@ namespace sw
public:
struct States : Memset<States>
{
// Same as VkStencilOpState, but with no reference, as it's not part of the state
// (it doesn't require a different program to be generated)
struct StencilOpState
{
VkStencilOp failOp;
VkStencilOp passOp;
VkStencilOp depthFailOp;
VkCompareOp compareOp;
uint32_t compareMask;
uint32_t writeMask;
void operator=(const VkStencilOpState &rhs)
{
failOp = rhs.failOp;
passOp = rhs.passOp;
depthFailOp = rhs.depthFailOp;
compareOp = rhs.compareOp;
compareMask = rhs.compareMask;
writeMask = rhs.writeMask;
}
};
States() : Memset(this, 0) {}
uint32_t computeHash();
......@@ -44,8 +66,8 @@ namespace sw
bool quadLayoutDepthBuffer;
bool stencilActive;
VkStencilOpState frontStencil;
VkStencilOpState backStencil;
StencilOpState frontStencil;
StencilOpState backStencil;
bool depthTestActive;
bool occlusionEnabled;
......
......@@ -749,7 +749,7 @@ namespace sw
*Pointer<Byte4>(buffer) = Byte4(newValue);
}
void PixelRoutine::stencilOperation(Byte8 &newValue, Byte8 &bufferValue, VkStencilOpState const &ops, bool isBack, Int &zMask, Int &sMask)
void PixelRoutine::stencilOperation(Byte8 &newValue, Byte8 &bufferValue, PixelProcessor::States::StencilOpState const &ops, bool isBack, Int &zMask, Int &sMask)
{
Byte8 &pass = newValue;
Byte8 fail;
......
......@@ -67,7 +67,7 @@ namespace sw
Float4 interpolateCentroid(Float4 &x, Float4 &y, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective);
void stencilTest(Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &cMask);
void stencilTest(Byte8 &value, VkCompareOp stencilCompareMode, bool isBack);
void stencilOperation(Byte8 &newValue, Byte8 &bufferValue, VkStencilOpState const &ops, bool isBack, Int &zMask, Int &sMask);
void stencilOperation(Byte8 &newValue, Byte8 &bufferValue, PixelProcessor::States::StencilOpState const &ops, bool isBack, Int &zMask, Int &sMask);
void stencilOperation(Byte8 &output, Byte8 &bufferValue, VkStencilOp operation, bool isBack);
Bool depthTest(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &sMask, Int &zMask, Int &cMask);
......
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