aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-12-11 15:42:09 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-12 15:21:09 +0000
commit344e9037e1befdee76691a1239a47829e6af4ea5 (patch)
tree16d7902f9ee8fc261bc17f465bb9488dccd56532 /src
parent6e64f308910493b4327f7b8aadd7f4aabf3a9601 (diff)
Prefer fullscreen clears on Qualcomm/GL
Adds Qualcomm to the set of GL devices on which we prefer fullscreen clears. Renames fullscreenClearIsFree in GrCaps to preferFullscreenClears. Replaces 'bool canIgnoreClip' on GrRenderTargetContext::clear with an enum. Bug: skia: Change-Id: I5b30298c4d0b092c398b9fea6060f3e2bea91e46 Reviewed-on: https://skia-review.googlesource.com/83060 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkGpuBlurUtils.cpp4
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp2
-rw-r--r--src/effects/SkBlurMaskFilter.cpp2
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp2
-rw-r--r--src/gpu/GrCaps.cpp4
-rw-r--r--src/gpu/GrReducedClip.cpp2
-rw-r--r--src/gpu/GrRenderTargetContext.cpp17
-rw-r--r--src/gpu/GrRenderTargetContext.h13
-rw-r--r--src/gpu/GrRenderTargetContextPriv.h4
-rw-r--r--src/gpu/SkGpuDevice.cpp2
-rw-r--r--src/gpu/ccpr/GrCCPRAtlas.cpp2
-rw-r--r--src/gpu/gl/GrGLCaps.cpp6
12 files changed, 36 insertions, 24 deletions
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) {