diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-11-07 18:24:06 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-07 18:24:15 +0000 |
commit | 428e568fd8b0555688f8520c0b57291fbbbb3b69 (patch) | |
tree | 639ffe4f6597b00b6cbee0d93eaec672f49cce6e /src/gpu/GrAppliedClip.h | |
parent | 777dc2ef81282883e05d71efb4f4a1b93eec29b0 (diff) |
Revert "Don't use analytic clip FPs when drawing to stencil"
This reverts commit 4c92d4aa3ed653afdff9996b90a1139ed1dc9420.
Reason for revert: Chromecast bot failure
Original change's description:
> Don't use analytic clip FPs when drawing to stencil
>
> It doesn't make sense to multiply by coverage when drawing to stencil.
> This could theoretically work with FPs that discard and/or modify
> the sample mask, but for the time being an analytic FP means one that
> calculates a coverage value.
>
> Bug: skia:7190
> Change-Id: Ic40cf6c19c377cba80bad458993582f5cc07022a
> Reviewed-on: https://skia-review.googlesource.com/67423
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,csmartdalton@google.com
Change-Id: Ie5bd4852c201e47daee0920f5644141bee2d8a46
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7190
Reviewed-on: https://skia-review.googlesource.com/68400
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/GrAppliedClip.h')
-rw-r--r-- | src/gpu/GrAppliedClip.h | 90 |
1 files changed, 30 insertions, 60 deletions
diff --git a/src/gpu/GrAppliedClip.h b/src/gpu/GrAppliedClip.h index bfe3383e16..d96370ecc0 100644 --- a/src/gpu/GrAppliedClip.h +++ b/src/gpu/GrAppliedClip.h @@ -14,21 +14,28 @@ #include "SkClipStack.h" - /** - * Produced by GrHardClip. It provides a set of modifications to the hardware drawing state that - * implement the clip. + * Produced by GrClip. It provides a set of modifications to the drawing state that are used to + * create the final GrPipeline for a GrOp. */ -class GrAppliedHardClip { +class GrAppliedClip { public: - GrAppliedHardClip() = default; - GrAppliedHardClip(GrAppliedHardClip&& that) = default; - GrAppliedHardClip(const GrAppliedHardClip&) = delete; + GrAppliedClip() = default; + GrAppliedClip(GrAppliedClip&& that) = default; + GrAppliedClip(const GrAppliedClip&) = delete; const GrScissorState& scissorState() const { return fScissorState; } const GrWindowRectsState& windowRectsState() const { return fWindowRectsState; } - uint32_t stencilStackID() const { return fStencilStackID; } - bool hasStencilClip() const { return SkClipStack::kInvalidGenID != fStencilStackID; } + int numClipCoverageFragmentProcessors() const { return fClipCoverageFPs.count(); } + const GrFragmentProcessor* clipCoverageFragmentProcessor(int i) const { + SkASSERT(fClipCoverageFPs[i]); + return fClipCoverageFPs[i].get(); + } + std::unique_ptr<const GrFragmentProcessor> detachClipCoverageFragmentProcessor(int i) { + SkASSERT(fClipCoverageFPs[i]); + return std::move(fClipCoverageFPs[i]); + } + bool hasStencilClip() const { return SkClipStack::kInvalidGenID != fClipStackID; } /** * Intersects the applied clip with the provided rect. Returns false if the draw became empty. @@ -49,65 +56,26 @@ public: fWindowRectsState.set(windows, mode); } - void addStencilClip(uint32_t stencilStackID) { - SkASSERT(SkClipStack::kInvalidGenID == fStencilStackID); - fStencilStackID = stencilStackID; - } - - bool doesClip() const { - return fScissorState.enabled() || this->hasStencilClip() || fWindowRectsState.enabled(); - } - - bool operator==(const GrAppliedHardClip& that) const { - return fScissorState == that.fScissorState && - fWindowRectsState == that.fWindowRectsState && - fStencilStackID == that.fStencilStackID; - } - bool operator!=(const GrAppliedHardClip& that) const { return !(*this == that); } - -private: - GrScissorState fScissorState; - GrWindowRectsState fWindowRectsState; - uint32_t fStencilStackID = SkClipStack::kInvalidGenID; -}; - -/** - * Produced by GrClip. It provides a set of modifications to GrPipeline that implement the clip. - */ -class GrAppliedClip { -public: - GrAppliedClip() = default; - GrAppliedClip(GrAppliedClip&& that) = default; - GrAppliedClip(const GrAppliedClip&) = delete; - - const GrScissorState& scissorState() const { return fHardClip.scissorState(); } - const GrWindowRectsState& windowRectsState() const { return fHardClip.windowRectsState(); } - uint32_t stencilStackID() const { return fHardClip.stencilStackID(); } - bool hasStencilClip() const { return fHardClip.hasStencilClip(); } - int numClipCoverageFragmentProcessors() const { return fClipCoverageFPs.count(); } - const GrFragmentProcessor* clipCoverageFragmentProcessor(int i) const { - SkASSERT(fClipCoverageFPs[i]); - return fClipCoverageFPs[i].get(); - } - std::unique_ptr<const GrFragmentProcessor> detachClipCoverageFragmentProcessor(int i) { - SkASSERT(fClipCoverageFPs[i]); - return std::move(fClipCoverageFPs[i]); - } - - GrAppliedHardClip& hardClip() { return fHardClip; } - void addCoverageFP(std::unique_ptr<GrFragmentProcessor> fp) { SkASSERT(fp); fClipCoverageFPs.push_back(std::move(fp)); } + void addStencilClip(uint32_t clipStackID) { + SkASSERT(SkClipStack::kInvalidGenID == fClipStackID); + fClipStackID = clipStackID; + } + bool doesClip() const { - return fHardClip.doesClip() || !fClipCoverageFPs.empty(); + return fScissorState.enabled() || !fClipCoverageFPs.empty() || this->hasStencilClip() || + fWindowRectsState.enabled(); } bool operator==(const GrAppliedClip& that) const { - if (fHardClip != that.fHardClip || - fClipCoverageFPs.count() != that.fClipCoverageFPs.count()) { + if (fScissorState != that.fScissorState || + fWindowRectsState != that.fWindowRectsState || + fClipCoverageFPs.count() != that.fClipCoverageFPs.count() || + fClipStackID != that.fClipStackID) { return false; } for (int i = 0; i < fClipCoverageFPs.count(); ++i) { @@ -134,8 +102,10 @@ public: } private: - GrAppliedHardClip fHardClip; + GrScissorState fScissorState; + GrWindowRectsState fWindowRectsState; SkSTArray<4, std::unique_ptr<GrFragmentProcessor>> fClipCoverageFPs; + uint32_t fClipStackID = SkClipStack::kInvalidGenID; }; #endif |