Revert "Fix bug in GrClearOp combining and remove some asserts"

This reverts commit 35f1b20840.

Reason for revert: ANGLE failures

Original change's description:
> Fix bug in GrClearOp combining and remove some asserts
>
> The buffer combining code path was combining the ops but never
> telling the external system that the second op could be removed.
>
> Bug: skia:10963
> Change-Id: If015d877ffbbb75964aae9ca92ea760d7041372a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339203
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

TBR=robertphillips@google.com,michaelludwig@google.com

Change-Id: Ie188190e7ecf2c39ec067296af20a9794636a226
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10963
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340177
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2020-12-02 18:20:53 +00:00 committed by Skia Commit-Bot
parent 799b32e25d
commit 9443d58af2
3 changed files with 2 additions and 57 deletions

View File

@ -60,13 +60,14 @@ GrOp::CombineResult GrClearOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const
// When the scissors are the exact same but the buffers are different, we can combine and
// clear both stencil and clear together in onExecute().
if (other->fBuffer & Buffer::kColor) {
SkASSERT((fBuffer & Buffer::kStencilClip) && !(fBuffer & Buffer::kColor));
fColor = other->fColor;
}
if (other->fBuffer & Buffer::kStencilClip) {
SkASSERT(!(fBuffer & Buffer::kStencilClip) && (fBuffer & Buffer::kColor));
fStencilInsideMask = other->fStencilInsideMask;
}
fBuffer = Buffer::kBoth;
return CombineResult::kMerged;
}
return CombineResult::kCannotCombine;
}

View File

@ -30,8 +30,6 @@ public:
const char* name() const override { return "Clear"; }
SkPMColor4f color() const { return fColor; }
bool stencilInsideMask() const { return fStencilInsideMask; }
private:
friend class GrOp; // for ctors

View File

@ -21,10 +21,8 @@
#include "include/private/SkColorData.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/gpu/GrColor.h"
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/ops/GrClearOp.h"
#include "tests/Test.h"
#include "tools/gpu/GrContextFactory.h"
@ -241,58 +239,6 @@ static void clear_op_test(skiatest::Reporter* reporter, GrDirectContext* dContex
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
// Clear calls need to remain ClearOps for the following combining-tests to work as expected
if (!dContext->priv().caps()->performColorClearsAsDraws() &&
!dContext->priv().caps()->performStencilClearsAsDraws() &&
!dContext->priv().caps()->performPartialClearsAsDraws()) {
static constexpr SkIRect kScissorRect = SkIRect::MakeXYWH(1, 1, kW-1, kH-1);
// Try combining a pure-color clear w/ a combined stencil & color clear
// (re skbug.com/10963)
{
rtContext = newRTC(dContext, kW, kH);
SkASSERT(rtContext);
rtContext->clearStencilClip(kScissorRect, true);
// This color clear can combine w/ the preceding stencil clear
rtContext->clear(kScissorRect, SK_PMColor4fWHITE);
// This should combine w/ the prior combined clear and overwrite the color
rtContext->clear(kScissorRect, SK_PMColor4fBLACK);
GrOpsTask* ops = rtContext->getOpsTask();
REPORTER_ASSERT(reporter, ops->numOpChains() == 1);
const GrClearOp& clearOp = ops->getChain(0)->cast<GrClearOp>();
REPORTER_ASSERT(reporter, clearOp.color() == SK_PMColor4fBLACK);
REPORTER_ASSERT(reporter, clearOp.stencilInsideMask());
}
// Try combining a pure-stencil clear w/ a combined stencil & color clear
// (re skbug.com/10963)
{
rtContext = newRTC(dContext, kW, kH);
SkASSERT(rtContext);
rtContext->clearStencilClip(kScissorRect, true);
// This color clear can combine w/ the preceding stencil clear
rtContext->clear(kScissorRect, SK_PMColor4fWHITE);
// This should combine w/ the prior combined clear and overwrite the 'insideStencilMask'
// field
rtContext->clearStencilClip(kScissorRect, false);
GrOpsTask* ops = rtContext->getOpsTask();
REPORTER_ASSERT(reporter, ops->numOpChains() == 1);
const GrClearOp& clearOp = ops->getChain(0)->cast<GrClearOp>();
REPORTER_ASSERT(reporter, clearOp.color() == SK_PMColor4fWHITE);
REPORTER_ASSERT(reporter, !clearOp.stencilInsideMask());
}
}
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo) {