GrPipelineBuilder.h revision 570d2f81a65fc868d6300a7edf34c0d5d048c5d6
19381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com/*
28dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel * Copyright 2015 Google Inc.
39381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com *
49381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com * Use of this source code is governed by a BSD-style license that can be
59381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com * found in the LICENSE file.
69381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com */
79381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com
88dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel#ifndef GrPipelineBuilder_DEFINED
98dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel#define GrPipelineBuilder_DEFINED
109381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com
114d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt#include "GrBatch.h"
1224ab3b0ce50b3428f063849b6160e468f047487ccommit-bot@chromium.org#include "GrBlend.h"
1344701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt#include "GrClip.h"
14c06482494d2be6481a3666a66254b6c66890f994egdaniel#include "GrDrawTargetCaps.h"
15f96ba02513eadd9fa24d75396ec9f2d6682e464cbsalomon#include "GrGpuResourceRef.h"
16ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon#include "GrFragmentStage.h"
17b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel#include "GrProcOptInfo.h"
1889af44a0f1323dc136b238c00ccf143e15abb243egdaniel#include "GrRenderTarget.h"
1989af44a0f1323dc136b238c00ccf143e15abb243egdaniel#include "GrStencil.h"
209513143efa734bef0c1a0c7f945022572dbc8518egdaniel#include "GrXferProcessor.h"
2189af44a0f1323dc136b238c00ccf143e15abb243egdaniel#include "SkMatrix.h"
228750924a1470e8215b2a344155259b93062d3fa2egdaniel#include "effects/GrCoverageSetOpXP.h"
23080e673b10ac607305f140ddb245e140ccde40c6egdaniel#include "effects/GrDisableColorXP.h"
249513143efa734bef0c1a0c7f945022572dbc8518egdaniel#include "effects/GrPorterDuffXferProcessor.h"
2568b58c95384dd6c2fd389a5b4bbf8fc468819454bsalomon@google.com#include "effects/GrSimpleTextureEffect.h"
269381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com
2789af44a0f1323dc136b238c00ccf143e15abb243egdanielclass GrDrawTargetCaps;
2889af44a0f1323dc136b238c00ccf143e15abb243egdanielclass GrPaint;
2989af44a0f1323dc136b238c00ccf143e15abb243egdanielclass GrTexture;
30170f90b4576f291879371ecd6ae4bc2b1d85c64aegdaniel
318dd688b7569df569a672a8a67b2db86a9d376cfcegdanielclass GrPipelineBuilder {
322e3d144dfdbc4596d33baef7396316f88f412cc8bsalomon@google.compublic:
338dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel    GrPipelineBuilder();
348dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel
358dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel    GrPipelineBuilder(const GrPipelineBuilder& pipelineBuilder) {
361acc3d7cc28c5631b5300578ab13439bdefd4e33commit-bot@chromium.org        SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
378dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        *this = pipelineBuilder;
3846f7afb9867200b568c21736da8a8bbb56b20e30bsalomon@google.com    }
3946f7afb9867200b568c21736da8a8bbb56b20e30bsalomon@google.com
408dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel    virtual ~GrPipelineBuilder();
41137f1347abaf0bb6a945e91c2f6cb49f0ee69bc3bsalomon@google.com
4252a5dcb43b5acbde377f664807b0f75af8bb1666bsalomon@google.com    /**
438dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * Initializes the GrPipelineBuilder based on a GrPaint, view matrix and render target. Note
448dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipelineBuilder that have
458dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * no GrPaint equivalents are set to default values with the exception of vertex attribute state
468dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * which is unmodified by this function and clipping which will be enabled.
47af84e748cedbf43e2d0e8d2eac9b7800c8d8ca19bsalomon@google.com     */
48570d2f81a65fc868d6300a7edf34c0d5d048c5d6joshualitt    void setFromPaint(const GrPaint&, GrRenderTarget*, const GrClip&);
498f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
509b855c7c95ce9fff7a447e4a6bdf8a469c1f3097jvanverth@google.com    /// @}
519b855c7c95ce9fff7a447e4a6bdf8a469c1f3097jvanverth@google.com
529b855c7c95ce9fff7a447e4a6bdf8a469c1f3097jvanverth@google.com    /**
53cd8b6307fe636eeff822c0e48db2a0cb80a33830egdaniel     * This function returns true if the render target destination pixel values will be read for
54cd8b6307fe636eeff822c0e48db2a0cb80a33830egdaniel     * blending during draw.
55cd8b6307fe636eeff822c0e48db2a0cb80a33830egdaniel     */
5656995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt    bool willBlendWithDst(const GrPrimitiveProcessor*) const;
57bd769d0f1c8cf6ccbb2738dfad1624a4c828e4ebjoshualitt
582401ae8fd3c1f6282f571b5a7e0a499e9f4c09abbsalomon@google.com    ///////////////////////////////////////////////////////////////////////////
59adc6536fe5baff2216fb76ecda6cc81c61109d5cbsalomon@google.com    /// @name Effect Stages
60b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    /// Each stage hosts a GrProcessor. The effect produces an output color or coverage in the
61b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    /// fragment shader. Its inputs are the output from the previous stage as well as some variables
62eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// available to it in the fragment and vertex shader (e.g. the vertex position, the dst color,
63eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// the fragment position, local coordinates).
64eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    ///
65eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// The stages are divided into two sets, color-computing and coverage-computing. The final
66eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// color stage produces the final pixel color. The coverage-computing stages function exactly
67eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// as the color-computing but the output of the final coverage stage is treated as a fractional
68eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// pixel coverage rather than as input to the src/dst color blend step.
69eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    ///
70eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// The input color to the first color-stage is either the constant color or interpolated
71eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// per-vertex colors. The input to the first coverage stage is either a constant coverage
72eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// (usually full-coverage) or interpolated per-vertex coverage.
73eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    ///
74eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// See the documentation of kCoverageDrawing_StateBit for information about disabling the
75eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    /// the color / coverage distinction.
768f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ////
778f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
7889af44a0f1323dc136b238c00ccf143e15abb243egdaniel    int numColorStages() const { return fColorStages.count(); }
7989af44a0f1323dc136b238c00ccf143e15abb243egdaniel    int numCoverageStages() const { return fCoverageStages.count(); }
804dd99886420329fcacd72d87f2c46ff2555d0945joshualitt    int numFragmentStages() const { return this->numColorStages() + this->numCoverageStages(); }
81378092f3d10b1dd62967f419c35cfefec7c10ee7egdaniel
822fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt    const GrXPFactory* getXPFactory() const {
832fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt        if (!fXPFactory) {
842fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt            fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode));
852fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt        }
862fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt        return fXPFactory.get();
872fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt    }
88378092f3d10b1dd62967f419c35cfefec7c10ee7egdaniel
8989af44a0f1323dc136b238c00ccf143e15abb243egdaniel    const GrFragmentStage& getColorStage(int idx) const { return fColorStages[idx]; }
9089af44a0f1323dc136b238c00ccf143e15abb243egdaniel    const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageStages[idx]; }
9189af44a0f1323dc136b238c00ccf143e15abb243egdaniel
9289af44a0f1323dc136b238c00ccf143e15abb243egdaniel    /**
9350785a3d10b53bea5beb6e18431a2449860be237bsalomon     * Checks whether the xp will need a copy of the destination to correctly blend.
9489af44a0f1323dc136b238c00ccf143e15abb243egdaniel     */
95e36914cb205699526988127a827d1a76c9a98d39egdaniel    bool willXPNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptInfo& colorPOI,
96e36914cb205699526988127a827d1a76c9a98d39egdaniel                           const GrProcOptInfo& coveragePOI) const;
9789af44a0f1323dc136b238c00ccf143e15abb243egdaniel
989513143efa734bef0c1a0c7f945022572dbc8518egdaniel    /**
999513143efa734bef0c1a0c7f945022572dbc8518egdaniel     * The xfer processor factory.
1009513143efa734bef0c1a0c7f945022572dbc8518egdaniel     */
1019513143efa734bef0c1a0c7f945022572dbc8518egdaniel    const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) {
1029513143efa734bef0c1a0c7f945022572dbc8518egdaniel        fXPFactory.reset(SkRef(xpFactory));
1039513143efa734bef0c1a0c7f945022572dbc8518egdaniel        return xpFactory;
1049513143efa734bef0c1a0c7f945022572dbc8518egdaniel    }
1059513143efa734bef0c1a0c7f945022572dbc8518egdaniel
1068750924a1470e8215b2a344155259b93062d3fa2egdaniel    void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage = false) {
1078750924a1470e8215b2a344155259b93062d3fa2egdaniel        fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage));
1088750924a1470e8215b2a344155259b93062d3fa2egdaniel    }
1098750924a1470e8215b2a344155259b93062d3fa2egdaniel
110080e673b10ac607305f140ddb245e140ccde40c6egdaniel    void setDisableColorXPFactory() {
111080e673b10ac607305f140ddb245e140ccde40c6egdaniel        fXPFactory.reset(GrDisableColorXPFactory::Create());
112080e673b10ac607305f140ddb245e140ccde40c6egdaniel    }
113080e673b10ac607305f140ddb245e140ccde40c6egdaniel
114b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effect) {
11549f085dddff10473b6ebf832a974288300224e60bsalomon        SkASSERT(effect);
116b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt        SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (effect));
117b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel        fColorProcInfoValid = false;
11865eb4d5a210884cc92c43a8582cbd1ccbddcab57jvanverth@google.com        return effect;
11965eb4d5a210884cc92c43a8582cbd1ccbddcab57jvanverth@google.com    }
12001c34ee59906f729f6ca7d35f0c0e5e2f5e693feskia.committer@gmail.com
121b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* effect) {
12249f085dddff10473b6ebf832a974288300224e60bsalomon        SkASSERT(effect);
123b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt        SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (effect));
124b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel        fCoverageProcInfoValid = false;
125adc6536fe5baff2216fb76ecda6cc81c61109d5cbsalomon@google.com        return effect;
126adc6536fe5baff2216fb76ecda6cc81c61109d5cbsalomon@google.com    }
127adc6536fe5baff2216fb76ecda6cc81c61109d5cbsalomon@google.com
1288f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /**
129c78188896e28a4ae49e406a7422b345ae177dafebsalomon@google.com     * Creates a GrSimpleTextureEffect that uses local coords as texture coordinates.
1301e8f016305805d4d8cad74aba3a21b78486f9d6ftomhudson@google.com     */
131b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
132b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt        this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
1331ce49fc91714ce8974d11246d29ebe7b97b5fe98bsalomon@google.com    }
1341ce49fc91714ce8974d11246d29ebe7b97b5fe98bsalomon@google.com
135b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
136b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt        this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
1377d6afdd795eb4c7ce8f5a327117cfdba5f957ddbtomhudson@google.com    }
138676e66096c60615bac52f365111596de5c4ca8a6tomhudson@google.com
139b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    void addColorTextureProcessor(GrTexture* texture,
140eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com                                  const SkMatrix& matrix,
141eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com                                  const GrTextureParams& params) {
142b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt        this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix, params))->unref();
143b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    }
144b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt
145b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt    void addCoverageTextureProcessor(GrTexture* texture,
146b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt                                     const SkMatrix& matrix,
147b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt                                     const GrTextureParams& params) {
148b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt        this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix, params))->unref();
149ff6ea2663f76aa85ec55ddd0f00ca7906f1bc4e3commit-bot@chromium.org    }
150676e66096c60615bac52f365111596de5c4ca8a6tomhudson@google.com
151972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com    /**
1528dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * When this object is destroyed it will remove any color/coverage effects from the pipeline
1538dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * builder that were added after its constructor.
1549b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon     *
1558dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * This class has strange behavior around geometry processor. If there is a GP on the
1568dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * GrPipelineBuilder it will assert that the GP is not modified until after the destructor of
1578dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * the ARE. If the GrPipelineBuilder has a NULL GP when the ARE is constructed then it will reset
1588dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel     * it to null in the destructor.
159972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com     */
160a0b40280a49a8a43af7929ead3b3489951c58501commit-bot@chromium.org    class AutoRestoreEffects : public ::SkNoncopyable {
161972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com    public:
1629b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon        AutoRestoreEffects()
1638dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel            : fPipelineBuilder(NULL)
1649b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon            , fColorEffectCnt(0)
1659b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon            , fCoverageEffectCnt(0) {}
1669b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon
1678dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        AutoRestoreEffects(GrPipelineBuilder* ds)
1688dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel            : fPipelineBuilder(NULL)
1699b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon            , fColorEffectCnt(0)
1709b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon            , fCoverageEffectCnt(0) {
1715c493d5b3dc753fccba47c8250fb38713bac3cb8skia.committer@gmail.com            this->set(ds);
172f09b87dda39df1315f26afb663aeaf8048330725robertphillips@google.com        }
173eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com
174eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com        ~AutoRestoreEffects() { this->set(NULL); }
175eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com
1768dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        void set(GrPipelineBuilder* ds);
177eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com
1788dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        bool isSet() const { return SkToBool(fPipelineBuilder); }
1798af0523b38f25993c8b1ba3a3562b9f9ac87162dbsalomon
180972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com    private:
1818dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        GrPipelineBuilder*    fPipelineBuilder;
1829b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon        int             fColorEffectCnt;
1839b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon        int             fCoverageEffectCnt;
184972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com    };
185972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com
186a58fe35fdae3481cf43062f7032820c320c3d163joshualitt    /**
187a58fe35fdae3481cf43062f7032820c320c3d163joshualitt     * AutoRestoreStencil
188a58fe35fdae3481cf43062f7032820c320c3d163joshualitt     *
189a58fe35fdae3481cf43062f7032820c320c3d163joshualitt     * This simple struct saves and restores the stencil settings
190a58fe35fdae3481cf43062f7032820c320c3d163joshualitt     */
191a58fe35fdae3481cf43062f7032820c320c3d163joshualitt    class AutoRestoreStencil : public ::SkNoncopyable {
192a58fe35fdae3481cf43062f7032820c320c3d163joshualitt    public:
1938dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        AutoRestoreStencil() : fPipelineBuilder(NULL) {}
194a58fe35fdae3481cf43062f7032820c320c3d163joshualitt
1958dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        AutoRestoreStencil(GrPipelineBuilder* ds) : fPipelineBuilder(NULL) { this->set(ds); }
196a58fe35fdae3481cf43062f7032820c320c3d163joshualitt
197a58fe35fdae3481cf43062f7032820c320c3d163joshualitt        ~AutoRestoreStencil() { this->set(NULL); }
198a58fe35fdae3481cf43062f7032820c320c3d163joshualitt
1998dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        void set(GrPipelineBuilder* ds) {
2008dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel            if (fPipelineBuilder) {
2018dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel                fPipelineBuilder->setStencil(fStencilSettings);
202a58fe35fdae3481cf43062f7032820c320c3d163joshualitt            }
2038dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel            fPipelineBuilder = ds;
204a58fe35fdae3481cf43062f7032820c320c3d163joshualitt            if (ds) {
205a58fe35fdae3481cf43062f7032820c320c3d163joshualitt                fStencilSettings = ds->getStencil();
206a58fe35fdae3481cf43062f7032820c320c3d163joshualitt            }
207a58fe35fdae3481cf43062f7032820c320c3d163joshualitt        }
208a58fe35fdae3481cf43062f7032820c320c3d163joshualitt
2098dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        bool isSet() const { return SkToBool(fPipelineBuilder); }
210a58fe35fdae3481cf43062f7032820c320c3d163joshualitt
211a58fe35fdae3481cf43062f7032820c320c3d163joshualitt    private:
2128dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        GrPipelineBuilder*  fPipelineBuilder;
2138dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel        GrStencilSettings   fStencilSettings;
214a58fe35fdae3481cf43062f7032820c320c3d163joshualitt    };
215a58fe35fdae3481cf43062f7032820c320c3d163joshualitt
2168f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @}
2178f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2188f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ///////////////////////////////////////////////////////////////////////////
2198f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @name Blending
2208f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ////
2218f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
22289af44a0f1323dc136b238c00ccf143e15abb243egdaniel    /**
22389af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * Determines whether multiplying the computed per-pixel color by the pixel's fractional
22489af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * coverage before the blend will give the correct final destination color. In general it
22589af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * will not as coverage is applied after blending.
22689af44a0f1323dc136b238c00ccf143e15abb243egdaniel     */
22789af44a0f1323dc136b238c00ccf143e15abb243egdaniel    bool canTweakAlphaForCoverage() const;
22889af44a0f1323dc136b238c00ccf143e15abb243egdaniel
2298f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @}
2308f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
231d27f73ef27ff65a6a0a5d00aa8e5b784b1a0b47ejoshualitt
2328f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @}
2338f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2348f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ///////////////////////////////////////////////////////////////////////////
2358f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @name Render Target
2368f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ////
2378f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2388f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /**
23989af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * Retrieves the currently set render-target.
24089af44a0f1323dc136b238c00ccf143e15abb243egdaniel     *
24189af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * @return    The currently set render target.
24289af44a0f1323dc136b238c00ccf143e15abb243egdaniel     */
24337dd331b20a92ce79cc26556e065dec98a66cb0bbsalomon    GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); }
24489af44a0f1323dc136b238c00ccf143e15abb243egdaniel
24589af44a0f1323dc136b238c00ccf143e15abb243egdaniel    /**
246ca43208e4aaac817fbc8265542f995f24a3fb7bfbsalomon@google.com     * Sets the render-target used at the next drawing call
2478f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     *
2488f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * @param target  The render target to set.
2498f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     */
250ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon    void setRenderTarget(GrRenderTarget* target) { fRenderTarget.reset(SkSafeRef(target)); }
2518f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2528f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @}
2538f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2548f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ///////////////////////////////////////////////////////////////////////////
2558f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @name Stencil
2568f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ////
2578f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
25889af44a0f1323dc136b238c00ccf143e15abb243egdaniel    const GrStencilSettings& getStencil() const { return fStencilSettings; }
25989af44a0f1323dc136b238c00ccf143e15abb243egdaniel
2608f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /**
2618f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * Sets the stencil settings to use for the next draw.
2628f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * Changing the clip has the side-effect of possibly zeroing
2638f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * out the client settable stencil bits. So multipass algorithms
2648f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * using stencil should not change the clip between passes.
2658f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * @param settings  the stencil settings to use.
2668f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     */
26704ddf89627077ea8f2b447e7cd5e902956341a32bsalomon    void setStencil(const GrStencilSettings& settings) { fStencilSettings = settings; }
2688f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2698f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /**
2708f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * Shortcut to disable stencil testing and ops.
2718f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     */
27204ddf89627077ea8f2b447e7cd5e902956341a32bsalomon    void disableStencil() { fStencilSettings.setDisabled(); }
2738f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2742ed5ef84a5609089ad9d8a8f3a52bf77e76476dbbsalomon    GrStencilSettings* stencil() { return &fStencilSettings; }
2758f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2768f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @}
2778f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
2788f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ///////////////////////////////////////////////////////////////////////////
2798f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @name State Flags
2808f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ////
2818f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
28289af44a0f1323dc136b238c00ccf143e15abb243egdaniel    /**
28389af44a0f1323dc136b238c00ccf143e15abb243egdaniel     *  Flags that affect rendering. Controlled using enable/disableState(). All
28489af44a0f1323dc136b238c00ccf143e15abb243egdaniel     *  default to disabled.
28589af44a0f1323dc136b238c00ccf143e15abb243egdaniel     */
28689af44a0f1323dc136b238c00ccf143e15abb243egdaniel    enum StateBits {
28789af44a0f1323dc136b238c00ccf143e15abb243egdaniel        /**
28889af44a0f1323dc136b238c00ccf143e15abb243egdaniel         * Perform dithering. TODO: Re-evaluate whether we need this bit
28989af44a0f1323dc136b238c00ccf143e15abb243egdaniel         */
29089af44a0f1323dc136b238c00ccf143e15abb243egdaniel        kDither_StateBit        = 0x01,
29189af44a0f1323dc136b238c00ccf143e15abb243egdaniel        /**
29289af44a0f1323dc136b238c00ccf143e15abb243egdaniel         * Perform HW anti-aliasing. This means either HW FSAA, if supported by the render target,
29389af44a0f1323dc136b238c00ccf143e15abb243egdaniel         * or smooth-line rendering if a line primitive is drawn and line smoothing is supported by
29489af44a0f1323dc136b238c00ccf143e15abb243egdaniel         * the 3D API.
29589af44a0f1323dc136b238c00ccf143e15abb243egdaniel         */
29689af44a0f1323dc136b238c00ccf143e15abb243egdaniel        kHWAntialias_StateBit   = 0x02,
29789af44a0f1323dc136b238c00ccf143e15abb243egdaniel
29844701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt        kLast_StateBit = kHWAntialias_StateBit,
29989af44a0f1323dc136b238c00ccf143e15abb243egdaniel    };
30089af44a0f1323dc136b238c00ccf143e15abb243egdaniel
30104ddf89627077ea8f2b447e7cd5e902956341a32bsalomon    bool isDither() const { return 0 != (fFlagBits & kDither_StateBit); }
30204ddf89627077ea8f2b447e7cd5e902956341a32bsalomon    bool isHWAntialias() const { return 0 != (fFlagBits & kHWAntialias_StateBit); }
3030fec61d19ca9088d54f58bd0a67150171b83d66cbsalomon@google.com
3048f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /**
3058f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * Enable render state settings.
3068f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     *
3071e269b5a08610da13c3aee23809bb45b17e7b663bsalomon@google.com     * @param stateBits bitfield of StateBits specifying the states to enable
3088f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     */
30904ddf89627077ea8f2b447e7cd5e902956341a32bsalomon    void enableState(uint32_t stateBits) { fFlagBits |= stateBits; }
3100fec61d19ca9088d54f58bd0a67150171b83d66cbsalomon@google.com
3118f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /**
3128f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * Disable render state settings.
3138f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     *
3141e269b5a08610da13c3aee23809bb45b17e7b663bsalomon@google.com     * @param stateBits bitfield of StateBits specifying the states to disable
3158f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     */
31604ddf89627077ea8f2b447e7cd5e902956341a32bsalomon    void disableState(uint32_t stateBits) { fFlagBits &= ~(stateBits); }
3170fec61d19ca9088d54f58bd0a67150171b83d66cbsalomon@google.com
318d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com    /**
319d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com     * Enable or disable stateBits based on a boolean.
320d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com     *
3211e269b5a08610da13c3aee23809bb45b17e7b663bsalomon@google.com     * @param stateBits bitfield of StateBits to enable or disable
322d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com     * @param enable    if true enable stateBits, otherwise disable
323d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com     */
324d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com    void setState(uint32_t stateBits, bool enable) {
325d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com        if (enable) {
326d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com            this->enableState(stateBits);
327d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com        } else {
328d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com            this->disableState(stateBits);
329d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com        }
330d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com    }
331d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com
3328f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @}
3338f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
3348f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ///////////////////////////////////////////////////////////////////////////
3358f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @name Face Culling
3368f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ////
3378f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
33889af44a0f1323dc136b238c00ccf143e15abb243egdaniel    enum DrawFace {
33989af44a0f1323dc136b238c00ccf143e15abb243egdaniel        kInvalid_DrawFace = -1,
34089af44a0f1323dc136b238c00ccf143e15abb243egdaniel
34189af44a0f1323dc136b238c00ccf143e15abb243egdaniel        kBoth_DrawFace,
34289af44a0f1323dc136b238c00ccf143e15abb243egdaniel        kCCW_DrawFace,
34389af44a0f1323dc136b238c00ccf143e15abb243egdaniel        kCW_DrawFace,
34489af44a0f1323dc136b238c00ccf143e15abb243egdaniel    };
34589af44a0f1323dc136b238c00ccf143e15abb243egdaniel
34689af44a0f1323dc136b238c00ccf143e15abb243egdaniel    /**
34789af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * Gets whether the target is drawing clockwise, counterclockwise,
34889af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * or both faces.
34989af44a0f1323dc136b238c00ccf143e15abb243egdaniel     * @return the current draw face(s).
35089af44a0f1323dc136b238c00ccf143e15abb243egdaniel     */
35189af44a0f1323dc136b238c00ccf143e15abb243egdaniel    DrawFace getDrawFace() const { return fDrawFace; }
35289af44a0f1323dc136b238c00ccf143e15abb243egdaniel
3538f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /**
3548f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * Controls whether clockwise, counterclockwise, or both faces are drawn.
3558f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     * @param face  the face(s) to draw.
3568f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com     */
3578f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    void setDrawFace(DrawFace face) {
358f6de475e5cbd143f348ff7738919e397b7fe7f57tfarina@chromium.org        SkASSERT(kInvalid_DrawFace != face);
3592ed5ef84a5609089ad9d8a8f3a52bf77e76476dbbsalomon        fDrawFace = face;
3608f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    }
3618f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
3628f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    /// @}
3638f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
3648f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com    ///////////////////////////////////////////////////////////////////////////
36562b09687857c923b1044be0aef4dd900f8379b22tomhudson@google.com
3668dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel    GrPipelineBuilder& operator= (const GrPipelineBuilder& that);
36762b09687857c923b1044be0aef4dd900f8379b22tomhudson@google.com
3684d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    // TODO delete when we have Batch
36956995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt    const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const {
37056995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt        this->calcColorInvariantOutput(pp);
371912b3d24a0e214e46a211da40cc01fe30238386cegdaniel        return fColorProcInfo;
372912b3d24a0e214e46a211da40cc01fe30238386cegdaniel    }
373912b3d24a0e214e46a211da40cc01fe30238386cegdaniel
37456995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt    const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const {
37556995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt        this->calcCoverageInvariantOutput(pp);
376912b3d24a0e214e46a211da40cc01fe30238386cegdaniel        return fCoverageProcInfo;
377912b3d24a0e214e46a211da40cc01fe30238386cegdaniel    }
378912b3d24a0e214e46a211da40cc01fe30238386cegdaniel
3794d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const {
3804d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt        this->calcColorInvariantOutput(batch);
3814d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt        return fColorProcInfo;
3824d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    }
3834d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt
3844d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const {
3854d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt        this->calcCoverageInvariantOutput(batch);
3864d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt        return fCoverageProcInfo;
3874d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    }
38844701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt
38944701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt    void setClip(const GrClip& clip) { fClip = clip; }
39044701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt    const GrClip& clip() const { return fClip; }
39144701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt
392e36914cb205699526988127a827d1a76c9a98d39egdanielprivate:
393e36914cb205699526988127a827d1a76c9a98d39egdaniel    // Calculating invariant color / coverage information is expensive, so we partially cache the
394e36914cb205699526988127a827d1a76c9a98d39egdaniel    // results.
395e36914cb205699526988127a827d1a76c9a98d39egdaniel    //
396e36914cb205699526988127a827d1a76c9a98d39egdaniel    // canUseFracCoveragePrimProc() - Called in regular skia draw, caches results but only for a
397e36914cb205699526988127a827d1a76c9a98d39egdaniel    //                                specific color and coverage.  May be called multiple times
398e36914cb205699526988127a827d1a76c9a98d39egdaniel    // willBlendWithDst() - only called by Nvpr, does not cache results
399e36914cb205699526988127a827d1a76c9a98d39egdaniel    // GrOptDrawState constructor - never caches results
4004d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt
40189af44a0f1323dc136b238c00ccf143e15abb243egdaniel    /**
4024d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt     * Primproc variants of the calc functions
4034d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt     * TODO remove these when batch is everywhere
40456995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt     */
40556995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt    void calcColorInvariantOutput(const GrPrimitiveProcessor*) const;
4064d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const;
40756995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt
40856995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt    /**
4094d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt     * GrBatch provides the initial seed for these loops based off of its initial geometry data
41089af44a0f1323dc136b238c00ccf143e15abb243egdaniel     */
4114d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    void calcColorInvariantOutput(const GrBatch*) const;
4124d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt    void calcCoverageInvariantOutput(const GrBatch*) const;
41389af44a0f1323dc136b238c00ccf143e15abb243egdaniel
414b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel    /**
415b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel     * If fColorProcInfoValid is false, function calculates the invariant output for the color
416b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel     * stages and results are stored in fColorProcInfo.
417b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel     */
4182e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt    void calcColorInvariantOutput(GrColor) const;
419b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel
420b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel    /**
421b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel     * If fCoverageProcInfoValid is false, function calculates the invariant output for the coverage
422b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel     * stages and results are stored in fCoverageProcInfo.
423b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel     */
4242e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt    void calcCoverageInvariantOutput(GrColor) const;
425b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel
426eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    // Some of the auto restore objects assume that no effects are removed during their lifetime.
427eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com    // This is used to assert that this condition holds.
4281acc3d7cc28c5631b5300578ab13439bdefd4e33commit-bot@chromium.org    SkDEBUGCODE(int fBlockEffectRemovalCnt;)
4298f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com
430a5305a110ab5201d5dadd40cbe711582d5ac4996joshualitt    typedef SkSTArray<4, GrFragmentStage> FragmentStageArray;
43189af44a0f1323dc136b238c00ccf143e15abb243egdaniel
432ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon    SkAutoTUnref<GrRenderTarget>            fRenderTarget;
433ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon    uint32_t                                fFlagBits;
434ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon    GrStencilSettings                       fStencilSettings;
435ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon    DrawFace                                fDrawFace;
4362fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt    mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
437ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon    FragmentStageArray                      fColorStages;
438ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon    FragmentStageArray                      fCoverageStages;
43944701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt    GrClip                                  fClip;
44089af44a0f1323dc136b238c00ccf143e15abb243egdaniel
441b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel    mutable GrProcOptInfo fColorProcInfo;
442b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel    mutable GrProcOptInfo fCoverageProcInfo;
443b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel    mutable bool fColorProcInfoValid;
444b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel    mutable bool fCoverageProcInfoValid;
4452e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt    mutable GrColor fColorCache;
4462e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt    mutable GrColor fCoverageCache;
447b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel
4488dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel    friend class GrPipeline;
4499381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com};
4509381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com
4519381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com#endif
452