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 1124ab3b0ce50b3428f063849b6160e468f047487ccommit-bot@chromium.org#include "GrBlend.h" 1244701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt#include "GrClip.h" 13c06482494d2be6481a3666a66254b6c66890f994egdaniel#include "GrDrawTargetCaps.h" 14f96ba02513eadd9fa24d75396ec9f2d6682e464cbsalomon#include "GrGpuResourceRef.h" 15ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon#include "GrFragmentStage.h" 16b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel#include "GrProcOptInfo.h" 1789af44a0f1323dc136b238c00ccf143e15abb243egdaniel#include "GrRenderTarget.h" 1889af44a0f1323dc136b238c00ccf143e15abb243egdaniel#include "GrStencil.h" 199513143efa734bef0c1a0c7f945022572dbc8518egdaniel#include "GrXferProcessor.h" 2089af44a0f1323dc136b238c00ccf143e15abb243egdaniel#include "SkMatrix.h" 218750924a1470e8215b2a344155259b93062d3fa2egdaniel#include "effects/GrCoverageSetOpXP.h" 22080e673b10ac607305f140ddb245e140ccde40c6egdaniel#include "effects/GrDisableColorXP.h" 239513143efa734bef0c1a0c7f945022572dbc8518egdaniel#include "effects/GrPorterDuffXferProcessor.h" 2468b58c95384dd6c2fd389a5b4bbf8fc468819454bsalomon@google.com#include "effects/GrSimpleTextureEffect.h" 259381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com 265bf99f1ca8f30287803b594d06c60a7b6796ad45joshualittclass GrBatch; 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 502401ae8fd3c1f6282f571b5a7e0a499e9f4c09abbsalomon@google.com /////////////////////////////////////////////////////////////////////////// 516be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /// @name Fragment Processors 52eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com /// 536be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /// GrFragmentProcessors are used to compute per-pixel color and per-pixel fractional coverage. 546be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /// There are two chains of FPs, one for color and one for coverage. The first FP in each 556be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /// chain gets the initial color/coverage from the GrPrimitiveProcessor. It computes an output 566be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /// color/coverage which is fed to the next FP in the chain. The last color and coverage FPs 576be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /// feed their output to the GrXferProcessor which controls blending. 588f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com //// 598f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 606be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon int numColorFragmentStages() const { return fColorStages.count(); } 616be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon int numCoverageFragmentStages() const { return fCoverageStages.count(); } 626be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon int numFragmentStages() const { return this->numColorFragmentStages() + 636be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon this->numCoverageFragmentStages(); } 64378092f3d10b1dd62967f419c35cfefec7c10ee7egdaniel 656be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon const GrFragmentStage& getColorFragmentStage(int idx) const { return fColorStages[idx]; } 666be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon const GrFragmentStage& getCoverageFragmentStage(int idx) const { return fCoverageStages[idx]; } 67080e673b10ac607305f140ddb245e140ccde40c6egdaniel 68b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effect) { 6949f085dddff10473b6ebf832a974288300224e60bsalomon SkASSERT(effect); 70b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (effect)); 71b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel fColorProcInfoValid = false; 7265eb4d5a210884cc92c43a8582cbd1ccbddcab57jvanverth@google.com return effect; 7365eb4d5a210884cc92c43a8582cbd1ccbddcab57jvanverth@google.com } 7401c34ee59906f729f6ca7d35f0c0e5e2f5e693feskia.committer@gmail.com 75b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* effect) { 7649f085dddff10473b6ebf832a974288300224e60bsalomon SkASSERT(effect); 77b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (effect)); 78b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel fCoverageProcInfoValid = false; 79adc6536fe5baff2216fb76ecda6cc81c61109d5cbsalomon@google.com return effect; 80adc6536fe5baff2216fb76ecda6cc81c61109d5cbsalomon@google.com } 81adc6536fe5baff2216fb76ecda6cc81c61109d5cbsalomon@google.com 828f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /** 83c78188896e28a4ae49e406a7422b345ae177dafebsalomon@google.com * Creates a GrSimpleTextureEffect that uses local coords as texture coordinates. 841e8f016305805d4d8cad74aba3a21b78486f9d6ftomhudson@google.com */ 85b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) { 86b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref(); 871ce49fc91714ce8974d11246d29ebe7b97b5fe98bsalomon@google.com } 881ce49fc91714ce8974d11246d29ebe7b97b5fe98bsalomon@google.com 89b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) { 90b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref(); 917d6afdd795eb4c7ce8f5a327117cfdba5f957ddbtomhudson@google.com } 92676e66096c60615bac52f365111596de5c4ca8a6tomhudson@google.com 93b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt void addColorTextureProcessor(GrTexture* texture, 94eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com const SkMatrix& matrix, 95eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com const GrTextureParams& params) { 96b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix, params))->unref(); 97b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt } 98b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt 99b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt void addCoverageTextureProcessor(GrTexture* texture, 100b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt const SkMatrix& matrix, 101b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt const GrTextureParams& params) { 102b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix, params))->unref(); 103ff6ea2663f76aa85ec55ddd0f00ca7906f1bc4e3commit-bot@chromium.org } 104676e66096c60615bac52f365111596de5c4ca8a6tomhudson@google.com 105972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com /** 1066be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * When this object is destroyed it will remove any color/coverage FPs from the pipeline builder 1076be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * that were added after its constructor. 108972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com */ 1096be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon class AutoRestoreFragmentProcessors : public ::SkNoncopyable { 110972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com public: 1116be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon AutoRestoreFragmentProcessors() 1128dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel : fPipelineBuilder(NULL) 1139b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon , fColorEffectCnt(0) 1149b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon , fCoverageEffectCnt(0) {} 1159b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon 1166be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon AutoRestoreFragmentProcessors(GrPipelineBuilder* ds) 1178dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel : fPipelineBuilder(NULL) 1189b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon , fColorEffectCnt(0) 1199b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon , fCoverageEffectCnt(0) { 1205c493d5b3dc753fccba47c8250fb38713bac3cb8skia.committer@gmail.com this->set(ds); 121f09b87dda39df1315f26afb663aeaf8048330725robertphillips@google.com } 122eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com 1236be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon ~AutoRestoreFragmentProcessors() { this->set(NULL); } 124eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com 1258dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel void set(GrPipelineBuilder* ds); 126eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com 1278dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel bool isSet() const { return SkToBool(fPipelineBuilder); } 1288af0523b38f25993c8b1ba3a3562b9f9ac87162dbsalomon 129972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com private: 1308dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel GrPipelineBuilder* fPipelineBuilder; 1319b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon int fColorEffectCnt; 1329b536523cae9787f6b24ed9234c50cdf2710d67ebsalomon int fCoverageEffectCnt; 133972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com }; 134972265db219ce25b5159879c75e6c62efaf0fa79robertphillips@google.com 1358f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @} 1368f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 1378f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /////////////////////////////////////////////////////////////////////////// 1388f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @name Blending 1398f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com //// 1408f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 14189af44a0f1323dc136b238c00ccf143e15abb243egdaniel /** 1426be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * This function returns true if the render target destination pixel values will be read for 1436be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * blending during draw. 1446be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon */ 1456be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon bool willBlendWithDst(const GrPrimitiveProcessor*) const; 1466be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 1476be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /** 1486be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * Installs a GrXPFactory. This object controls how src color, fractional pixel coverage, 1496be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * and the dst color are blended. 1506be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon */ 1516be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { 1526be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon fXPFactory.reset(SkRef(xpFactory)); 1536be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon return xpFactory; 1546be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 1558f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 1566be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /** 1576be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * Sets a GrXPFactory that will ignore src color and perform a set operation between the draws 1586be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * output coverage and the destination. This is useful to render coverage masks as CSG. 1596be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon */ 1606be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage = false) { 1616be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage)); 1626be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 1636be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 1646be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /** 1656be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * Sets a GrXPFactory that disables color writes to the destination. This is useful when 1666be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * rendering to the stencil buffer. 1676be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon */ 1686be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon void setDisableColorXPFactory() { 1696be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon fXPFactory.reset(GrDisableColorXPFactory::Create()); 1706be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 1716be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 1726be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon const GrXPFactory* getXPFactory() const { 1736be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon if (!fXPFactory) { 1746be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode)); 1756be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 1766be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon return fXPFactory.get(); 1776be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 1786be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 1796be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /** 1806be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * Checks whether the xp will need a copy of the destination to correctly blend. 1816be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon */ 1826be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon bool willXPNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptInfo& colorPOI, 1836be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon const GrProcOptInfo& coveragePOI) const; 184d27f73ef27ff65a6a0a5d00aa8e5b784b1a0b47ejoshualitt 1858f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @} 1868f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 1876be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 1888f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /////////////////////////////////////////////////////////////////////////// 1898f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @name Render Target 1908f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com //// 1918f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 1928f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /** 19389af44a0f1323dc136b238c00ccf143e15abb243egdaniel * Retrieves the currently set render-target. 19489af44a0f1323dc136b238c00ccf143e15abb243egdaniel * 19589af44a0f1323dc136b238c00ccf143e15abb243egdaniel * @return The currently set render target. 19689af44a0f1323dc136b238c00ccf143e15abb243egdaniel */ 19737dd331b20a92ce79cc26556e065dec98a66cb0bbsalomon GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } 19889af44a0f1323dc136b238c00ccf143e15abb243egdaniel 19989af44a0f1323dc136b238c00ccf143e15abb243egdaniel /** 200ca43208e4aaac817fbc8265542f995f24a3fb7bfbsalomon@google.com * Sets the render-target used at the next drawing call 2018f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * 2028f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * @param target The render target to set. 2038f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com */ 204ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon void setRenderTarget(GrRenderTarget* target) { fRenderTarget.reset(SkSafeRef(target)); } 2058f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 2068f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @} 2078f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 2088f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /////////////////////////////////////////////////////////////////////////// 2098f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @name Stencil 2108f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com //// 2118f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 21289af44a0f1323dc136b238c00ccf143e15abb243egdaniel const GrStencilSettings& getStencil() const { return fStencilSettings; } 21389af44a0f1323dc136b238c00ccf143e15abb243egdaniel 2148f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /** 2158f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * Sets the stencil settings to use for the next draw. 2168f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * Changing the clip has the side-effect of possibly zeroing 2178f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * out the client settable stencil bits. So multipass algorithms 2188f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * using stencil should not change the clip between passes. 2198f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * @param settings the stencil settings to use. 2208f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com */ 22104ddf89627077ea8f2b447e7cd5e902956341a32bsalomon void setStencil(const GrStencilSettings& settings) { fStencilSettings = settings; } 2228f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 2238f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /** 2248f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * Shortcut to disable stencil testing and ops. 2258f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com */ 22604ddf89627077ea8f2b447e7cd5e902956341a32bsalomon void disableStencil() { fStencilSettings.setDisabled(); } 2278f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 2282ed5ef84a5609089ad9d8a8f3a52bf77e76476dbbsalomon GrStencilSettings* stencil() { return &fStencilSettings; } 2298f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 2306be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon /** 2316be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * AutoRestoreStencil 2326be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * 2336be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * This simple struct saves and restores the stencil settings 2346be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon */ 2356be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon class AutoRestoreStencil : public ::SkNoncopyable { 2366be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon public: 2376be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon AutoRestoreStencil() : fPipelineBuilder(NULL) {} 2386be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 2396be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon AutoRestoreStencil(GrPipelineBuilder* ds) : fPipelineBuilder(NULL) { this->set(ds); } 2406be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 2416be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon ~AutoRestoreStencil() { this->set(NULL); } 2426be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 2436be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon void set(GrPipelineBuilder* ds) { 2446be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon if (fPipelineBuilder) { 2456be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon fPipelineBuilder->setStencil(fStencilSettings); 2466be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 2476be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon fPipelineBuilder = ds; 2486be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon if (ds) { 2496be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon fStencilSettings = ds->getStencil(); 2506be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 2516be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon } 2526be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 2536be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon bool isSet() const { return SkToBool(fPipelineBuilder); } 2546be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 2556be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon private: 2566be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon GrPipelineBuilder* fPipelineBuilder; 2576be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon GrStencilSettings fStencilSettings; 2586be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon }; 2596be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 2606be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon 2618f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @} 2628f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 2638f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /////////////////////////////////////////////////////////////////////////// 2648f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @name State Flags 2658f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com //// 2668f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 26789af44a0f1323dc136b238c00ccf143e15abb243egdaniel /** 26889af44a0f1323dc136b238c00ccf143e15abb243egdaniel * Flags that affect rendering. Controlled using enable/disableState(). All 26989af44a0f1323dc136b238c00ccf143e15abb243egdaniel * default to disabled. 27089af44a0f1323dc136b238c00ccf143e15abb243egdaniel */ 271d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon enum Flags { 27289af44a0f1323dc136b238c00ccf143e15abb243egdaniel /** 27389af44a0f1323dc136b238c00ccf143e15abb243egdaniel * Perform dithering. TODO: Re-evaluate whether we need this bit 27489af44a0f1323dc136b238c00ccf143e15abb243egdaniel */ 275d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon kDither_Flag = 0x01, 27689af44a0f1323dc136b238c00ccf143e15abb243egdaniel /** 27789af44a0f1323dc136b238c00ccf143e15abb243egdaniel * Perform HW anti-aliasing. This means either HW FSAA, if supported by the render target, 27889af44a0f1323dc136b238c00ccf143e15abb243egdaniel * or smooth-line rendering if a line primitive is drawn and line smoothing is supported by 27989af44a0f1323dc136b238c00ccf143e15abb243egdaniel * the 3D API. 28089af44a0f1323dc136b238c00ccf143e15abb243egdaniel */ 281d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon kHWAntialias_Flag = 0x02, 28289af44a0f1323dc136b238c00ccf143e15abb243egdaniel 283d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon /** 284d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon * Modifies the vertex shader so that vertices will be positioned at pixel centers. 285d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon */ 286d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon kSnapVerticesToPixelCenters_Flag = 0x04, 287d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon 288d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon kLast_Flag = kSnapVerticesToPixelCenters_Flag, 28989af44a0f1323dc136b238c00ccf143e15abb243egdaniel }; 29089af44a0f1323dc136b238c00ccf143e15abb243egdaniel 291d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon bool isDither() const { return SkToBool(fFlags & kDither_Flag); } 292d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon bool isHWAntialias() const { return SkToBool(fFlags & kHWAntialias_Flag); } 293d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon bool snapVerticesToPixelCenters() const { 294d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon return SkToBool(fFlags & kSnapVerticesToPixelCenters_Flag); } 2950fec61d19ca9088d54f58bd0a67150171b83d66cbsalomon@google.com 2968f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /** 2978f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * Enable render state settings. 2988f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * 299d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon * @param flags bitfield of Flags specifying the states to enable 3008f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com */ 301d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon void enableState(uint32_t flags) { fFlags |= flags; } 302d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon 3038f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /** 3048f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * Disable render state settings. 3058f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * 306d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon * @param flags bitfield of Flags specifying the states to disable 3078f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com */ 308d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon void disableState(uint32_t flags) { fFlags &= ~(flags); } 3090fec61d19ca9088d54f58bd0a67150171b83d66cbsalomon@google.com 310d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com /** 311d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon * Enable or disable flags based on a boolean. 312d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com * 313d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon * @param flags bitfield of Flags to enable or disable 314d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com * @param enable if true enable stateBits, otherwise disable 315d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com */ 316d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon void setState(uint32_t flags, bool enable) { 317d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com if (enable) { 318d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon this->enableState(flags); 319d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com } else { 320d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon this->disableState(flags); 321d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com } 322d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com } 323d5d69ffaea117428972db48796f7e75f0d1dab34bsalomon@google.com 3248f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @} 3258f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 3268f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /////////////////////////////////////////////////////////////////////////// 3278f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @name Face Culling 3288f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com //// 3298f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 33089af44a0f1323dc136b238c00ccf143e15abb243egdaniel enum DrawFace { 33189af44a0f1323dc136b238c00ccf143e15abb243egdaniel kInvalid_DrawFace = -1, 33289af44a0f1323dc136b238c00ccf143e15abb243egdaniel 33389af44a0f1323dc136b238c00ccf143e15abb243egdaniel kBoth_DrawFace, 33489af44a0f1323dc136b238c00ccf143e15abb243egdaniel kCCW_DrawFace, 33589af44a0f1323dc136b238c00ccf143e15abb243egdaniel kCW_DrawFace, 33689af44a0f1323dc136b238c00ccf143e15abb243egdaniel }; 33789af44a0f1323dc136b238c00ccf143e15abb243egdaniel 33889af44a0f1323dc136b238c00ccf143e15abb243egdaniel /** 33989af44a0f1323dc136b238c00ccf143e15abb243egdaniel * Gets whether the target is drawing clockwise, counterclockwise, 34089af44a0f1323dc136b238c00ccf143e15abb243egdaniel * or both faces. 34189af44a0f1323dc136b238c00ccf143e15abb243egdaniel * @return the current draw face(s). 34289af44a0f1323dc136b238c00ccf143e15abb243egdaniel */ 34389af44a0f1323dc136b238c00ccf143e15abb243egdaniel DrawFace getDrawFace() const { return fDrawFace; } 34489af44a0f1323dc136b238c00ccf143e15abb243egdaniel 3458f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /** 3468f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * Controls whether clockwise, counterclockwise, or both faces are drawn. 3478f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com * @param face the face(s) to draw. 3488f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com */ 3498f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com void setDrawFace(DrawFace face) { 350f6de475e5cbd143f348ff7738919e397b7fe7f57tfarina@chromium.org SkASSERT(kInvalid_DrawFace != face); 3512ed5ef84a5609089ad9d8a8f3a52bf77e76476dbbsalomon fDrawFace = face; 3528f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com } 3538f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 3548f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /// @} 3558f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 3568f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com /////////////////////////////////////////////////////////////////////////// 35762b09687857c923b1044be0aef4dd900f8379b22tomhudson@google.com 3586be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon GrPipelineBuilder& operator=(const GrPipelineBuilder& that); 35962b09687857c923b1044be0aef4dd900f8379b22tomhudson@google.com 3604d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt // TODO delete when we have Batch 36156995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { 36256995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt this->calcColorInvariantOutput(pp); 363912b3d24a0e214e46a211da40cc01fe30238386cegdaniel return fColorProcInfo; 364912b3d24a0e214e46a211da40cc01fe30238386cegdaniel } 365912b3d24a0e214e46a211da40cc01fe30238386cegdaniel 36656995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const { 36756995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt this->calcCoverageInvariantOutput(pp); 368912b3d24a0e214e46a211da40cc01fe30238386cegdaniel return fCoverageProcInfo; 369912b3d24a0e214e46a211da40cc01fe30238386cegdaniel } 370912b3d24a0e214e46a211da40cc01fe30238386cegdaniel 3714d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { 3724d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt this->calcColorInvariantOutput(batch); 3734d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt return fColorProcInfo; 3744d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt } 3754d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt 3764d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { 3774d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt this->calcCoverageInvariantOutput(batch); 3784d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt return fCoverageProcInfo; 3794d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt } 38044701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt 38144701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt void setClip(const GrClip& clip) { fClip = clip; } 38244701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt const GrClip& clip() const { return fClip; } 38344701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt 384e36914cb205699526988127a827d1a76c9a98d39egdanielprivate: 385e36914cb205699526988127a827d1a76c9a98d39egdaniel // Calculating invariant color / coverage information is expensive, so we partially cache the 386e36914cb205699526988127a827d1a76c9a98d39egdaniel // results. 387e36914cb205699526988127a827d1a76c9a98d39egdaniel // 388e36914cb205699526988127a827d1a76c9a98d39egdaniel // canUseFracCoveragePrimProc() - Called in regular skia draw, caches results but only for a 389e36914cb205699526988127a827d1a76c9a98d39egdaniel // specific color and coverage. May be called multiple times 390e36914cb205699526988127a827d1a76c9a98d39egdaniel // willBlendWithDst() - only called by Nvpr, does not cache results 391e36914cb205699526988127a827d1a76c9a98d39egdaniel // GrOptDrawState constructor - never caches results 3924d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt 39389af44a0f1323dc136b238c00ccf143e15abb243egdaniel /** 3944d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt * Primproc variants of the calc functions 3954d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt * TODO remove these when batch is everywhere 39656995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt */ 39756995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; 3984d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; 39956995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt 40056995b5cc00c9c83bd5fcf86bca9a67e939a96cbjoshualitt /** 4014d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt * GrBatch provides the initial seed for these loops based off of its initial geometry data 40289af44a0f1323dc136b238c00ccf143e15abb243egdaniel */ 4034d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt void calcColorInvariantOutput(const GrBatch*) const; 4044d8da81562852e0ff7e18b66ee1cebd50ad81ee8joshualitt void calcCoverageInvariantOutput(const GrBatch*) const; 40589af44a0f1323dc136b238c00ccf143e15abb243egdaniel 406b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel /** 407b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel * If fColorProcInfoValid is false, function calculates the invariant output for the color 4086be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * processors and results are stored in fColorProcInfo. 409b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel */ 4102e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt void calcColorInvariantOutput(GrColor) const; 411b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel 412b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel /** 413b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel * If fCoverageProcInfoValid is false, function calculates the invariant output for the coverage 4146be6f7cb66b277e7b1ce13d09b635fb8e09a2f68bsalomon * processors and results are stored in fCoverageProcInfo. 415b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel */ 4162e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt void calcCoverageInvariantOutput(GrColor) const; 417b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel 418eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com // Some of the auto restore objects assume that no effects are removed during their lifetime. 419eb6879f50a5564eeb981ec5616b55bf685eb76fcbsalomon@google.com // This is used to assert that this condition holds. 4201acc3d7cc28c5631b5300578ab13439bdefd4e33commit-bot@chromium.org SkDEBUGCODE(int fBlockEffectRemovalCnt;) 4218f9cbd62ec108d410b91155dcf6a4789c641246fbsalomon@google.com 422a5305a110ab5201d5dadd40cbe711582d5ac4996joshualitt typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; 42389af44a0f1323dc136b238c00ccf143e15abb243egdaniel 424ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon SkAutoTUnref<GrRenderTarget> fRenderTarget; 425d79c549467e5e7be025e38357f179b7965ed2ec3bsalomon uint32_t fFlags; 426ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon GrStencilSettings fStencilSettings; 427ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon DrawFace fDrawFace; 4282fdeda04988867625bb9bc2f7f6037406a0a98ecjoshualitt mutable SkAutoTUnref<const GrXPFactory> fXPFactory; 429ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon FragmentStageArray fColorStages; 430ae59b77612c42ff6b793dc33e3d115e6a5db34ccbsalomon FragmentStageArray fCoverageStages; 43144701df5ce572ac3cccec785cf52103d3d5d14a5joshualitt GrClip fClip; 43289af44a0f1323dc136b238c00ccf143e15abb243egdaniel 433b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel mutable GrProcOptInfo fColorProcInfo; 434b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel mutable GrProcOptInfo fCoverageProcInfo; 435b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel mutable bool fColorProcInfoValid; 436b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel mutable bool fCoverageProcInfoValid; 4372e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt mutable GrColor fColorCache; 4382e3b3e369d79e78f7635d4c20e83a47ab571bdf2joshualitt mutable GrColor fCoverageCache; 439b6cbc38702dc4a1540a17181cbdab71060c92ce7egdaniel 4408dd688b7569df569a672a8a67b2db86a9d376cfcegdaniel friend class GrPipeline; 4419381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com}; 4429381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com 4439381363050ec9d3e724076a8e9152bfa9a8de1d1tomhudson@google.com#endif 444