blob: 56ef871e4914ea31534a0316aee4c8ca62654d6f [file] [log] [blame]
joshualitt4d8da812015-01-28 12:53:54 -08001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Brian Salomon53e4c3c2016-12-21 11:38:53 -05008#ifndef GrOp_DEFINED
9#define GrOp_DEFINED
joshualitt4d8da812015-01-28 12:53:54 -080010
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkMatrix.h"
12#include "include/core/SkRect.h"
13#include "include/core/SkString.h"
Robert Phillipsb7bfbc22020-07-01 12:55:01 -040014#include "include/gpu/GrRecordingContext.h"
Greg Daniel456f9b52020-03-05 19:14:18 +000015#include "src/gpu/GrGpuResource.h"
Herb Derbyc76d4092020-10-07 16:46:15 -040016#include "src/gpu/GrMemoryPool.h"
17#include "src/gpu/GrRecordingContextPriv.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050018#include "src/gpu/GrTracing.h"
19#include "src/gpu/GrXferProcessor.h"
Mike Klein0ec1c572018-12-04 11:52:51 -050020#include <atomic>
21#include <new>
joshualitt4d8da812015-01-28 12:53:54 -080022
Robert Phillips61fc7992019-10-22 11:58:17 -040023class GrAppliedClip;
bsalomon16b99132015-08-13 14:55:50 -070024class GrCaps;
John Stiles87960de2021-06-03 16:44:53 -040025class GrDstProxyView;
Brian Salomon742e31d2016-12-07 17:06:19 -050026class GrOpFlushState;
Greg Daniel2d41d0d2019-08-26 11:08:51 -040027class GrOpsRenderPass;
Herb Derbyc76d4092020-10-07 16:46:15 -040028class GrPaint;
joshualitt4d8da812015-01-28 12:53:54 -080029
bsalomonabd30f52015-08-13 13:34:48 -070030/**
Brian Salomon53e4c3c2016-12-21 11:38:53 -050031 * GrOp is the base class for all Ganesh deferred GPU operations. To facilitate reordering and to
32 * minimize draw calls, Ganesh does not generate geometry inline with draw calls. Instead, it
33 * captures the arguments to the draw and then generates the geometry when flushing. This gives GrOp
34 * subclasses complete freedom to decide how/when to combine in order to produce fewer draw calls
35 * and minimize state changes.
joshualitt4d8da812015-01-28 12:53:54 -080036 *
Brian Salomond25f5bc2018-08-08 11:25:17 -040037 * Ops of the same subclass may be merged or chained using combineIfPossible. When two ops merge,
38 * one takes on the union of the data and the other is left empty. The merged op becomes responsible
39 * for drawing the data from both the original ops. When ops are chained each op maintains its own
40 * data but they are linked in a list and the head op becomes responsible for executing the work for
41 * the chain.
bsalomondb4758c2015-11-23 11:14:20 -080042 *
Brian Salomon588cec72018-11-14 13:56:37 -050043 * It is required that chainability is transitive. Moreover, if op A is able to merge with B then
44 * it must be the case that any op that can chain with A will either merge or chain with any op
45 * that can chain to B.
46 *
Brian Salomon25a88092016-12-01 09:36:50 -050047 * The bounds of the op must contain all the vertices in device space *irrespective* of the clip.
bsalomondb4758c2015-11-23 11:14:20 -080048 * The bounds are used in determining which clip elements must be applied and thus the bounds cannot
49 * in turn depend upon the clip.
joshualitt4d8da812015-01-28 12:53:54 -080050 */
Brian Salomon25a88092016-12-01 09:36:50 -050051#define GR_OP_SPEW 0
52#if GR_OP_SPEW
53 #define GrOP_SPEW(code) code
54 #define GrOP_INFO(...) SkDebugf(__VA_ARGS__)
joshualittca1f07e2015-08-07 08:11:19 -070055#else
Brian Salomon25a88092016-12-01 09:36:50 -050056 #define GrOP_SPEW(code)
57 #define GrOP_INFO(...)
joshualittca1f07e2015-08-07 08:11:19 -070058#endif
joshualitt4d8da812015-01-28 12:53:54 -080059
Robert Phillips27483912018-04-20 12:43:18 -040060// Print out op information at flush time
61#define GR_FLUSH_TIME_OP_SPEW 0
62
reed1b55a962015-09-17 20:16:13 -070063// A helper macro to generate a class static id
Brian Salomon25a88092016-12-01 09:36:50 -050064#define DEFINE_OP_CLASS_ID \
reed1b55a962015-09-17 20:16:13 -070065 static uint32_t ClassID() { \
Brian Salomon25a88092016-12-01 09:36:50 -050066 static uint32_t kClassID = GenOpClassID(); \
reed1b55a962015-09-17 20:16:13 -070067 return kClassID; \
68 }
69
Brian Salomonf8334782017-01-03 09:42:58 -050070class GrOp : private SkNoncopyable {
joshualitt4d8da812015-01-28 12:53:54 -080071public:
Herb Derbyc9a24c92020-12-01 16:59:40 -050072 using Owner = std::unique_ptr<GrOp>;
Herb Derbyc76d4092020-10-07 16:46:15 -040073
74 template<typename Op, typename... Args>
75 static Owner Make(GrRecordingContext* context, Args&&... args) {
Herb Derby32302552021-03-11 18:27:35 -050076 return Owner{new Op(std::forward<Args>(args)...)};
Herb Derbyc76d4092020-10-07 16:46:15 -040077 }
78
79 template<typename Op, typename... Args>
80 static Owner MakeWithProcessorSet(
81 GrRecordingContext* context, const SkPMColor4f& color,
82 GrPaint&& paint, Args&&... args);
83
Herb Derby32302552021-03-11 18:27:35 -050084 template<typename Op, typename... Args>
85 static Owner MakeWithExtraMemory(
86 GrRecordingContext* context, size_t extraSize, Args&&... args) {
87 void* bytes = ::operator new(sizeof(Op) + extraSize);
88 return Owner{new (bytes) Op(std::forward<Args>(args)...)};
89 }
Herb Derbyc76d4092020-10-07 16:46:15 -040090
Brian Salomon588cec72018-11-14 13:56:37 -050091 virtual ~GrOp() = default;
joshualitt4d8da812015-01-28 12:53:54 -080092
93 virtual const char* name() const = 0;
joshualitt4d8da812015-01-28 12:53:54 -080094
Brian Salomon7e67dca2020-07-21 09:27:25 -040095 using VisitProxyFunc = std::function<void(GrSurfaceProxy*, GrMipmapped)>;
Robert Phillipsb493eeb2017-09-13 13:10:52 -040096
Chris Dalton1706cbf2019-05-21 19:35:29 -060097 virtual void visitProxies(const VisitProxyFunc&) const {
Robert Phillipsb493eeb2017-09-13 13:10:52 -040098 // This default implementation assumes the op has no proxies
99 }
100
Brian Salomon7eae3e02018-08-07 14:02:38 +0000101 enum class CombineResult {
102 /**
103 * The op that combineIfPossible was called on now represents its own work plus that of
Brian Salomond25f5bc2018-08-08 11:25:17 -0400104 * the passed op. The passed op should be destroyed without being flushed. Currently it
105 * is not legal to merge an op passed to combineIfPossible() the passed op is already in a
106 * chain (though the op on which combineIfPossible() was called may be).
Brian Salomon7eae3e02018-08-07 14:02:38 +0000107 */
108 kMerged,
109 /**
Brian Salomond25f5bc2018-08-08 11:25:17 -0400110 * The caller *may* (but is not required) to chain these ops together. If they are chained
111 * then prepare() and execute() will be called on the head op but not the other ops in the
112 * chain. The head op will prepare and execute on behalf of all the ops in the chain.
113 */
114 kMayChain,
115 /**
Brian Salomon7eae3e02018-08-07 14:02:38 +0000116 * The ops cannot be combined.
117 */
118 kCannotCombine
119 };
120
Michael Ludwig28b0c5d2019-12-19 14:51:00 -0500121 // The arenas are the same as what was available when the op was created.
Herb Derbye25c3002020-10-27 15:57:27 -0400122 CombineResult combineIfPossible(GrOp* that, SkArenaAlloc* alloc, const GrCaps& caps);
joshualitt4d8da812015-01-28 12:53:54 -0800123
bsalomon88cf17d2016-07-08 06:40:56 -0700124 const SkRect& bounds() const {
125 SkASSERT(kUninitialized_BoundsFlag != fBoundsFlags);
126 return fBounds;
127 }
128
Brian Salomon9e50f7b2017-03-06 12:02:34 -0500129 void setClippedBounds(const SkRect& clippedBounds) {
130 fBounds = clippedBounds;
131 // The clipped bounds already incorporate any effect of the bounds flags.
132 fBoundsFlags = 0;
133 }
134
bsalomon88cf17d2016-07-08 06:40:56 -0700135 bool hasAABloat() const {
136 SkASSERT(fBoundsFlags != kUninitialized_BoundsFlag);
137 return SkToBool(fBoundsFlags & kAABloat_BoundsFlag);
138 }
139
140 bool hasZeroArea() const {
141 SkASSERT(fBoundsFlags != kUninitialized_BoundsFlag);
142 return SkToBool(fBoundsFlags & kZeroArea_BoundsFlag);
143 }
Herb Derbyc9a24c92020-12-01 16:59:40 -0500144
Herb Derby32302552021-03-11 18:27:35 -0500145 void operator delete(void* p) { ::operator delete(p); }
joshualitt4d8da812015-01-28 12:53:54 -0800146
147 /**
Brian Salomon25a88092016-12-01 09:36:50 -0500148 * Helper for safely down-casting to a GrOp subclass
bsalomonabd30f52015-08-13 13:34:48 -0700149 */
reed1b55a962015-09-17 20:16:13 -0700150 template <typename T> const T& cast() const {
151 SkASSERT(T::ClassID() == this->classID());
152 return *static_cast<const T*>(this);
153 }
154
155 template <typename T> T* cast() {
156 SkASSERT(T::ClassID() == this->classID());
157 return static_cast<T*>(this);
158 }
joshualitt4d8da812015-01-28 12:53:54 -0800159
Brian Salomon25a88092016-12-01 09:36:50 -0500160 uint32_t classID() const { SkASSERT(kIllegalOpID != fClassID); return fClassID; }
joshualitt4d8da812015-01-28 12:53:54 -0800161
joshualitt08e65e72016-03-08 09:31:15 -0800162 // We lazily initialize the uniqueID because currently the only user is GrAuditTrail
halcanary9d524f22016-03-29 09:03:52 -0700163 uint32_t uniqueID() const {
Brian Salomon25a88092016-12-01 09:36:50 -0500164 if (kIllegalOpID == fUniqueID) {
165 fUniqueID = GenOpID();
joshualitt08e65e72016-03-08 09:31:15 -0800166 }
halcanary9d524f22016-03-29 09:03:52 -0700167 return fUniqueID;
joshualitt08e65e72016-03-08 09:31:15 -0800168 }
joshualittca1f07e2015-08-07 08:11:19 -0700169
Brian Salomonbde42852016-12-21 11:37:49 -0500170 /**
Robert Phillips7327c9d2019-10-08 16:32:56 -0400171 * This can optionally be called before 'prepare' (but after sorting). Each op that overrides
172 * onPrePrepare must be prepared to handle both cases (when onPrePrepare has been called
173 * ahead of time and when it has not been called).
174 */
Adlai Hollere2296f72020-11-19 13:41:26 -0500175 void prePrepare(GrRecordingContext* context, const GrSurfaceProxyView& dstView,
John Stiles52cb1d02021-06-02 11:58:05 -0400176 GrAppliedClip* clip, const GrDstProxyView& dstProxyView,
Greg Daniel42dbca52020-11-20 10:22:43 -0500177 GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp) {
Greg Daniel0a0ad5b2021-01-29 22:49:30 -0500178 TRACE_EVENT0("skia.gpu", name());
Greg Daniel42dbca52020-11-20 10:22:43 -0500179 this->onPrePrepare(context, dstView, clip, dstProxyView, renderPassXferBarriers,
180 colorLoadOp);
Robert Phillips61fc7992019-10-22 11:58:17 -0400181 }
Robert Phillips7327c9d2019-10-08 16:32:56 -0400182
183 /**
Brian Salomonbde42852016-12-21 11:37:49 -0500184 * Called prior to executing. The op should perform any resource creation or data transfers
185 * necessary before execute() is called.
186 */
Greg Daniel0a0ad5b2021-01-29 22:49:30 -0500187 void prepare(GrOpFlushState* state) {
188 TRACE_EVENT0("skia.gpu", name());
189 this->onPrepare(state);
190 }
bsalomon53469832015-08-18 09:20:09 -0700191
Brian Salomon25a88092016-12-01 09:36:50 -0500192 /** Issues the op's commands to GrGpu. */
Brian Salomon588cec72018-11-14 13:56:37 -0500193 void execute(GrOpFlushState* state, const SkRect& chainBounds) {
Brian Salomon5f394272019-07-02 14:07:49 -0400194 TRACE_EVENT0("skia.gpu", name());
Brian Salomon588cec72018-11-14 13:56:37 -0500195 this->onExecute(state, chainBounds);
Xiao Yu97126012018-04-25 18:11:44 -0700196 }
bsalomon53469832015-08-18 09:20:09 -0700197
Brian Salomon25a88092016-12-01 09:36:50 -0500198 /** Used for spewing information about ops when debugging. */
John Stiles8d9bf642020-08-12 15:07:45 -0400199#if GR_TEST_UTILS
John Stiles8dd1e222020-08-12 19:06:24 -0400200 virtual SkString dumpInfo() const final {
201 return SkStringPrintf("%s\nOpBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]",
202 this->onDumpInfo().c_str(), fBounds.fLeft, fBounds.fTop,
203 fBounds.fRight, fBounds.fBottom);
robertphillips44fbc792016-06-29 06:56:12 -0700204 }
Brian Osman9a390ac2018-11-12 09:47:48 -0500205#endif
bsalomon53469832015-08-18 09:20:09 -0700206
Brian Salomond25f5bc2018-08-08 11:25:17 -0400207 /**
208 * A helper for iterating over an op chain in a range for loop that also downcasts to a GrOp
209 * subclass. E.g.:
210 * for (MyOpSubClass& op : ChainRange<MyOpSubClass>(this)) {
211 * // ...
212 * }
213 */
Brian Salomon588cec72018-11-14 13:56:37 -0500214 template <typename OpSubclass = GrOp> class ChainRange {
Brian Salomond25f5bc2018-08-08 11:25:17 -0400215 private:
216 class Iter {
217 public:
Brian Salomon588cec72018-11-14 13:56:37 -0500218 explicit Iter(const OpSubclass* head) : fCurr(head) {}
219 inline Iter& operator++() {
220 return *this = Iter(static_cast<const OpSubclass*>(fCurr->nextInChain()));
221 }
222 const OpSubclass& operator*() const { return *fCurr; }
Brian Salomond25f5bc2018-08-08 11:25:17 -0400223 bool operator!=(const Iter& that) const { return fCurr != that.fCurr; }
224
225 private:
Brian Salomon588cec72018-11-14 13:56:37 -0500226 const OpSubclass* fCurr;
Brian Salomond25f5bc2018-08-08 11:25:17 -0400227 };
Brian Salomon588cec72018-11-14 13:56:37 -0500228 const OpSubclass* fHead;
Brian Salomond25f5bc2018-08-08 11:25:17 -0400229
230 public:
Brian Salomon588cec72018-11-14 13:56:37 -0500231 explicit ChainRange(const OpSubclass* head) : fHead(head) {}
Brian Salomond25f5bc2018-08-08 11:25:17 -0400232 Iter begin() { return Iter(fHead); }
233 Iter end() { return Iter(nullptr); }
234 };
235
Brian Salomon588cec72018-11-14 13:56:37 -0500236 /**
237 * Concatenates two op chains. This op must be a tail and the passed op must be a head. The ops
238 * must be of the same subclass.
239 */
Herb Derbyc76d4092020-10-07 16:46:15 -0400240 void chainConcat(GrOp::Owner);
Brian Salomond25f5bc2018-08-08 11:25:17 -0400241 /** Returns true if this is the head of a chain (including a length 1 chain). */
Brian Salomon588cec72018-11-14 13:56:37 -0500242 bool isChainHead() const { return !fPrevInChain; }
Brian Salomond25f5bc2018-08-08 11:25:17 -0400243 /** Returns true if this is the tail of a chain (including a length 1 chain). */
244 bool isChainTail() const { return !fNextInChain; }
Brian Salomond25f5bc2018-08-08 11:25:17 -0400245 /** The next op in the chain. */
Brian Salomon588cec72018-11-14 13:56:37 -0500246 GrOp* nextInChain() const { return fNextInChain.get(); }
247 /** The previous op in the chain. */
248 GrOp* prevInChain() const { return fPrevInChain; }
249 /**
250 * Cuts the chain after this op. The returned op is the op that was previously next in the
251 * chain or null if this was already a tail.
252 */
Herb Derbyc76d4092020-10-07 16:46:15 -0400253 GrOp::Owner cutChain();
Brian Salomon588cec72018-11-14 13:56:37 -0500254 SkDEBUGCODE(void validateChain(GrOp* expectedTail = nullptr) const);
Brian Salomond25f5bc2018-08-08 11:25:17 -0400255
Ethan Nicholas029b22c2018-10-18 16:49:56 -0400256#ifdef SK_DEBUG
257 virtual void validate() const {}
258#endif
259
joshualitt4d8da812015-01-28 12:53:54 -0800260protected:
Brian Salomond25f5bc2018-08-08 11:25:17 -0400261 GrOp(uint32_t classID);
262
bsalomon88cf17d2016-07-08 06:40:56 -0700263 /**
Brian Salomon25a88092016-12-01 09:36:50 -0500264 * Indicates that the op will produce geometry that extends beyond its bounds for the
bsalomon88cf17d2016-07-08 06:40:56 -0700265 * purpose of ensuring that the fragment shader runs on partially covered pixels for
266 * non-MSAA antialiasing.
267 */
Chris Dalton3b51df12017-11-27 14:33:06 -0700268 enum class HasAABloat : bool {
269 kNo = false,
270 kYes = true
bsalomon88cf17d2016-07-08 06:40:56 -0700271 };
272 /**
Greg Daniel5faf4742019-10-01 15:14:44 -0400273 * Indicates that the geometry being drawn in a hairline stroke. A point that is drawn in device
274 * space is also considered a hairline.
bsalomon88cf17d2016-07-08 06:40:56 -0700275 */
Greg Daniel5faf4742019-10-01 15:14:44 -0400276 enum class IsHairline : bool {
Chris Dalton3b51df12017-11-27 14:33:06 -0700277 kNo = false,
278 kYes = true
bsalomon88cf17d2016-07-08 06:40:56 -0700279 };
Robert Phillips65a88fa2017-08-08 08:36:22 -0400280
Greg Daniel5faf4742019-10-01 15:14:44 -0400281 void setBounds(const SkRect& newBounds, HasAABloat aabloat, IsHairline zeroArea) {
bsalomon88cf17d2016-07-08 06:40:56 -0700282 fBounds = newBounds;
283 this->setBoundsFlags(aabloat, zeroArea);
284 }
285 void setTransformedBounds(const SkRect& srcBounds, const SkMatrix& m,
Greg Daniel5faf4742019-10-01 15:14:44 -0400286 HasAABloat aabloat, IsHairline zeroArea) {
bsalomon88cf17d2016-07-08 06:40:56 -0700287 m.mapRect(&fBounds, srcBounds);
288 this->setBoundsFlags(aabloat, zeroArea);
289 }
Robert Phillips65a88fa2017-08-08 08:36:22 -0400290 void makeFullScreen(GrSurfaceProxy* proxy) {
Brian Salomon9f2b86c2019-10-22 10:37:46 -0400291 this->setBounds(proxy->getBoundsRect(), HasAABloat::kNo, IsHairline::kNo);
Robert Phillips65a88fa2017-08-08 08:36:22 -0400292 }
joshualitt99c7c072015-05-01 13:43:30 -0700293
Brian Salomonb41417f2018-10-24 08:58:48 -0400294 static uint32_t GenOpClassID() { return GenID(&gCurrOpClassID); }
295
296private:
Brian Salomon25a88092016-12-01 09:36:50 -0500297 void joinBounds(const GrOp& that) {
bsalomon88cf17d2016-07-08 06:40:56 -0700298 if (that.hasAABloat()) {
299 fBoundsFlags |= kAABloat_BoundsFlag;
300 }
301 if (that.hasZeroArea()) {
302 fBoundsFlags |= kZeroArea_BoundsFlag;
303 }
304 return fBounds.joinPossiblyEmptyRect(that.fBounds);
305 }
306
Herb Derbye25c3002020-10-27 15:57:27 -0400307 virtual CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000308 return CombineResult::kCannotCombine;
309 }
bsalomonabd30f52015-08-13 13:34:48 -0700310
Robert Phillips8053c972019-11-21 10:44:53 -0500311 // TODO: the parameters to onPrePrepare mirror GrOpFlushState::OpArgs - fuse the two?
312 virtual void onPrePrepare(GrRecordingContext*,
Adlai Hollere2296f72020-11-19 13:41:26 -0500313 const GrSurfaceProxyView& writeView,
Robert Phillips8053c972019-11-21 10:44:53 -0500314 GrAppliedClip*,
John Stiles52cb1d02021-06-02 11:58:05 -0400315 const GrDstProxyView&,
Greg Daniel42dbca52020-11-20 10:22:43 -0500316 GrXferBarrierFlags renderPassXferBarriers,
317 GrLoadOp colorLoadOp) = 0;
Brian Salomon742e31d2016-12-07 17:06:19 -0500318 virtual void onPrepare(GrOpFlushState*) = 0;
Brian Salomon588cec72018-11-14 13:56:37 -0500319 // If this op is chained then chainBounds is the union of the bounds of all ops in the chain.
320 // Otherwise, this op's bounds.
321 virtual void onExecute(GrOpFlushState*, const SkRect& chainBounds) = 0;
John Stilesaf366522020-08-13 09:57:34 -0400322#if GR_TEST_UTILS
323 virtual SkString onDumpInfo() const { return SkString(); }
324#endif
bsalomon53469832015-08-18 09:20:09 -0700325
Mike Klein0ec1c572018-12-04 11:52:51 -0500326 static uint32_t GenID(std::atomic<uint32_t>* idCounter) {
Adlai Holler4888cda2020-11-06 16:37:37 -0500327 uint32_t id = idCounter->fetch_add(1, std::memory_order_relaxed);
Mike Klein0ec1c572018-12-04 11:52:51 -0500328 if (id == 0) {
Ben Wagnerb4aab9a2017-08-16 10:53:04 -0400329 SK_ABORT("This should never wrap as it should only be called once for each GrOp "
Adlai Holler4888cda2020-11-06 16:37:37 -0500330 "subclass.");
bsalomonabd30f52015-08-13 13:34:48 -0700331 }
332 return id;
333 }
334
Greg Daniel5faf4742019-10-01 15:14:44 -0400335 void setBoundsFlags(HasAABloat aabloat, IsHairline zeroArea) {
bsalomon88cf17d2016-07-08 06:40:56 -0700336 fBoundsFlags = 0;
337 fBoundsFlags |= (HasAABloat::kYes == aabloat) ? kAABloat_BoundsFlag : 0;
Greg Daniel5faf4742019-10-01 15:14:44 -0400338 fBoundsFlags |= (IsHairline ::kYes == zeroArea) ? kZeroArea_BoundsFlag : 0;
bsalomon88cf17d2016-07-08 06:40:56 -0700339 }
340
bsalomonabd30f52015-08-13 13:34:48 -0700341 enum {
Brian Salomon25a88092016-12-01 09:36:50 -0500342 kIllegalOpID = 0,
bsalomonabd30f52015-08-13 13:34:48 -0700343 };
344
bsalomon88cf17d2016-07-08 06:40:56 -0700345 enum BoundsFlags {
346 kAABloat_BoundsFlag = 0x1,
347 kZeroArea_BoundsFlag = 0x2,
348 SkDEBUGCODE(kUninitialized_BoundsFlag = 0x4)
349 };
350
Adlai Holler4888cda2020-11-06 16:37:37 -0500351 Owner fNextInChain{nullptr};
Brian Salomon588cec72018-11-14 13:56:37 -0500352 GrOp* fPrevInChain = nullptr;
bsalomon88cf17d2016-07-08 06:40:56 -0700353 const uint16_t fClassID;
354 uint16_t fBoundsFlags;
355
Brian Salomon25a88092016-12-01 09:36:50 -0500356 static uint32_t GenOpID() { return GenID(&gCurrOpUniqueID); }
Brian Salomond25f5bc2018-08-08 11:25:17 -0400357 mutable uint32_t fUniqueID = SK_InvalidUniqueID;
bsalomon88cf17d2016-07-08 06:40:56 -0700358 SkRect fBounds;
359
Mike Klein0ec1c572018-12-04 11:52:51 -0500360 static std::atomic<uint32_t> gCurrOpUniqueID;
361 static std::atomic<uint32_t> gCurrOpClassID;
bsalomonabd30f52015-08-13 13:34:48 -0700362};
363
joshualitt4d8da812015-01-28 12:53:54 -0800364#endif