diff options
author | 2016-05-11 05:21:56 -0700 | |
---|---|---|
committer | 2016-05-11 05:21:56 -0700 | |
commit | e19aecdd13d83b2235faf3e2601100a2fd980b7b (patch) | |
tree | 75f24881e08d8c287b53bc3d055c68b3406ae8bf /src/gpu/GrStencilSettings.h | |
parent | 3e11da7fa9b7ab26df6d6197c3f6a71d0826c97e (diff) |
Revert of Separate user and raw stencil settings (patchset #8 id:140001 of https://codereview.chromium.org/1962243002/ )
Reason for revert:
This seems to be breaking nanobench on the Windows bots with:
Caught exception 3221225477 EXCEPTION_ACCESS_VIOLATION
GrDrawTarget::stencilPath +c7
GrStencilAndCoverPathRenderer::onDrawPath +fd
GrDrawContext::internalDrawPath +509
GrDrawContext::drawPath +223
GrBlurUtils::drawPathWithMaskFilter +250
SkGpuDevice::drawPath +2ea
SkCanvas::onDrawPath +2e3
SkRecordDraw +2e6
SkBigPicture::playback +e5
SkCanvas::onDrawPicture +12c
SkCanvas::drawPicture +145
SkRecordDraw +2e6
SkBigPicture::playback +e5
SkCanvas::onDrawPicture +12c
SkCanvas::drawPicture +145
SkRecordDraw +261
SkBigPicture::playback +e5
SkCanvas::onDrawPicture +12c
SkCanvas::drawPicture +145
SkMultiPictureDraw::draw +bf
SKPBench::drawMPDPicture +1e0
SKPBench::onDraw +34
Benchmark::draw +32
time +92
setup_gpu_bench +6e
nanobench_main +77b
Original issue's description:
> Separate user and raw stencil settings
>
> Adds a new GrUserStencilSettings class that describes in abstract terms
> how a draw will use the stencil (e.g. kAlwaysIfInClip, kSetClipBit,
> etc.). GrPipelineBuilder now only defines the GrUserStencilSettings.
> When the GrPipeline is finalized, the user stencil settings are then
> translated into concrete GrStencilSettings.
>
> At this point, GrClipMaskManager only needs to tell the GrAppliedClip
> whether or not there is a stencil clip. It does not need to modify
> stencil settings and GrPipelineBuilder does not need
> AutoRestoreStencil.
>
> This is one step of the stencil overhaul. In the future it will also
> allow us to clean up the special case handling for nvpr and the
> stateful fClipMode member of GrClipMaskManager.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1962243002
>
> Committed: https://skia.googlesource.com/skia/+/12dbb3947e1aaf205b4fcf13b40e54e50650eb37
TBR=bsalomon@google.com,cdalton@nvidia.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/1969693003
Diffstat (limited to 'src/gpu/GrStencilSettings.h')
-rw-r--r-- | src/gpu/GrStencilSettings.h | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/src/gpu/GrStencilSettings.h b/src/gpu/GrStencilSettings.h deleted file mode 100644 index 15a8cac12f..0000000000 --- a/src/gpu/GrStencilSettings.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef GrStencilSettings_DEFINED -#define GrStencilSettings_DEFINED - -#include "GrUserStencilSettings.h" -#include "SkRegion.h" - -class GrProcessorKeyBuilder; - -enum class GrStencilTest : uint16_t { - kAlways, - kNever, - kGreater, - kGEqual, - kLess, - kLEqual, - kEqual, - kNotEqual -}; -static constexpr int kGrStencilTestCount = 1 + (int)GrStencilTest::kNotEqual; - -enum class GrStencilOp : uint8_t { - kKeep, - kZero, - kReplace, // Replace stencil value with fRef (only the bits enabled in fWriteMask). - kInvert, - kIncWrap, - kDecWrap, - // NOTE: clamping occurs before the write mask. So if the MSB is zero and masked out, stencil - // values will still wrap when using clamping ops. - kIncClamp, - kDecClamp -}; -static constexpr int kGrStencilOpCount = 1 + (int)GrStencilOp::kDecClamp; - -/** - * This class defines concrete stencil settings that map directly to the underlying hardware. It - * is deduced from user stencil settings, stencil clip status, and the number of bits in the - * target stencil buffer. - */ -class GrStencilSettings { -public: - GrStencilSettings() { this->setDisabled(); } - GrStencilSettings(const GrUserStencilSettings& user, bool hasStencilClip, int numStencilBits) { - this->reset(user, hasStencilClip, numStencilBits); - } - GrStencilSettings(const GrStencilSettings& that) { this->reset(that); } - GrStencilSettings& operator=(const GrStencilSettings& that) { this->reset(that); return *this; } - - void invalidate() { fFlags |= kInvalid_PrivateFlag; } - void setDisabled() { fFlags = kAll_StencilFlags; } - void reset(const GrUserStencilSettings&, bool hasStencilClip, int numStencilBits); - void reset(const GrStencilSettings&); - - bool isValid() const { return !(fFlags & kInvalid_PrivateFlag); } - bool isDisabled() const { SkASSERT(this->isValid()); return fFlags & kDisabled_StencilFlag; } - bool doesWrite() const { SkASSERT(this->isValid()); - return !(fFlags & kNoModifyStencil_StencilFlag); } - bool isTwoSided() const { SkASSERT(this->isValid()); - return !(fFlags & kSingleSided_StencilFlag); } - bool usesWrapOp() const { SkASSERT(this->isValid()); - return !(fFlags & kNoWrapOps_StencilFlag); } - - void genKey(GrProcessorKeyBuilder* b) const; - - bool operator!=(const GrStencilSettings& that) const { return !(*this == that); } - bool operator==(const GrStencilSettings&) const; - - struct Face : public GrTStencilFaceSettings<GrStencilTest, GrStencilOp> { - void reset(const GrUserStencilSettings::Face&, bool useStencilClip, int numStencilBits); - void setDisabled(); - }; - - const Face& front() const { SkASSERT(!this->isDisabled()); return fFront; } - const Face& back() const { SkASSERT(this->isTwoSided()); return fBack; } - - /** - * Given a thing to draw into the stencil clip, a fill type, and a set op - * this function determines: - * 1. Whether the thing can be draw directly to the stencil clip or - * needs to be drawn to the client portion of the stencil first. - * 2. How many passes are needed. - * 3. What those passes are. - * - * @param op the set op to combine this element with the existing clip - * @param canBeDirect can the caller draw this element directly (without using stencil)? - * @param invertedFill is this path inverted - * @param drawDirectToClip out: true if caller should draw the element directly, false if it - * should draw it into the user stencil bits first. - * - * @return a null-terminated array of settings for stencil passes. - * - * If drawDirectToClip is false, the caller must first draw the element into the user - * stencil bits, and then cover the clip area with multiple passes using the returned - * stencil settings. - * - * If drawDirectToClip is true, the returned array will only have one pass and the - * caller should use those stencil settings while drawing the element directly. - */ - static GrUserStencilSettings const* const* GetClipPasses(SkRegion::Op op, - bool canBeDirect, - bool invertedFill, - bool* drawDirectToClip); - -private: - // Internal flag for backends to optionally mark their tracked stencil state as invalid. - enum { kInvalid_PrivateFlag = (kLast_StencilFlag << 1) }; - - uint32_t fFlags; - Face fFront; - Face fBack; -}; - -#endif |