Skip to content

Commit 9443d58

Browse files
rphilliSkia Commit-Bot
authored andcommitted
Revert "Fix bug in GrClearOp combining and remove some asserts"
This reverts commit 35f1b20. 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 <[email protected]> > Reviewed-by: Michael Ludwig <[email protected]> [email protected],[email protected] 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 <[email protected]> Commit-Queue: Robert Phillips <[email protected]>
1 parent 799b32e commit 9443d58

File tree

3 files changed

+2
-57
lines changed

3 files changed

+2
-57
lines changed

src/gpu/ops/GrClearOp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ GrOp::CombineResult GrClearOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const
6060
// When the scissors are the exact same but the buffers are different, we can combine and
6161
// clear both stencil and clear together in onExecute().
6262
if (other->fBuffer & Buffer::kColor) {
63+
SkASSERT((fBuffer & Buffer::kStencilClip) && !(fBuffer & Buffer::kColor));
6364
fColor = other->fColor;
6465
}
6566
if (other->fBuffer & Buffer::kStencilClip) {
67+
SkASSERT(!(fBuffer & Buffer::kStencilClip) && (fBuffer & Buffer::kColor));
6668
fStencilInsideMask = other->fStencilInsideMask;
6769
}
6870
fBuffer = Buffer::kBoth;
69-
return CombineResult::kMerged;
7071
}
7172
return CombineResult::kCannotCombine;
7273
}

src/gpu/ops/GrClearOp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class GrClearOp final : public GrOp {
3030

3131
const char* name() const override { return "Clear"; }
3232

33-
SkPMColor4f color() const { return fColor; }
34-
bool stencilInsideMask() const { return fStencilInsideMask; }
3533
private:
3634
friend class GrOp; // for ctors
3735

tests/ClearTest.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
#include "include/private/SkColorData.h"
2222
#include "src/core/SkAutoPixmapStorage.h"
2323
#include "src/gpu/GrColor.h"
24-
#include "src/gpu/GrDirectContextPriv.h"
2524
#include "src/gpu/GrImageInfo.h"
2625
#include "src/gpu/GrRenderTargetContext.h"
27-
#include "src/gpu/ops/GrClearOp.h"
2826
#include "tests/Test.h"
2927
#include "tools/gpu/GrContextFactory.h"
3028

@@ -241,58 +239,6 @@ static void clear_op_test(skiatest::Reporter* reporter, GrDirectContext* dContex
241239
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
242240
failX, failY);
243241
}
244-
245-
// Clear calls need to remain ClearOps for the following combining-tests to work as expected
246-
if (!dContext->priv().caps()->performColorClearsAsDraws() &&
247-
!dContext->priv().caps()->performStencilClearsAsDraws() &&
248-
!dContext->priv().caps()->performPartialClearsAsDraws()) {
249-
static constexpr SkIRect kScissorRect = SkIRect::MakeXYWH(1, 1, kW-1, kH-1);
250-
251-
// Try combining a pure-color clear w/ a combined stencil & color clear
252-
// (re skbug.com/10963)
253-
{
254-
rtContext = newRTC(dContext, kW, kH);
255-
SkASSERT(rtContext);
256-
257-
rtContext->clearStencilClip(kScissorRect, true);
258-
// This color clear can combine w/ the preceding stencil clear
259-
rtContext->clear(kScissorRect, SK_PMColor4fWHITE);
260-
261-
// This should combine w/ the prior combined clear and overwrite the color
262-
rtContext->clear(kScissorRect, SK_PMColor4fBLACK);
263-
264-
GrOpsTask* ops = rtContext->getOpsTask();
265-
REPORTER_ASSERT(reporter, ops->numOpChains() == 1);
266-
267-
const GrClearOp& clearOp = ops->getChain(0)->cast<GrClearOp>();
268-
269-
REPORTER_ASSERT(reporter, clearOp.color() == SK_PMColor4fBLACK);
270-
REPORTER_ASSERT(reporter, clearOp.stencilInsideMask());
271-
}
272-
273-
// Try combining a pure-stencil clear w/ a combined stencil & color clear
274-
// (re skbug.com/10963)
275-
{
276-
rtContext = newRTC(dContext, kW, kH);
277-
SkASSERT(rtContext);
278-
279-
rtContext->clearStencilClip(kScissorRect, true);
280-
// This color clear can combine w/ the preceding stencil clear
281-
rtContext->clear(kScissorRect, SK_PMColor4fWHITE);
282-
283-
// This should combine w/ the prior combined clear and overwrite the 'insideStencilMask'
284-
// field
285-
rtContext->clearStencilClip(kScissorRect, false);
286-
287-
GrOpsTask* ops = rtContext->getOpsTask();
288-
REPORTER_ASSERT(reporter, ops->numOpChains() == 1);
289-
290-
const GrClearOp& clearOp = ops->getChain(0)->cast<GrClearOp>();
291-
292-
REPORTER_ASSERT(reporter, clearOp.color() == SK_PMColor4fWHITE);
293-
REPORTER_ASSERT(reporter, !clearOp.stencilInsideMask());
294-
}
295-
}
296242
}
297243

298244
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo) {

0 commit comments

Comments
 (0)