Revert "Fix texture barriers on DMSAA"
This reverts commit 1a3f4ab4901c2294d13c785717655ce059eb42fa.
Reason for revert: breaking dmsaa test on intel hd405, https://ci.chromium.org/raw/build/logs.chromium.org/skia/54538c41f1c1b111/+/annotations
Original change's description:
> Fix texture barriers on DMSAA
>
> Bug: skia:11396
> Change-Id: Iad74958c05ed086fe85656b9dc5418d5ab4589e7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419838
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com
Change-Id: I8be8107a98584dfb7f831a296078753fecfcebcf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421056
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 674d446..e3bbe06 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -293,17 +293,6 @@
bool fSuppressDualSourceBlending = false;
/**
- * Prevents the use of non-coefficient-based blend equations, for testing dst reads, barriers,
- * and in-shader blending.
- */
- bool fSuppressAdvancedBlendEquations = false;
-
- /**
- * Prevents the use of framebuffer fetches, for testing dst reads and texture barriers.
- */
- bool fSuppressFramebufferFetch = false;
-
- /**
* If true, the caps will never support geometry shaders.
*/
bool fSuppressGeometryShaders = false;
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 49ba93d..f2aea46 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -133,9 +133,6 @@
fMaxTextureSize = std::min(fMaxTextureSize, options.fMaxTextureSizeOverride);
#if GR_TEST_UTILS
- if (options.fSuppressAdvancedBlendEquations) {
- fBlendEquationSupport = kBasic_BlendEquationSupport;
- }
if (options.fClearAllTextures) {
fShouldInitializeTextures = true;
}
@@ -143,9 +140,6 @@
fWritePixelsRowBytesSupport = false;
fTransferPixelsToRowBytesSupport = false;
}
- if (options.fAlwaysPreferHardwareTessellation) {
- fMinPathVerbsForHwTessellation = fMinStrokeVerbsForHwTessellation = 0;
- }
#endif
if (options.fSuppressMipmapSupport) {
fMipmapSupport = false;
@@ -159,6 +153,12 @@
fInternalMultisampleCount = options.fInternalMultisampleCount;
+#if GR_TEST_UTILS
+ if (options.fAlwaysPreferHardwareTessellation) {
+ fMinPathVerbsForHwTessellation = fMinStrokeVerbsForHwTessellation = 0;
+ }
+#endif
+
fAvoidStencilBuffers = options.fAvoidStencilBuffers;
fDriverBugWorkarounds.applyOverrides(options.fDriverBugWorkarounds);
@@ -438,10 +438,9 @@
return GrBackendFormatToCompressionType(format) != SkImage::CompressionType::kNone;
}
-GrDstSampleFlags GrCaps::getDstSampleFlagsForProxy(const GrRenderTargetProxy* rt,
- bool drawUsesMSAA) const {
+GrDstSampleFlags GrCaps::getDstSampleFlagsForProxy(const GrRenderTargetProxy* rt) const {
SkASSERT(rt);
- if (this->textureBarrierSupport() && (!drawUsesMSAA || this->msaaResolvesAutomatically())) {
+ if (this->textureBarrierSupport() && !rt->requiresManualMSAAResolve()) {
return this->onGetDstSampleFlagsForProxy(rt);
}
return GrDstSampleFlags::kNone;
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 38e2552..aafdb86 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -400,7 +400,7 @@
bool alwaysDrawQuadsIndexed() const { return fAlwaysDrawQuadsIndexed; }
// Returns how to sample the dst values for the passed in GrRenderTargetProxy.
- GrDstSampleFlags getDstSampleFlagsForProxy(const GrRenderTargetProxy*, bool drawUsesMSAA) const;
+ GrDstSampleFlags getDstSampleFlagsForProxy(const GrRenderTargetProxy*) const;
/**
* This is used to try to ensure a successful copy a dst in order to perform shader-based
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index ab32cd9..3c9b49f 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -373,14 +373,14 @@
#ifdef SK_DEBUG
// This block checks for any unnecessary splits in the opsTasks. If two sequential opsTasks
- // could have merged it means the opsTask was artificially split.
+ // share the same backing GrSurfaceProxy it means the opsTask was artificially split.
if (!fDAG.empty()) {
GrOpsTask* prevOpsTask = fDAG[0]->asOpsTask();
for (int i = 1; i < fDAG.count(); ++i) {
GrOpsTask* curOpsTask = fDAG[i]->asOpsTask();
if (prevOpsTask && curOpsTask) {
- SkASSERT(!prevOpsTask->canMerge(curOpsTask));
+ SkASSERT(prevOpsTask->target(0) != curOpsTask->target(0));
}
prevOpsTask = curOpsTask;
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 623084a..9e00676 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -442,8 +442,7 @@
// can end up with GrOpsTasks that only have a discard load op and no ops. For vulkan validation
// we need to keep that discard and not drop it. Once we have reduce op list splitting enabled
// we shouldn't end up with GrOpsTasks with only discard.
- if (this->isColorNoOp() ||
- (fClippedContentBounds.isEmpty() && fColorLoadOp != GrLoadOp::kDiscard)) {
+ if (this->isNoOp() || (fClippedContentBounds.isEmpty() && fColorLoadOp != GrLoadOp::kDiscard)) {
return;
}
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
@@ -468,8 +467,7 @@
// can end up with GrOpsTasks that only have a discard load op and no ops. For vulkan validation
// we need to keep that discard and not drop it. Once we have reduce op list splitting enabled
// we shouldn't end up with GrOpsTasks with only discard.
- if (this->isColorNoOp() ||
- (fClippedContentBounds.isEmpty() && fColorLoadOp != GrLoadOp::kDiscard)) {
+ if (this->isNoOp() || (fClippedContentBounds.isEmpty() && fColorLoadOp != GrLoadOp::kDiscard)) {
return;
}
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
@@ -550,8 +548,7 @@
// can end up with GrOpsTasks that only have a discard load op and no ops. For vulkan validation
// we need to keep that discard and not drop it. Once we have reduce op list splitting enabled
// we shouldn't end up with GrOpsTasks with only discard.
- if (this->isColorNoOp() ||
- (fClippedContentBounds.isEmpty() && fColorLoadOp != GrLoadOp::kDiscard)) {
+ if (this->isNoOp() || (fClippedContentBounds.isEmpty() && fColorLoadOp != GrLoadOp::kDiscard)) {
return false;
}
@@ -687,17 +684,12 @@
fRenderPassXferBarriers = GrXferBarrierFlags::kNone;
}
-bool GrOpsTask::canMerge(const GrOpsTask* opsTask) const {
- return this->target(0) == opsTask->target(0) &&
- fArenas == opsTask->fArenas &&
- !opsTask->fCannotMergeBackward;
-}
-
int GrOpsTask::mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks) {
int mergedCount = 0;
for (const sk_sp<GrRenderTask>& task : tasks) {
auto opsTask = task->asOpsTask();
- if (!opsTask || !this->canMerge(opsTask)) {
+ if (!opsTask || opsTask->target(0) != this->target(0)
+ || this->fArenas != opsTask->fArenas) {
break;
}
SkASSERT(fTargetSwizzle == opsTask->fTargetSwizzle);
@@ -879,7 +871,7 @@
this->deleteOps();
fDeferredProxies.reset();
fColorLoadOp = GrLoadOp::kLoad;
- SkASSERT(this->isColorNoOp());
+ SkASSERT(this->isNoOp());
}
bool GrOpsTask::onIsUsed(GrSurfaceProxy* proxyToCheck) const {
@@ -906,7 +898,7 @@
void GrOpsTask::gatherProxyIntervals(GrResourceAllocator* alloc) const {
SkASSERT(this->isClosed());
- if (this->isColorNoOp()) {
+ if (this->isNoOp()) {
return;
}
@@ -1051,7 +1043,7 @@
GrRenderTask::ExpectedOutcome GrOpsTask::onMakeClosed(const GrCaps& caps,
SkIRect* targetUpdateBounds) {
this->forwardCombine(caps);
- if (!this->isColorNoOp()) {
+ if (!this->isNoOp()) {
GrSurfaceProxy* proxy = this->target(0);
// Use the entire backing store bounds since the GPU doesn't clip automatically to the
// logical dimensions.
diff --git a/src/gpu/GrOpsTask.h b/src/gpu/GrOpsTask.h
index f0d016f..6c93c0c 100644
--- a/src/gpu/GrOpsTask.h
+++ b/src/gpu/GrOpsTask.h
@@ -43,7 +43,6 @@
bool isEmpty() const { return fOpChains.empty(); }
bool usesMSAASurface() const { return fUsesMSAASurface; }
- GrXferBarrierFlags renderPassXferBarriers() const { return fRenderPassXferBarriers; }
/**
* Empties the draw buffer of any queued up draws.
@@ -88,9 +87,6 @@
// Must only be called if native color buffer clearing is enabled.
void setColorLoadOp(GrLoadOp op, std::array<float, 4> color = {0, 0, 0, 0});
- // Returns whether the given opsTask can be appended at the end of this one.
- bool canMerge(const GrOpsTask*) const;
-
// Merge as many opsTasks as possible from the head of 'tasks'. They should all be
// renderPass compatible. Return the number of tasks merged into 'this'.
int mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks);
@@ -111,9 +107,12 @@
#endif
private:
- bool isColorNoOp() const {
+ bool isNoOp() const {
// TODO: GrLoadOp::kDiscard (i.e., storing a discard) should also be grounds for skipping
// execution. We currently don't because of Vulkan. See http://skbug.com/9373.
+ //
+ // TODO: We should also consider stencil load/store here. We get away with it for now
+ // because we never discard stencil buffers.
return fOpChains.empty() && GrLoadOp::kLoad == fColorLoadOp;
}
@@ -143,11 +142,6 @@
// get preserved across its split tasks.
void setMustPreserveStencil() { fMustPreserveStencil = true; }
- // Prevents this opsTask from merging backward. This is used by DMSAA when a non-multisampled
- // opsTask cannot be promoted to MSAA, or when we split a multisampled opsTask in order to
- // resolve its texture.
- void setCannotMergeBackward() { fCannotMergeBackward = true; }
-
class OpChain {
public:
OpChain(GrOp::Owner, GrProcessorSet::Analysis, GrAppliedClip*, const GrDstProxyView*);
@@ -260,7 +254,6 @@
std::array<float, 4> fLoadClearColor = {0, 0, 0, 0};
StencilContent fInitialStencilContent = StencilContent::kDontCare;
bool fMustPreserveStencil = false;
- bool fCannotMergeBackward = false;
uint32_t fLastClipStackGenID = SK_InvalidUniqueID;
SkIRect fLastDevClipBounds;
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp
index aa2cf3e..d723a50 100644
--- a/src/gpu/GrShaderCaps.cpp
+++ b/src/gpu/GrShaderCaps.cpp
@@ -196,9 +196,6 @@
if (options.fSuppressDualSourceBlending) {
fDualSourceBlendingSupport = false;
}
- if (options.fSuppressFramebufferFetch) {
- fFBFetchSupport = false;
- }
if (options.fSuppressGeometryShaders) {
fGeometryShaderSupport = false;
}
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index df4f1c7..7dd213b 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -1931,43 +1931,11 @@
// Must be called before setDstProxyView so that it sees the final bounds of the op.
op->setClippedBounds(bounds);
- // Determine if the Op will trigger the use of a separate DMSAA attachment that requires manual
- // resolves.
- // TODO: Currently usesAttachmentIfDMSAA checks if this is a textureProxy or not. This check is
- // really only for GL which uses a normal texture sampling when using barriers. For Vulkan it
- // is possible to use the msaa buffer as an input attachment even if this is not a texture.
- // However, support for that is not fully implemented yet in Vulkan. Once it is, this check
- // should change to a virtual caps check that returns whether we need to break up an OpsTask
- // if it has barriers and we are about to promote to MSAA.
- bool usesAttachmentIfDMSAA =
- fCanUseDynamicMSAA &&
- (!this->caps()->msaaResolvesAutomatically() || !this->asTextureProxy());
- bool opRequiresDMSAAAttachment = usesAttachmentIfDMSAA && usesMSAA;
- bool opTriggersDMSAAAttachment =
- opRequiresDMSAAAttachment && !this->getOpsTask()->usesMSAASurface();
- if (opTriggersDMSAAAttachment) {
- // This will be the op that actually triggers use of a DMSAA attachment. Texture barriers
- // can't be moved to a DMSAA attachment, so if there already are any on the current opsTask
- // then we need to split.
- if (this->getOpsTask()->renderPassXferBarriers() & GrXferBarrierFlags::kTexture) {
- SkASSERT(!this->getOpsTask()->isColorNoOp());
- this->replaceOpsTask()->setCannotMergeBackward();
- }
- }
-
GrDstProxyView dstProxyView;
if (analysis.requiresDstTexture()) {
- if (!this->setupDstProxyView(drawOp->bounds(), usesMSAA, &dstProxyView)) {
+ if (!this->setupDstProxyView(*op, &dstProxyView)) {
return;
}
-#ifdef SK_DEBUG
- if (fCanUseDynamicMSAA && usesMSAA && !this->caps()->msaaResolvesAutomatically()) {
- // Since we aren't literally writing to the render target texture while using a DMSAA
- // attachment, we need to resolve that texture before sampling it. Ensure the current
- // opsTask got closed off in order to initiate an implicit resolve.
- SkASSERT(this->getOpsTask()->isEmpty());
- }
-#endif
}
auto opsTask = this->getOpsTask();
@@ -1995,9 +1963,7 @@
#endif
}
-bool GrSurfaceDrawContext::setupDstProxyView(const SkRect& opBounds,
- bool opRequiresMSAA,
- GrDstProxyView* dstProxyView) {
+bool GrSurfaceDrawContext::setupDstProxyView(const GrOp& op, GrDstProxyView* dstProxyView) {
// If we are wrapping a vulkan secondary command buffer, we can't make a dst copy because we
// don't actually have a VkImage to make a copy of. Additionally we don't have the power to
// start and stop the render pass in order to make the copy.
@@ -2005,56 +1971,16 @@
return false;
}
- // First get the dstSampleFlags as if we will put the draw into the current GrOpsTask
- auto dstSampleFlags = this->caps()->getDstSampleFlagsForProxy(
- this->asRenderTargetProxy(), this->getOpsTask()->usesMSAASurface() || opRequiresMSAA);
-
- // If we don't have barriers for this draw then we will definitely be breaking up the GrOpsTask.
- // However, if using dynamic MSAA, the new GrOpsTask will not have MSAA already enabled on it
- // and that may allow us to use texture barriers. So we check if we can use barriers on the new
- // ops task and then break it up if so.
- if (!(dstSampleFlags & GrDstSampleFlags::kRequiresTextureBarrier) &&
- fCanUseDynamicMSAA && this->getOpsTask()->usesMSAASurface() && !opRequiresMSAA) {
- auto newFlags =
- this->caps()->getDstSampleFlagsForProxy(this->asRenderTargetProxy(),
- false/*=opRequiresMSAA*/);
- if (newFlags & GrDstSampleFlags::kRequiresTextureBarrier) {
- // We can't have an empty ops task if we are in DMSAA and the ops task already returns
- // true for usesMSAASurface.
- SkASSERT(!this->getOpsTask()->isColorNoOp());
- this->replaceOpsTask()->setCannotMergeBackward();
- dstSampleFlags = newFlags;
- }
- }
+ auto dstSampleFlags = this->caps()->getDstSampleFlagsForProxy(this->asRenderTargetProxy());
if (dstSampleFlags & GrDstSampleFlags::kRequiresTextureBarrier) {
- // If we require a barrier to sample the dst it means we are sampling the RT itself
- // either as a texture or input attachment. In this case we don't need to break up the
- // GrOpsTask.
+ // If we require a barrier to sample the dst it means we are sampling the RT itself either
+ // as a texture or input attachment.
dstProxyView->setProxyView(this->readSurfaceView());
dstProxyView->setOffset(0, 0);
dstProxyView->setDstSampleFlags(dstSampleFlags);
return true;
}
- SkASSERT(dstSampleFlags == GrDstSampleFlags::kNone);
-
- // We are using a different surface from the main color attachment to sample the dst from. If we
- // are in DMSAA we can just use the single sampled RT texture itself. Otherwise, we must do a
- // copy.
- // We do have to check if we ended up here becasue we don't have texture barriers but do have
- // msaaResolvesAutomatically (i.e. render-to-msaa-texture). In that case there will be no op or
- // barrier between draws to flush the render target before being used as a texture in the next
- // draw. So in that case we just fall through to doing a copy.
- if (fCanUseDynamicMSAA && opRequiresMSAA && this->asTextureProxy() &&
- !this->caps()->msaaResolvesAutomatically()) {
- this->replaceOpsTaskIfModifiesColor()->setCannotMergeBackward();
- dstProxyView->setProxyView(this->readSurfaceView());
- dstProxyView->setOffset(0, 0);
- dstProxyView->setDstSampleFlags(dstSampleFlags);
- return true;
- }
-
- // Now we fallback to doing a copy.
GrColorType colorType = this->colorInfo().colorType();
// MSAA consideration: When there is support for reading MSAA samples in the shader we could
@@ -2067,7 +1993,7 @@
// If we don't need the whole source, restrict to the op's bounds. We add an extra pixel
// of padding to account for AA bloat and the unpredictable rounding of coords near pixel
// centers during rasterization.
- SkIRect conservativeDrawBounds = opBounds.roundOut();
+ SkIRect conservativeDrawBounds = op.bounds().roundOut();
conservativeDrawBounds.outset(1, 1);
SkAssertResult(copyRect.intersect(conservativeDrawBounds));
}
@@ -2096,11 +2022,3 @@
dstProxyView->setDstSampleFlags(dstSampleFlags);
return true;
}
-
-GrOpsTask* GrSurfaceDrawContext::replaceOpsTaskIfModifiesColor() {
- if (!this->getOpsTask()->isColorNoOp()) {
- this->replaceOpsTask();
- }
- return this->getOpsTask();
-}
-
diff --git a/src/gpu/GrSurfaceDrawContext.h b/src/gpu/GrSurfaceDrawContext.h
index 49e8e80..56f6f8d 100644
--- a/src/gpu/GrSurfaceDrawContext.h
+++ b/src/gpu/GrSurfaceDrawContext.h
@@ -712,11 +712,7 @@
// value is false then a texture copy could not be made.
//
// The op should have already had setClippedBounds called on it.
- bool SK_WARN_UNUSED_RESULT setupDstProxyView(const SkRect& opBounds,
- bool opRequiresMSAA,
- GrDstProxyView* result);
-
- GrOpsTask* replaceOpsTaskIfModifiesColor();
+ bool SK_WARN_UNUSED_RESULT setupDstProxyView(const GrOp& op, GrDstProxyView* result);
SkGlyphRunListPainter* glyphPainter() { return &fGlyphPainter; }
diff --git a/src/gpu/GrSurfaceFillContext.cpp b/src/gpu/GrSurfaceFillContext.cpp
index 4d50f30..4e3ee03 100644
--- a/src/gpu/GrSurfaceFillContext.cpp
+++ b/src/gpu/GrSurfaceFillContext.cpp
@@ -306,20 +306,15 @@
SkDEBUGCODE(this->validate();)
if (!fOpsTask || fOpsTask->isClosed()) {
- this->replaceOpsTask();
+ sk_sp<GrOpsTask> newOpsTask = this->drawingManager()->newOpsTask(
+ this->writeSurfaceView(), this->arenas(), fFlushTimeOpsTask);
+ this->willReplaceOpsTask(fOpsTask.get(), newOpsTask.get());
+ fOpsTask = std::move(newOpsTask);
}
SkASSERT(!fOpsTask->isClosed());
return fOpsTask.get();
}
-GrOpsTask* GrSurfaceFillContext::replaceOpsTask() {
- sk_sp<GrOpsTask> newOpsTask = this->drawingManager()->newOpsTask(
- this->writeSurfaceView(), this->arenas(), fFlushTimeOpsTask);
- this->willReplaceOpsTask(fOpsTask.get(), newOpsTask.get());
- fOpsTask = std::move(newOpsTask);
- return fOpsTask.get();
-}
-
#ifdef SK_DEBUG
void GrSurfaceFillContext::onValidate() const {
if (fOpsTask && !fOpsTask->isClosed()) {
diff --git a/src/gpu/GrSurfaceFillContext.h b/src/gpu/GrSurfaceFillContext.h
index 0741e5b..b85c76a 100644
--- a/src/gpu/GrSurfaceFillContext.h
+++ b/src/gpu/GrSurfaceFillContext.h
@@ -200,8 +200,6 @@
void addOp(GrOp::Owner);
- GrOpsTask* replaceOpsTask();
-
private:
sk_sp<GrArenas> arenas() { return fWriteView.proxy()->asRenderTargetProxy()->arenas(); }
diff --git a/tests/DMSAATest.cpp b/tests/DMSAATest.cpp
index 6bffd75..dd55056 100644
--- a/tests/DMSAATest.cpp
+++ b/tests/DMSAATest.cpp
@@ -19,15 +19,6 @@
constexpr static SkPMColor4f kTransCyan = {.0f,.5f,.5f,.5f};
constexpr static int w=10, h=10;
-static void draw_paint_with_aa(GrSurfaceDrawContext* sdc, const SkPMColor4f& color,
- SkBlendMode blendMode) {
- GrPaint paint;
- paint.setColor4f(color);
- paint.setXPFactory(SkBlendMode_AsXPFactory(blendMode));
- sdc->drawRect(nullptr, std::move(paint), GrAA::kYes, SkMatrix::I(), SkRect::MakeIWH(w, h),
- nullptr);
-}
-
static void draw_paint_with_dmsaa(GrSurfaceDrawContext* sdc, const SkPMColor4f& color,
SkBlendMode blendMode) {
// drawVertices should always trigger dmsaa, but draw something non-rectangular just to be 100%
@@ -98,81 +89,3 @@
check_sdc_color(reporter, sdc.get(), ctx, dstColor);
}
-
-static void require_dst_reads(GrContextOptions* options) {
- options->fSuppressAdvancedBlendEquations = true;
- options->fSuppressFramebufferFetch = true;
-}
-
-DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read, &sk_gpu_test::GrContextFactory::IsRenderingContext,
- reporter, ctxInfo, require_dst_reads) {
- auto ctx = ctxInfo.directContext();
- auto sdc = GrSurfaceDrawContext::Make(ctx, GrColorType::kRGBA_8888, nullptr,
- SkBackingFit::kApprox, {w, h}, kDMSAAProps);
-
- // Initialize the texture and dmsaa attachment with transparent.
- draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc);
- check_sdc_color(reporter, sdc.get(), ctx, SK_PMColor4fTRANSPARENT);
-
- sdc->clear(SK_PMColor4fWHITE);
- SkPMColor4f dstColor = SK_PMColor4fWHITE;
-
- draw_paint_with_dmsaa(sdc.get(), kTransYellow, SkBlendMode::kDarken);
- dstColor = SkBlendMode_Apply(SkBlendMode::kDarken, kTransYellow, dstColor);
-
- draw_paint_with_dmsaa(sdc.get(), kTransCyan, SkBlendMode::kDarken);
- dstColor = SkBlendMode_Apply(SkBlendMode::kDarken, kTransCyan, dstColor);
-
- check_sdc_color(reporter, sdc.get(), ctx, dstColor);
-}
-
-DEF_GPUTEST_FOR_CONTEXTS(DMSAA_aa_dst_read_after_dmsaa,
- &sk_gpu_test::GrContextFactory::IsRenderingContext, reporter, ctxInfo,
- require_dst_reads) {
- auto ctx = ctxInfo.directContext();
- auto sdc = GrSurfaceDrawContext::Make(ctx, GrColorType::kRGBA_8888, nullptr,
- SkBackingFit::kApprox, {w, h}, kDMSAAProps);
-
- // Initialize the texture and dmsaa attachment with transparent.
- draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc);
- check_sdc_color(reporter, sdc.get(), ctx, SK_PMColor4fTRANSPARENT);
-
- sdc->clear(SK_PMColor4fWHITE);
- SkPMColor4f dstColor = SK_PMColor4fWHITE;
-
- draw_paint_with_dmsaa(sdc.get(), kTransYellow, SkBlendMode::kDarken);
- dstColor = SkBlendMode_Apply(SkBlendMode::kDarken, kTransYellow, dstColor);
-
- // Draw with aa after dmsaa. This should break up the render pass and issue a texture barrier.
- draw_paint_with_aa(sdc.get(), kTransCyan, SkBlendMode::kDarken);
- dstColor = SkBlendMode_Apply(SkBlendMode::kDarken, kTransCyan, dstColor);
-
- check_sdc_color(reporter, sdc.get(), ctx, dstColor);
-}
-
-DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read_with_existing_barrier,
- &sk_gpu_test::GrContextFactory::IsRenderingContext, reporter, ctxInfo,
- require_dst_reads) {
- auto ctx = ctxInfo.directContext();
- auto sdc = GrSurfaceDrawContext::Make(ctx, GrColorType::kRGBA_8888, nullptr,
- SkBackingFit::kApprox, {w, h}, kDMSAAProps);
-
- // Initialize the texture and dmsaa attachment with transparent.
- draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc);
- check_sdc_color(reporter, sdc.get(), ctx, SK_PMColor4fTRANSPARENT);
-
- sdc->clear(SK_PMColor4fWHITE);
- SkPMColor4f dstColor = SK_PMColor4fWHITE;
-
- // Blend to the texture (not the dmsaa attachment) with a dst read. This creates a texture
- // barrier.
- draw_paint_with_aa(sdc.get(), kTransYellow, SkBlendMode::kDarken);
- dstColor = SkBlendMode_Apply(SkBlendMode::kDarken, kTransYellow, dstColor);
-
- // Blend to the msaa attachment _without_ a dst read. This ensures we respect the prior texture
- // barrier by splitting the opsTask.
- draw_paint_with_dmsaa(sdc.get(), kTransCyan, SkBlendMode::kSrcOver);
- dstColor = SkBlendMode_Apply(SkBlendMode::kSrcOver, kTransCyan, dstColor);
-
- check_sdc_color(reporter, sdc.get(), ctx, dstColor);
-}