diff options
-rw-r--r-- | gm/windowrectangles.cpp | 2 | ||||
-rw-r--r-- | include/gpu/GrCaps.h | 8 | ||||
-rw-r--r-- | src/core/SkGpuBlurUtils.cpp | 4 | ||||
-rw-r--r-- | src/effects/SkAlphaThresholdFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkMorphologyImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrCaps.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrReducedClip.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 17 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.h | 13 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContextPriv.h | 4 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 2 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCCPRAtlas.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 6 | ||||
-rw-r--r-- | tests/ClearTest.cpp | 38 | ||||
-rw-r--r-- | tests/DefaultPathRendererTest.cpp | 6 | ||||
-rw-r--r-- | tests/GrCCPRTest.cpp | 2 | ||||
-rw-r--r-- | tests/GrMeshTest.cpp | 2 | ||||
-rw-r--r-- | tests/GrPipelineDynamicStateTest.cpp | 2 | ||||
-rw-r--r-- | tests/IntTextureTest.cpp | 2 | ||||
-rw-r--r-- | tests/OnFlushCallbackTest.cpp | 10 | ||||
-rw-r--r-- | tests/RectangleTextureTest.cpp | 6 |
22 files changed, 78 insertions, 60 deletions
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index a2c8f0bc10..08fee7b811 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -210,7 +210,7 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetCo // Draw a checker pattern into the alpha mask so we can visualize the regions left untouched by // the clip mask generation. this->stencilCheckerboard(maskRTC.get(), true); - maskRTC->clear(nullptr, GrColorPackA4(0xff), true); + maskRTC->clear(nullptr, GrColorPackA4(0xff), GrRenderTargetContext::CanClearFullscreen::kYes); maskRTC->priv().drawAndStencilRect(make_stencil_only_clip(), &GrUserStencilSettings::kUnused, SkRegion::kDifference_Op, false, GrAA::kNo, SkMatrix::I(), SkRect::MakeIWH(maskRTC->width(), maskRTC->height())); diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 9acb33e554..6cdc0e3ff6 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -55,6 +55,10 @@ public: bool usesMixedSamples() const { return fUsesMixedSamples; } bool preferClientSideDynamicBuffers() const { return fPreferClientSideDynamicBuffers; } + // On tilers, an initial fullscreen clear is an OPTIMIZATION. It allows the hardware to + // initialize each tile with a constant value rather than loading each pixel from memory. + bool preferFullscreenClears() const { return fPreferFullscreenClears; } + bool preferVRAMUseOverFlushes() const { return fPreferVRAMUseOverFlushes; } bool blacklistCoverageCounting() const { return fBlacklistCoverageCounting; } @@ -144,8 +148,6 @@ public: return fBufferMapThreshold; } - bool fullClearIsFree() const { return fFullClearIsFree; } - /** True in environments that will issue errors if memory uploaded to buffers is not initialized (even if not read by draw calls). */ bool mustClearUploadedBufferData() const { return fMustClearUploadedBufferData; } @@ -192,7 +194,7 @@ protected: bool fInstanceAttribSupport : 1; bool fUsesMixedSamples : 1; bool fPreferClientSideDynamicBuffers : 1; - bool fFullClearIsFree : 1; + bool fPreferFullscreenClears : 1; bool fMustClearUploadedBufferData : 1; // Driver workaround diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp index 7720c0ed04..7fa05454d0 100644 --- a/src/core/SkGpuBlurUtils.cpp +++ b/src/core/SkGpuBlurUtils.cpp @@ -162,11 +162,11 @@ static void convolve_gaussian(GrRenderTargetContext* renderTargetContext, dstRect.fRight = midRect.right(); } if (!topRect.isEmpty()) { - renderTargetContext->clear(&topRect, 0, false); + renderTargetContext->clear(&topRect, 0, GrRenderTargetContext::CanClearFullscreen::kNo); } if (!bottomRect.isEmpty()) { - renderTargetContext->clear(&bottomRect, 0, false); + renderTargetContext->clear(&bottomRect, 0, GrRenderTargetContext::CanClearFullscreen::kNo); } if (midRect.isEmpty()) { diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index 435594423f..9753ba138d 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -115,7 +115,7 @@ sk_sp<GrTextureProxy> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* c GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); SkRegion::Iterator iter(fRegion); - rtContext->clear(nullptr, 0x0, true); + rtContext->clear(nullptr, 0x0, GrRenderTargetContext::CanClearFullscreen::kYes); GrFixedClip clip(SkIRect::MakeWH(bounds.width(), bounds.height())); while (!iter.done()) { diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index dd2e0d8efc..d3c4bb7e16 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -882,7 +882,7 @@ static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrContext* context, GrPaint paint; - rtc->clear(nullptr, 0x0, true); + rtc->clear(nullptr, 0x0, GrRenderTargetContext::CanClearFullscreen::kYes); rtc->drawRRect(GrNoClip(), std::move(paint), GrAA::kYes, SkMatrix::I(), rrectToDraw, GrStyle::SimpleFill()); diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 8b0f13a860..67a681db21 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -509,7 +509,7 @@ static sk_sp<SkSpecialImage> apply_morphology( dstRect.width(), radius.fHeight); GrColor clearColor = GrMorphologyEffect::Type::kErode == morphType ? SK_ColorWHITE : SK_ColorTRANSPARENT; - dstRTContext->clear(&clearRect, clearColor, false); + dstRTContext->clear(&clearRect, clearColor, GrRenderTargetContext::CanClearFullscreen::kNo); srcTexture = dstRTContext->asTextureProxyRef(); srcRect = dstRect; diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp index 198551ae9e..2c83cc3bd1 100644 --- a/src/gpu/GrCaps.cpp +++ b/src/gpu/GrCaps.cpp @@ -53,7 +53,7 @@ GrCaps::GrCaps(const GrContextOptions& options) { fInstanceAttribSupport = false; fUsesMixedSamples = false; fPreferClientSideDynamicBuffers = false; - fFullClearIsFree = false; + fPreferFullscreenClears = false; fMustClearUploadedBufferData = false; fSampleShadingSupport = false; fFenceSyncSupport = false; @@ -150,7 +150,7 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const { writer->appendBool("Instance Attrib Support", fInstanceAttribSupport); writer->appendBool("Uses Mixed Samples", fUsesMixedSamples); writer->appendBool("Prefer client-side dynamic buffers", fPreferClientSideDynamicBuffers); - writer->appendBool("Full screen clear is free", fFullClearIsFree); + writer->appendBool("Prefer fullscreen clears", fPreferFullscreenClears); writer->appendBool("Must clear buffer memory", fMustClearUploadedBufferData); writer->appendBool("Sample shading support", fSampleShadingSupport); writer->appendBool("Fence sync support", fFenceSyncSupport); diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 83079d3e66..85a19ed2e5 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -746,7 +746,7 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const { // The scratch texture that we are drawing into can be substantially larger than the mask. Only // clear the part that we care about. GrColor initialCoverage = InitialState::kAllIn == this->initialState() ? -1 : 0; - rtc->priv().clear(clip, initialCoverage, true); + rtc->priv().clear(clip, initialCoverage, GrRenderTargetContext::CanClearFullscreen::kYes); // Set the matrix so that rendered clip elements are transformed to mask space from clip space. SkMatrix translate; diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 03d49bc2bb..70864a0366 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -272,14 +272,15 @@ void GrRenderTargetContext::discard() { void GrRenderTargetContext::clear(const SkIRect* rect, const GrColor color, - bool canIgnoreRect) { + CanClearFullscreen canClearFullscreen) { ASSERT_SINGLE_OWNER RETURN_IF_ABANDONED SkDEBUGCODE(this->validate();) GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "clear", fContext); AutoCheckFlush acf(this->drawingManager()); - this->internalClear(rect ? GrFixedClip(*rect) : GrFixedClip::Disabled(), color, canIgnoreRect); + this->internalClear(rect ? GrFixedClip(*rect) : GrFixedClip::Disabled(), color, + canClearFullscreen); } void GrRenderTargetContextPriv::absClear(const SkIRect* clearRect, const GrColor color) { @@ -319,7 +320,7 @@ void GrRenderTargetContextPriv::absClear(const SkIRect* clearRect, const GrColor void GrRenderTargetContextPriv::clear(const GrFixedClip& clip, const GrColor color, - bool canIgnoreClip) { + CanClearFullscreen canClearFullscreen) { ASSERT_SINGLE_OWNER_PRIV RETURN_IF_ABANDONED_PRIV SkDEBUGCODE(fRenderTargetContext->validate();) @@ -327,16 +328,17 @@ void GrRenderTargetContextPriv::clear(const GrFixedClip& clip, fRenderTargetContext->fContext); AutoCheckFlush acf(fRenderTargetContext->drawingManager()); - fRenderTargetContext->internalClear(clip, color, canIgnoreClip); + fRenderTargetContext->internalClear(clip, color, canClearFullscreen); } void GrRenderTargetContext::internalClear(const GrFixedClip& clip, const GrColor color, - bool canIgnoreClip) { + CanClearFullscreen canClearFullscreen) { bool isFull = false; if (!clip.hasWindowRectangles()) { isFull = !clip.scissorEnabled() || - (canIgnoreClip && fContext->caps()->fullClearIsFree()) || + (CanClearFullscreen::kYes == canClearFullscreen && + fContext->caps()->preferFullscreenClears()) || clip.scissorRect().contains(SkIRect::MakeWH(this->width(), this->height())); } @@ -519,7 +521,8 @@ void GrRenderTargetContext::drawRect(const GrClip& clip, // Will it blend? GrColor clearColor; if (paint.isConstantBlendedColor(&clearColor)) { - this->clear(nullptr, clearColor, true); + this->clear(nullptr, clearColor, + GrRenderTargetContext::CanClearFullscreen::kYes); return; } } diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h index 127063e097..304e6bc0bf 100644 --- a/src/gpu/GrRenderTargetContext.h +++ b/src/gpu/GrRenderTargetContext.h @@ -79,14 +79,19 @@ public: */ void discard(); + enum class CanClearFullscreen : bool { + kNo = false, + kYes = true + }; + /** * Clear the entire or rect of the render target, ignoring any clips. * @param rect the rect to clear or the whole thing if rect is NULL. * @param color the color to clear to. - * @param canIgnoreRect allows partial clears to be converted to whole - * clears on platforms for which that is cheap + * @param CanClearFullscreen allows partial clears to be converted to fullscreen clears on + * tiling platforms where that is an optimization. */ - void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect); + void clear(const SkIRect* rect, GrColor color, CanClearFullscreen); /** * Draw everywhere (respecting the clip) with the paint. @@ -409,7 +414,7 @@ private: friend void test_draw_op(GrRenderTargetContext*, std::unique_ptr<GrFragmentProcessor>, sk_sp<GrTextureProxy>); - void internalClear(const GrFixedClip&, const GrColor, bool canIgnoreClip); + void internalClear(const GrFixedClip&, const GrColor, CanClearFullscreen); // Only consumes the GrPaint if successful. bool drawFilledDRRect(const GrClip& clip, diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h index 41fc725a21..52f5497603 100644 --- a/src/gpu/GrRenderTargetContextPriv.h +++ b/src/gpu/GrRenderTargetContextPriv.h @@ -43,7 +43,9 @@ public: opList->fLastClipNumAnalyticFPs != numClipAnalyticFPs; } - void clear(const GrFixedClip&, const GrColor, bool canIgnoreClip); + using CanClearFullscreen = GrRenderTargetContext::CanClearFullscreen; + + void clear(const GrFixedClip&, const GrColor, CanClearFullscreen); void clearStencilClip(const GrFixedClip&, bool insideStencilMask); diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 3e165582d6..3d5540d2be 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -232,7 +232,7 @@ void SkGpuDevice::clearAll() { GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "clearAll", fContext.get()); SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); - fRenderTargetContext->clear(&rect, 0x0, true); + fRenderTargetContext->clear(&rect, 0x0, GrRenderTargetContext::CanClearFullscreen::kYes); } void SkGpuDevice::replaceRenderTargetContext(bool shouldRetainContent) { diff --git a/src/gpu/ccpr/GrCCPRAtlas.cpp b/src/gpu/ccpr/GrCCPRAtlas.cpp index 8978e31ad9..497241d63f 100644 --- a/src/gpu/ccpr/GrCCPRAtlas.cpp +++ b/src/gpu/ccpr/GrCCPRAtlas.cpp @@ -116,7 +116,7 @@ sk_sp<GrRenderTargetContext> GrCCPRAtlas::finalize(GrOnFlushResourceProvider* on } SkIRect clearRect = SkIRect::MakeSize(fDrawBounds); - rtc->clear(&clearRect, 0, true); + rtc->clear(&clearRect, 0, GrRenderTargetContext::CanClearFullscreen::kYes); rtc->addDrawOp(GrNoClip(), std::move(atlasOp)); fTextureProxy = sk_ref_sp(rtc->asTextureProxy()); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 3a51eb0e0d..efc6628266 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -152,8 +152,10 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, fInvalidateFBType = kDiscard_InvalidateFBType; } - if (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInfo.vendor()) { - fFullClearIsFree = true; + if (kARM_GrGLVendor == ctxInfo.vendor() || + kImagination_GrGLVendor == ctxInfo.vendor() || + kQualcomm_GrGLVendor == ctxInfo.vendor() ) { + fPreferFullscreenClears = true; } if (kGL_GrGLStandard == standard) { diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp index fca031824c..7424c5a3b5 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -79,7 +79,7 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Check a full clear - rtContext->clear(&fullRect, kColor1, false); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -89,8 +89,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Check two full clears, same color - rtContext->clear(&fullRect, kColor1, false); - rtContext->clear(&fullRect, kColor1, false); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -100,8 +100,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Check two full clears, different colors - rtContext->clear(&fullRect, kColor1, false); - rtContext->clear(&fullRect, kColor2, false); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&fullRect, kColor2, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), fullRect, kColor2, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue, failX, failY); @@ -111,8 +111,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a full clear followed by a same color inset clear - rtContext->clear(&fullRect, kColor1, false); - rtContext->clear(&mid1Rect, kColor1, false); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&mid1Rect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -122,8 +122,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a inset clear followed by same color full clear - rtContext->clear(&mid1Rect, kColor1, false); - rtContext->clear(&fullRect, kColor1, false); + rtContext->clear(&mid1Rect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -133,8 +133,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a full clear followed by a different color inset clear - rtContext->clear(&fullRect, kColor1, false); - rtContext->clear(&mid1Rect, kColor2, false); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&mid1Rect, kColor2, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue, failX, failY); @@ -151,8 +151,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a inset clear followed by a different full clear - rtContext->clear(&mid1Rect, kColor2, false); - rtContext->clear(&fullRect, kColor1, false); + rtContext->clear(&mid1Rect, kColor2, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -163,9 +163,9 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { // Check three nested clears from largest to smallest where outermost and innermost are same // color. - rtContext->clear(&fullRect, kColor1, false); - rtContext->clear(&mid1Rect, kColor2, false); - rtContext->clear(&mid2Rect, kColor1, false); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&mid1Rect, kColor2, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&mid2Rect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), mid2Rect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -189,9 +189,9 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Swap the order of the second two clears in the above test. - rtContext->clear(&fullRect, kColor1, false); - rtContext->clear(&mid2Rect, kColor1, false); - rtContext->clear(&mid1Rect, kColor2, false); + rtContext->clear(&fullRect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&mid2Rect, kColor1, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(&mid1Rect, kColor2, GrRenderTargetContext::CanClearFullscreen::kNo); if (!check_rect(rtContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue, failX, failY); diff --git a/tests/DefaultPathRendererTest.cpp b/tests/DefaultPathRendererTest.cpp index 05c4a74089..2576ef42d7 100644 --- a/tests/DefaultPathRendererTest.cpp +++ b/tests/DefaultPathRendererTest.cpp @@ -71,7 +71,8 @@ static void run_test(GrContext* ctx, skiatest::Reporter* reporter) { kBigSize/2+1, kBigSize/2+1, kRGBA_8888_GrPixelConfig, nullptr); - rtc->clear(nullptr, GrColorPackRGBA(0x0, 0x0, 0x0, 0xFF), true); + rtc->clear(nullptr, GrColorPackRGBA(0x0, 0x0, 0x0, 0xFF), + GrRenderTargetContext::CanClearFullscreen::kYes); GrPaint paint; @@ -89,7 +90,8 @@ static void run_test(GrContext* ctx, skiatest::Reporter* reporter) { auto rtc = ctx->makeDeferredRenderTargetContext(SkBackingFit::kExact, kBigSize, kBigSize, kRGBA_8888_GrPixelConfig, nullptr); - rtc->clear(nullptr, GrColorPackRGBA(0x0, 0x0, 0x0, 0xFF), true); + rtc->clear(nullptr, GrColorPackRGBA(0x0, 0x0, 0x0, 0xFF), + GrRenderTargetContext::CanClearFullscreen::kYes); GrPaint paint; diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp index 1164ed8ca0..36bd9dd5ff 100644 --- a/tests/GrCCPRTest.cpp +++ b/tests/GrCCPRTest.cpp @@ -69,7 +69,7 @@ public: } bool valid() const { return fCCPR && fRTC; } - void clear() const { fRTC->clear(nullptr, 0, true); } + void clear() const { fRTC->clear(nullptr, 0, GrRenderTargetContext::CanClearFullscreen::kYes); } void abandonGrContext() { fCtx = nullptr; fCCPR = nullptr; fRTC = nullptr; } void drawPath(SkPath path, GrColor4f color = GrColor4f(0, 1, 0, 1)) const { diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp index b89e1987d8..07b5999db6 100644 --- a/tests/GrMeshTest.cpp +++ b/tests/GrMeshTest.cpp @@ -389,7 +389,7 @@ static void run_test(const char* testName, skiatest::Reporter* reporter, } SkAutoSTMalloc<kImageHeight * kImageWidth, uint32_t> resultPx(h * rowBytes); - rtc->clear(nullptr, 0xbaaaaaad, true); + rtc->clear(nullptr, 0xbaaaaaad, GrRenderTargetContext::CanClearFullscreen::kYes); rtc->priv().testingOnly_addDrawOp(skstd::make_unique<GrMeshTestOp>(testFn)); rtc->readPixels(gold.info(), resultPx, rowBytes, 0, 0, 0); for (int y = 0; y < h; ++y) { diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp index d84afb1635..f65744abeb 100644 --- a/tests/GrPipelineDynamicStateTest.cpp +++ b/tests/GrPipelineDynamicStateTest.cpp @@ -192,7 +192,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo uint32_t resultPx[kScreenSize * kScreenSize]; for (ScissorState scissorState : {ScissorState::kEnabled, ScissorState::kDisabled}) { - rtc->clear(nullptr, 0xbaaaaaad, true); + rtc->clear(nullptr, 0xbaaaaaad, GrRenderTargetContext::CanClearFullscreen::kYes); rtc->priv().testingOnly_addDrawOp( skstd::make_unique<GrPipelineDynamicStateTestOp>(scissorState, vbuff)); rtc->readPixels(SkImageInfo::Make(kScreenSize, kScreenSize, diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp index 5aedcfdf78..4e467857b6 100644 --- a/tests/IntTextureTest.cpp +++ b/tests/IntTextureTest.cpp @@ -262,7 +262,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) { if (!fp) { return; } - rtContext->clear(nullptr, 0xDDAABBCC, true); + rtContext->clear(nullptr, 0xDDAABBCC, GrRenderTargetContext::CanClearFullscreen::kYes); GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); paint.addColorFragmentProcessor(std::move(fp)); diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp index c7af59ac9f..8d290daa9e 100644 --- a/tests/OnFlushCallbackTest.cpp +++ b/tests/OnFlushCallbackTest.cpp @@ -329,7 +329,8 @@ public: nullptr, nullptr); #endif - rtc->clear(nullptr, 0xFFFFFFFF, true); // clear the atlas + // clear the atlas + rtc->clear(nullptr, 0xFFFFFFFF, GrRenderTargetContext::CanClearFullscreen::kYes); int blocksInAtlas = 0; for (int i = 0; i < lists.count(); ++i) { @@ -339,7 +340,7 @@ public: // For now, we avoid the resource buffer issues and just use clears #if 1 - rtc->clear(&r, op->color(), false); + rtc->clear(&r, op->color(), GrRenderTargetContext::CanClearFullscreen::kNo); #else GrPaint paint; paint.setColor4f(GrColor4f::FromGrColor(op->color())); @@ -410,7 +411,8 @@ static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject kRGBA_8888_GrPixelConfig, nullptr)); - rtc->clear(nullptr, GrColorPackRGBA(255, 0, 0, 255), true); + rtc->clear(nullptr, GrColorPackRGBA(255, 0, 0, 255), + GrRenderTargetContext::CanClearFullscreen::kYes); for (int i = 0; i < 3; ++i) { SkRect r = SkRect::MakeXYWH(i*kDrawnTileSize, 0, kDrawnTileSize, kDrawnTileSize); @@ -539,7 +541,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) { kRGBA_8888_GrPixelConfig, nullptr)); - rtc->clear(nullptr, 0xFFFFFFFF, true); + rtc->clear(nullptr, 0xFFFFFFFF, GrRenderTargetContext::CanClearFullscreen::kYes); // Note that this doesn't include the third texture proxy for (int i = 0; i < kNumProxies-1; ++i) { diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index d3a7221708..8a5cca09c7 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -28,7 +28,7 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont for (auto filter : {GrSamplerState::Filter::kNearest, GrSamplerState::Filter::kBilerp, GrSamplerState::Filter::kMipMap}) { - rtContext->clear(nullptr, 0xDDCCBBAA, true); + rtContext->clear(nullptr, 0xDDCCBBAA, GrRenderTargetContext::CanClearFullscreen::kYes); auto fp = GrSimpleTextureEffect::Make(rectProxy, SkMatrix::I(), filter); GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -43,7 +43,7 @@ static void test_clear(skiatest::Reporter* reporter, GrSurfaceContext* rectConte if (GrRenderTargetContext* rtc = rectContext->asRenderTargetContext()) { // Clear the whole thing. GrColor color0 = GrColorPackRGBA(0xA, 0xB, 0xC, 0xD); - rtc->clear(nullptr, color0, false); + rtc->clear(nullptr, color0, GrRenderTargetContext::CanClearFullscreen::kNo); int w = rtc->width(); int h = rtc->height(); @@ -64,7 +64,7 @@ static void test_clear(skiatest::Reporter* reporter, GrSurfaceContext* rectConte // Clear the the top to a different color. GrColor color1 = GrColorPackRGBA(0x1, 0x2, 0x3, 0x4); SkIRect rect = SkIRect::MakeWH(w, h/2); - rtc->clear(&rect, color1, false); + rtc->clear(&rect, color1, GrRenderTargetContext::CanClearFullscreen::kNo); uint32_t expectedColor1 = 0; uint8_t* expectedBytes1 = SkTCast<uint8_t*>(&expectedColor1); |