blob: f5fe9f80dc38196d583183845a0990684b88eced [file] [log] [blame]
tomhudson@google.com93813632011-10-27 20:21:16 +00001/*
egdaniel8dd688b2015-01-22 10:16:09 -08002 * Copyright 2015 Google Inc.
tomhudson@google.com93813632011-10-27 20:21:16 +00003 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
egdaniel8dd688b2015-01-22 10:16:09 -08008#ifndef GrPipelineBuilder_DEFINED
9#define GrPipelineBuilder_DEFINED
tomhudson@google.com93813632011-10-27 20:21:16 +000010
commit-bot@chromium.org24ab3b02013-08-14 21:56:37 +000011#include "GrBlend.h"
bsalomoneb1cb5c2015-05-22 08:01:09 -070012#include "GrCaps.h"
joshualitt44701df2015-02-23 14:44:57 -080013#include "GrClip.h"
bsalomonf96ba022014-09-17 08:05:40 -070014#include "GrGpuResourceRef.h"
egdanielb6cbc382014-11-13 11:00:34 -080015#include "GrProcOptInfo.h"
egdaniel89af44a2014-09-26 06:15:04 -070016#include "GrRenderTarget.h"
17#include "GrStencil.h"
egdaniel95131432014-12-09 11:15:43 -080018#include "GrXferProcessor.h"
egdaniel89af44a2014-09-26 06:15:04 -070019#include "SkMatrix.h"
egdaniel87509242014-12-17 13:37:13 -080020#include "effects/GrCoverageSetOpXP.h"
egdaniel080e6732014-12-22 07:35:52 -080021#include "effects/GrDisableColorXP.h"
egdaniel95131432014-12-09 11:15:43 -080022#include "effects/GrPorterDuffXferProcessor.h"
bsalomon@google.com68b58c92013-01-17 16:50:08 +000023#include "effects/GrSimpleTextureEffect.h"
tomhudson@google.com93813632011-10-27 20:21:16 +000024
bsalomonabd30f52015-08-13 13:34:48 -070025class GrDrawBatch;
bsalomon4b91f762015-05-19 09:29:46 -070026class GrCaps;
egdaniel89af44a2014-09-26 06:15:04 -070027class GrPaint;
28class GrTexture;
egdaniel170f90b2014-09-16 12:54:40 -070029
bsalomonac856c92015-08-27 06:30:17 -070030class GrPipelineBuilder : public SkNoncopyable {
bsalomon@google.com2e3d1442012-03-26 20:33:54 +000031public:
egdaniel8dd688b2015-01-22 10:16:09 -080032 GrPipelineBuilder();
33
bsalomon@google.com52a5dcb2012-01-17 16:01:37 +000034 /**
joshualitt7b670db2015-07-09 13:25:02 -070035 * Initializes the GrPipelineBuilder based on a GrPaint, render target, and clip. Note
egdaniel8dd688b2015-01-22 10:16:09 -080036 * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipelineBuilder that have
37 * no GrPaint equivalents are set to default values with the exception of vertex attribute state
38 * which is unmodified by this function and clipping which will be enabled.
bsalomon@google.comaf84e742012-10-05 13:23:24 +000039 */
joshualitt7b670db2015-07-09 13:25:02 -070040 GrPipelineBuilder(const GrPaint&, GrRenderTarget*, const GrClip&);
41
42 virtual ~GrPipelineBuilder();
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +000043
bsalomon@google.com2401ae82012-01-17 21:03:05 +000044 ///////////////////////////////////////////////////////////////////////////
bsalomon6be6f7c2015-02-26 13:05:21 -080045 /// @name Fragment Processors
bsalomon@google.comeb6879f2013-06-13 19:34:18 +000046 ///
bsalomon6be6f7c2015-02-26 13:05:21 -080047 /// GrFragmentProcessors are used to compute per-pixel color and per-pixel fractional coverage.
48 /// There are two chains of FPs, one for color and one for coverage. The first FP in each
49 /// chain gets the initial color/coverage from the GrPrimitiveProcessor. It computes an output
50 /// color/coverage which is fed to the next FP in the chain. The last color and coverage FPs
51 /// feed their output to the GrXferProcessor which controls blending.
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +000052 ////
53
bsalomonac856c92015-08-27 06:30:17 -070054 int numColorFragmentProcessors() const { return fColorFragmentProcessors.count(); }
55 int numCoverageFragmentProcessors() const { return fCoverageFragmentProcessors.count(); }
56 int numFragmentProcessors() const { return this->numColorFragmentProcessors() +
57 this->numCoverageFragmentProcessors(); }
egdaniel378092f2014-12-03 10:40:13 -080058
bsalomonac856c92015-08-27 06:30:17 -070059 const GrFragmentProcessor* getColorFragmentProcessor(int idx) const {
60 return fColorFragmentProcessors[idx];
61 }
62 const GrFragmentProcessor* getCoverageFragmentProcessor(int idx) const {
63 return fCoverageFragmentProcessors[idx];
jvanverth@google.com65eb4d52013-03-19 18:51:02 +000064 }
skia.committer@gmail.com01c34ee2013-03-20 07:01:02 +000065
bsalomonac856c92015-08-27 06:30:17 -070066 const GrFragmentProcessor* addColorFragmentProcessor(const GrFragmentProcessor* processor) {
67 SkASSERT(processor);
68 fColorFragmentProcessors.push_back(SkRef(processor));
69 return processor;
70 }
71
72 const GrFragmentProcessor* addCoverageFragmentProcessor(const GrFragmentProcessor* processor) {
73 SkASSERT(processor);
74 fCoverageFragmentProcessors.push_back(SkRef(processor));
75 return processor;
bsalomon@google.comadc65362013-01-28 14:26:09 +000076 }
77
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +000078 /**
bsalomon@google.comc7818882013-03-20 19:19:53 +000079 * Creates a GrSimpleTextureEffect that uses local coords as texture coordinates.
tomhudson@google.com1e8f0162012-07-20 16:25:18 +000080 */
joshualittb0a8a372014-09-23 09:50:21 -070081 void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
bsalomon4a339522015-10-06 08:40:50 -070082 this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
bsalomon@google.comdfdb7e52012-10-16 15:19:45 +000083 }
bsalomon@google.comeb6879f2013-06-13 19:34:18 +000084
joshualittb0a8a372014-09-23 09:50:21 -070085 void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
bsalomon4a339522015-10-06 08:40:50 -070086 this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
bsalomon@google.comeb6879f2013-06-13 19:34:18 +000087 }
88
joshualittb0a8a372014-09-23 09:50:21 -070089 void addColorTextureProcessor(GrTexture* texture,
bsalomon@google.comeb6879f2013-06-13 19:34:18 +000090 const SkMatrix& matrix,
91 const GrTextureParams& params) {
bsalomon4a339522015-10-06 08:40:50 -070092 this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix,
bsalomonac856c92015-08-27 06:30:17 -070093 params))->unref();
joshualittb0a8a372014-09-23 09:50:21 -070094 }
95
96 void addCoverageTextureProcessor(GrTexture* texture,
97 const SkMatrix& matrix,
98 const GrTextureParams& params) {
bsalomon4a339522015-10-06 08:40:50 -070099 this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix,
100 params))->unref();
commit-bot@chromium.orgff6ea262013-03-12 12:26:08 +0000101 }
tomhudson@google.com676e6602012-07-10 17:21:48 +0000102
robertphillips@google.com972265d2012-06-13 18:49:30 +0000103 /**
bsalomon6be6f7c2015-02-26 13:05:21 -0800104 * When this object is destroyed it will remove any color/coverage FPs from the pipeline builder
bsalomon4a339522015-10-06 08:40:50 -0700105 * that were added after its constructor.
joshualitt5e6ba212015-07-13 07:35:05 -0700106 * This class can transiently modify its "const" GrPipelineBuilder object but will restore it
107 * when done - so it is notionally "const" correct.
robertphillips@google.com972265d2012-06-13 18:49:30 +0000108 */
joshualitt4421a4c2015-07-13 09:36:41 -0700109 class AutoRestoreFragmentProcessorState : public ::SkNoncopyable {
robertphillips@google.com972265d2012-06-13 18:49:30 +0000110 public:
joshualitt4421a4c2015-07-13 09:36:41 -0700111 AutoRestoreFragmentProcessorState()
halcanary96fcdcc2015-08-27 07:41:13 -0700112 : fPipelineBuilder(nullptr)
bsalomon9b536522014-09-05 09:18:51 -0700113 , fColorEffectCnt(0)
joshualittaf2533a2015-09-09 10:00:12 -0700114 , fCoverageEffectCnt(0) {}
bsalomon@google.comeb6879f2013-06-13 19:34:18 +0000115
joshualitt4421a4c2015-07-13 09:36:41 -0700116 AutoRestoreFragmentProcessorState(const GrPipelineBuilder& ds)
halcanary96fcdcc2015-08-27 07:41:13 -0700117 : fPipelineBuilder(nullptr)
bsalomon9b536522014-09-05 09:18:51 -0700118 , fColorEffectCnt(0)
joshualittaf2533a2015-09-09 10:00:12 -0700119 , fCoverageEffectCnt(0) {
joshualitt4421a4c2015-07-13 09:36:41 -0700120 this->set(&ds);
robertphillips@google.comf09b87d2013-06-13 20:06:44 +0000121 }
bsalomon@google.comeb6879f2013-06-13 19:34:18 +0000122
halcanary96fcdcc2015-08-27 07:41:13 -0700123 ~AutoRestoreFragmentProcessorState() { this->set(nullptr); }
bsalomon@google.comeb6879f2013-06-13 19:34:18 +0000124
joshualitt5e6ba212015-07-13 07:35:05 -0700125 void set(const GrPipelineBuilder* ds);
bsalomon@google.comeb6879f2013-06-13 19:34:18 +0000126
egdaniel8dd688b2015-01-22 10:16:09 -0800127 bool isSet() const { return SkToBool(fPipelineBuilder); }
bsalomon8af05232014-06-03 06:34:58 -0700128
bsalomon4a339522015-10-06 08:40:50 -0700129 const GrFragmentProcessor* addCoverageFragmentProcessor(
130 const GrFragmentProcessor* processor) {
joshualitt5e6ba212015-07-13 07:35:05 -0700131 SkASSERT(this->isSet());
bsalomonac856c92015-08-27 06:30:17 -0700132 return fPipelineBuilder->addCoverageFragmentProcessor(processor);
joshualitt5e6ba212015-07-13 07:35:05 -0700133 }
134
robertphillips@google.com972265d2012-06-13 18:49:30 +0000135 private:
joshualitt5e6ba212015-07-13 07:35:05 -0700136 // notionally const (as marginalia)
egdaniel8dd688b2015-01-22 10:16:09 -0800137 GrPipelineBuilder* fPipelineBuilder;
joshualitt5e6ba212015-07-13 07:35:05 -0700138 int fColorEffectCnt;
139 int fCoverageEffectCnt;
robertphillips@google.com972265d2012-06-13 18:49:30 +0000140 };
141
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000142 /// @}
143
144 ///////////////////////////////////////////////////////////////////////////
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000145 /// @name Blending
146 ////
147
egdaniel89af44a2014-09-26 06:15:04 -0700148 /**
bsalomon6be6f7c2015-02-26 13:05:21 -0800149 * Installs a GrXPFactory. This object controls how src color, fractional pixel coverage,
150 * and the dst color are blended.
151 */
152 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) {
egdanielc4b72722015-11-23 13:20:41 -0800153 fXPFactory.reset(SkSafeRef(xpFactory));
bsalomon6be6f7c2015-02-26 13:05:21 -0800154 return xpFactory;
155 }
156
157 /**
158 * Sets a GrXPFactory that will ignore src color and perform a set operation between the draws
159 * output coverage and the destination. This is useful to render coverage masks as CSG.
160 */
161 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage = false) {
162 fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage));
163 }
164
165 /**
166 * Sets a GrXPFactory that disables color writes to the destination. This is useful when
167 * rendering to the stencil buffer.
168 */
169 void setDisableColorXPFactory() {
170 fXPFactory.reset(GrDisableColorXPFactory::Create());
171 }
172
173 const GrXPFactory* getXPFactory() const {
egdanielc4b72722015-11-23 13:20:41 -0800174 return fXPFactory;
bsalomon6be6f7c2015-02-26 13:05:21 -0800175 }
176
177 /**
bsalomon6a44c6a2015-05-26 09:49:05 -0700178 * Checks whether the xp will need destination in a texture to correctly blend.
bsalomon6be6f7c2015-02-26 13:05:21 -0800179 */
ethannicholasde4166a2015-11-30 08:57:38 -0800180 bool willXPNeedDstTexture(const GrCaps& caps,
181 const GrPipelineOptimizations& optimizations) const;
joshualittd27f73e2014-12-29 07:43:36 -0800182
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000183 /// @}
184
bsalomon6be6f7c2015-02-26 13:05:21 -0800185
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000186 ///////////////////////////////////////////////////////////////////////////
187 /// @name Render Target
188 ////
189
190 /**
egdaniel89af44a2014-09-26 06:15:04 -0700191 * Retrieves the currently set render-target.
192 *
193 * @return The currently set render target.
194 */
bsalomon37dd3312014-11-03 08:47:23 -0800195 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); }
egdaniel89af44a2014-09-26 06:15:04 -0700196
197 /**
bsalomon@google.comca432082013-01-23 19:53:46 +0000198 * Sets the render-target used at the next drawing call
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000199 *
200 * @param target The render target to set.
201 */
bsalomonae59b772014-11-19 08:23:49 -0800202 void setRenderTarget(GrRenderTarget* target) { fRenderTarget.reset(SkSafeRef(target)); }
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000203
cdalton86ae0a92015-06-08 15:11:04 -0700204 /**
205 * Returns whether the rasterizer and stencil test (if any) will run at a higher sample rate
206 * than the color buffer. In is scenario, the higher sample rate is resolved during blending.
207 */
208 bool hasMixedSamples() const {
cdaltonede75742015-11-11 15:27:57 -0800209 return fRenderTarget->hasMixedSamples() &&
210 (this->isHWAntialias() || !fStencilSettings.isDisabled());
cdalton86ae0a92015-06-08 15:11:04 -0700211 }
212
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000213 /// @}
214
215 ///////////////////////////////////////////////////////////////////////////
216 /// @name Stencil
217 ////
218
egdaniel89af44a2014-09-26 06:15:04 -0700219 const GrStencilSettings& getStencil() const { return fStencilSettings; }
220
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000221 /**
222 * Sets the stencil settings to use for the next draw.
223 * Changing the clip has the side-effect of possibly zeroing
224 * out the client settable stencil bits. So multipass algorithms
225 * using stencil should not change the clip between passes.
226 * @param settings the stencil settings to use.
227 */
bsalomon04ddf892014-11-19 12:36:22 -0800228 void setStencil(const GrStencilSettings& settings) { fStencilSettings = settings; }
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000229
bsalomon2ed5ef82014-07-07 08:44:05 -0700230 GrStencilSettings* stencil() { return &fStencilSettings; }
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000231
bsalomon6be6f7c2015-02-26 13:05:21 -0800232 /**
233 * AutoRestoreStencil
234 *
235 * This simple struct saves and restores the stencil settings
joshualitt5e6ba212015-07-13 07:35:05 -0700236 * This class can transiently modify its "const" GrPipelineBuilder object but will restore it
237 * when done - so it is notionally "const" correct.
bsalomon6be6f7c2015-02-26 13:05:21 -0800238 */
239 class AutoRestoreStencil : public ::SkNoncopyable {
240 public:
halcanary96fcdcc2015-08-27 07:41:13 -0700241 AutoRestoreStencil() : fPipelineBuilder(nullptr) {}
bsalomon6be6f7c2015-02-26 13:05:21 -0800242
halcanary96fcdcc2015-08-27 07:41:13 -0700243 AutoRestoreStencil(const GrPipelineBuilder& ds) : fPipelineBuilder(nullptr) { this->set(&ds); }
bsalomon6be6f7c2015-02-26 13:05:21 -0800244
halcanary96fcdcc2015-08-27 07:41:13 -0700245 ~AutoRestoreStencil() { this->set(nullptr); }
bsalomon6be6f7c2015-02-26 13:05:21 -0800246
joshualitt5e6ba212015-07-13 07:35:05 -0700247 void set(const GrPipelineBuilder* ds) {
bsalomon6be6f7c2015-02-26 13:05:21 -0800248 if (fPipelineBuilder) {
249 fPipelineBuilder->setStencil(fStencilSettings);
250 }
joshualitt5e6ba212015-07-13 07:35:05 -0700251 fPipelineBuilder = const_cast<GrPipelineBuilder*>(ds);
bsalomon6be6f7c2015-02-26 13:05:21 -0800252 if (ds) {
253 fStencilSettings = ds->getStencil();
254 }
255 }
256
257 bool isSet() const { return SkToBool(fPipelineBuilder); }
258
joshualitt5e6ba212015-07-13 07:35:05 -0700259 void setStencil(const GrStencilSettings& settings) {
260 SkASSERT(this->isSet());
261 fPipelineBuilder->setStencil(settings);
262 }
263
bsalomon6be6f7c2015-02-26 13:05:21 -0800264 private:
joshualitt5e6ba212015-07-13 07:35:05 -0700265 // notionally const (as marginalia)
bsalomon6be6f7c2015-02-26 13:05:21 -0800266 GrPipelineBuilder* fPipelineBuilder;
267 GrStencilSettings fStencilSettings;
268 };
269
270
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000271 /// @}
272
273 ///////////////////////////////////////////////////////////////////////////
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000274 /// @name State Flags
275 ////
tomhudson@google.com62b09682011-11-09 16:39:17 +0000276
egdaniel89af44a2014-09-26 06:15:04 -0700277 /**
278 * Flags that affect rendering. Controlled using enable/disableState(). All
279 * default to disabled.
280 */
bsalomond79c5492015-04-27 10:07:04 -0700281 enum Flags {
egdaniel89af44a2014-09-26 06:15:04 -0700282 /**
egdaniel89af44a2014-09-26 06:15:04 -0700283 * Perform HW anti-aliasing. This means either HW FSAA, if supported by the render target,
284 * or smooth-line rendering if a line primitive is drawn and line smoothing is supported by
285 * the 3D API.
286 */
bsalomonaca31fe2015-09-22 11:38:46 -0700287 kHWAntialias_Flag = 0x01,
egdaniel89af44a2014-09-26 06:15:04 -0700288
bsalomond79c5492015-04-27 10:07:04 -0700289 /**
290 * Modifies the vertex shader so that vertices will be positioned at pixel centers.
291 */
bsalomonaca31fe2015-09-22 11:38:46 -0700292 kSnapVerticesToPixelCenters_Flag = 0x02,
bsalomond79c5492015-04-27 10:07:04 -0700293
294 kLast_Flag = kSnapVerticesToPixelCenters_Flag,
egdaniel89af44a2014-09-26 06:15:04 -0700295 };
296
bsalomond79c5492015-04-27 10:07:04 -0700297 bool isHWAntialias() const { return SkToBool(fFlags & kHWAntialias_Flag); }
298 bool snapVerticesToPixelCenters() const {
299 return SkToBool(fFlags & kSnapVerticesToPixelCenters_Flag); }
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000300
301 /**
302 * Enable render state settings.
303 *
bsalomond79c5492015-04-27 10:07:04 -0700304 * @param flags bitfield of Flags specifying the states to enable
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000305 */
bsalomond79c5492015-04-27 10:07:04 -0700306 void enableState(uint32_t flags) { fFlags |= flags; }
307
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000308 /**
309 * Disable render state settings.
310 *
bsalomond79c5492015-04-27 10:07:04 -0700311 * @param flags bitfield of Flags specifying the states to disable
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000312 */
bsalomond79c5492015-04-27 10:07:04 -0700313 void disableState(uint32_t flags) { fFlags &= ~(flags); }
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000314
bsalomon@google.comd5d69ff2012-10-04 19:42:00 +0000315 /**
bsalomond79c5492015-04-27 10:07:04 -0700316 * Enable or disable flags based on a boolean.
bsalomon@google.comd5d69ff2012-10-04 19:42:00 +0000317 *
bsalomond79c5492015-04-27 10:07:04 -0700318 * @param flags bitfield of Flags to enable or disable
bsalomon@google.comd5d69ff2012-10-04 19:42:00 +0000319 * @param enable if true enable stateBits, otherwise disable
320 */
bsalomond79c5492015-04-27 10:07:04 -0700321 void setState(uint32_t flags, bool enable) {
bsalomon@google.comd5d69ff2012-10-04 19:42:00 +0000322 if (enable) {
bsalomond79c5492015-04-27 10:07:04 -0700323 this->enableState(flags);
bsalomon@google.comd5d69ff2012-10-04 19:42:00 +0000324 } else {
bsalomond79c5492015-04-27 10:07:04 -0700325 this->disableState(flags);
bsalomon@google.comd5d69ff2012-10-04 19:42:00 +0000326 }
327 }
328
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000329 /// @}
330
331 ///////////////////////////////////////////////////////////////////////////
332 /// @name Face Culling
333 ////
334
egdaniel89af44a2014-09-26 06:15:04 -0700335 enum DrawFace {
336 kInvalid_DrawFace = -1,
337
338 kBoth_DrawFace,
339 kCCW_DrawFace,
340 kCW_DrawFace,
341 };
342
343 /**
344 * Gets whether the target is drawing clockwise, counterclockwise,
345 * or both faces.
346 * @return the current draw face(s).
347 */
348 DrawFace getDrawFace() const { return fDrawFace; }
349
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000350 /**
351 * Controls whether clockwise, counterclockwise, or both faces are drawn.
352 * @param face the face(s) to draw.
353 */
354 void setDrawFace(DrawFace face) {
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000355 SkASSERT(kInvalid_DrawFace != face);
bsalomon2ed5ef82014-07-07 08:44:05 -0700356 fDrawFace = face;
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000357 }
358
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000359 /// @}
360
361 ///////////////////////////////////////////////////////////////////////////
tomhudson@google.com62b09682011-11-09 16:39:17 +0000362
ethannicholasff210322015-11-24 12:10:10 -0800363 bool usePLSDstRead(const GrDrawBatch* batch) const;
joshualitt44701df2015-02-23 14:44:57 -0800364
365 void setClip(const GrClip& clip) { fClip = clip; }
366 const GrClip& clip() const { return fClip; }
367
egdaniele36914c2015-02-13 09:00:33 -0800368private:
bsalomon@google.comeb6879f2013-06-13 19:34:18 +0000369 // Some of the auto restore objects assume that no effects are removed during their lifetime.
370 // This is used to assert that this condition holds.
joshualitt5e6ba212015-07-13 07:35:05 -0700371 SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;)
bsalomon@google.com8f9cbd62011-12-09 15:55:34 +0000372
bsalomonac856c92015-08-27 06:30:17 -0700373 typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArray;
egdaniel89af44a2014-09-26 06:15:04 -0700374
bsalomonae59b772014-11-19 08:23:49 -0800375 SkAutoTUnref<GrRenderTarget> fRenderTarget;
bsalomond79c5492015-04-27 10:07:04 -0700376 uint32_t fFlags;
bsalomonae59b772014-11-19 08:23:49 -0800377 GrStencilSettings fStencilSettings;
bsalomonae59b772014-11-19 08:23:49 -0800378 DrawFace fDrawFace;
joshualitt2fdeda02015-01-22 07:11:44 -0800379 mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
bsalomonac856c92015-08-27 06:30:17 -0700380 FragmentProcessorArray fColorFragmentProcessors;
381 FragmentProcessorArray fCoverageFragmentProcessors;
joshualitt44701df2015-02-23 14:44:57 -0800382 GrClip fClip;
egdaniel89af44a2014-09-26 06:15:04 -0700383
egdaniel8dd688b2015-01-22 10:16:09 -0800384 friend class GrPipeline;
ethannicholasff210322015-11-24 12:10:10 -0800385 friend class GrDrawTarget;
tomhudson@google.com93813632011-10-27 20:21:16 +0000386};
387
388#endif