Skip to content

Commit 858cf23

Browse files
csmartdalton86Skia Commit-Bot
authored andcommitted
Call setNeedsStencil() when clearing stencil
Bug: chromium:1008312 Change-Id: I6e1d160515c6689ac6d62c40e712df287d47f955 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248723 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
1 parent 7d7aaf4 commit 858cf23

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/gpu/GrRenderTargetContext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -748,15 +748,13 @@ GrOpsTask::CanDiscardPreviousOps GrRenderTargetContext::canDiscardPreviousOpsOnF
748748
return GrOpsTask::CanDiscardPreviousOps(!fNumStencilSamples);
749749
}
750750

751-
void GrRenderTargetContext::setNeedsStencil(bool multisampled) {
751+
void GrRenderTargetContext::setNeedsStencil(bool useMixedSamplesIfNotMSAA) {
752752
// Don't clear stencil until after we've changed fNumStencilSamples. This ensures we don't loop
753753
// forever in the event that there are driver bugs and we need to clear as a draw.
754754
bool hasInitializedStencil = fNumStencilSamples > 0;
755755

756756
int numRequiredSamples = this->numSamples();
757-
if (multisampled && 1 == numRequiredSamples) {
758-
// The caller has requested a multisampled stencil buffer on a non-MSAA render target. Use
759-
// mixed samples.
757+
if (useMixedSamplesIfNotMSAA && 1 == numRequiredSamples) {
760758
SkASSERT(fRenderTargetProxy->canUseMixedSamples(*this->caps()));
761759
numRequiredSamples = this->caps()->internalMultisampleCount(
762760
this->asSurfaceProxy()->backendFormat());
@@ -793,6 +791,8 @@ void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool i
793791
}
794792

795793
void GrRenderTargetContext::internalStencilClear(const GrFixedClip& clip, bool insideStencilMask) {
794+
this->setNeedsStencil(/* useMixedSamplesIfNotMSAA = */ false);
795+
796796
if (this->caps()->performStencilClearsAsDraws()) {
797797
const GrUserStencilSettings* ss = GrStencilSettings::SetClipBitSettings(insideStencilMask);
798798
SkRect rtRect = SkRect::MakeWH(this->width(), this->height());

src/gpu/GrRenderTargetContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ class GrRenderTargetContext : public GrSurfaceContext {
548548
sk_sp<GrTextureProxy>);
549549

550550
GrOpsTask::CanDiscardPreviousOps canDiscardPreviousOpsOnFullClear() const;
551-
void setNeedsStencil(bool multisampled);
551+
void setNeedsStencil(bool useMixedSamplesIfNotMSAA);
552552

553553
void internalClear(const GrFixedClip&, const SkPMColor4f&, CanClearFullscreen);
554554
void internalStencilClear(const GrFixedClip&, bool insideStencilMask);

0 commit comments

Comments
 (0)