reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 2 | * Copyright 2019 Google Inc. |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 8 | #ifndef GrOpsTask_DEFINED |
| 9 | #define GrOpsTask_DEFINED |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkMatrix.h" |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 12 | #include "include/core/SkRefCnt.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "include/core/SkStrokeRec.h" |
| 14 | #include "include/core/SkTypes.h" |
Robert Phillips | b7bfbc2 | 2020-07-01 12:55:01 -0400 | [diff] [blame] | 15 | #include "include/gpu/GrRecordingContext.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 16 | #include "include/private/SkTArray.h" |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 17 | #include "include/private/SkTDArray.h" |
Ben Wagner | 729a23f | 2019-05-17 16:29:34 -0400 | [diff] [blame] | 18 | #include "src/core/SkArenaAlloc.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 19 | #include "src/core/SkClipStack.h" |
| 20 | #include "src/core/SkStringUtils.h" |
| 21 | #include "src/core/SkTLazy.h" |
| 22 | #include "src/gpu/GrAppliedClip.h" |
| 23 | #include "src/gpu/GrPathRendering.h" |
| 24 | #include "src/gpu/GrPrimitiveProcessor.h" |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 25 | #include "src/gpu/GrRenderTask.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 26 | #include "src/gpu/ops/GrDrawOp.h" |
| 27 | #include "src/gpu/ops/GrOp.h" |
Scroggo | 97c88c2 | 2011-05-11 14:05:25 +0000 | [diff] [blame] | 28 | |
joshualitt | 086cee1 | 2016-01-12 06:45:24 -0800 | [diff] [blame] | 29 | class GrAuditTrail; |
Greg Daniel | f21bf9e | 2019-08-22 20:12:20 +0000 | [diff] [blame] | 30 | class GrCaps; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 31 | class GrClearOp; |
| 32 | class GrGpuBuffer; |
Robert Phillips | c7635fa | 2016-10-28 13:25:24 -0400 | [diff] [blame] | 33 | class GrRenderTargetProxy; |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 34 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 35 | class GrOpsTask : public GrRenderTask { |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 36 | private: |
Greg Daniel | 524e28b | 2019-11-01 11:48:53 -0400 | [diff] [blame] | 37 | using DstProxyView = GrXferProcessor::DstProxyView; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 38 | |
bsalomon@google.com | f660187 | 2012-08-28 21:11:35 +0000 | [diff] [blame] | 39 | public: |
Michael Ludwig | 28b0c5d | 2019-12-19 14:51:00 -0500 | [diff] [blame] | 40 | // The Arenas must outlive the GrOpsTask, either by preserving the context that owns |
Michael Ludwig | cb10e4d | 2019-12-12 13:59:20 -0500 | [diff] [blame] | 41 | // the pool, or by moving the pool to the DDL that takes over the GrOpsTask. |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame] | 42 | GrOpsTask(GrDrawingManager*, GrRecordingContext::Arenas, GrSurfaceProxyView, GrAuditTrail*); |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 43 | ~GrOpsTask() override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 44 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 45 | GrOpsTask* asOpsTask() override { return this; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 46 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 47 | bool isEmpty() const { return fOpChains.empty(); } |
Robert Phillips | f5442bb | 2017-04-17 14:18:34 -0400 | [diff] [blame] | 48 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 49 | /** |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 50 | * Empties the draw buffer of any queued up draws. |
| 51 | */ |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame] | 52 | void endFlush(GrDrawingManager*) override; |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 53 | |
Robert Phillips | 29f3854 | 2019-10-16 09:20:25 -0400 | [diff] [blame] | 54 | void onPrePrepare(GrRecordingContext*) override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 55 | /** |
bsalomon | dc43898 | 2016-08-31 11:53:49 -0700 | [diff] [blame] | 56 | * Together these two functions flush all queued up draws to GrCommandBuffer. The return value |
Brian Salomon | 1e41f4a | 2016-12-07 15:05:04 -0500 | [diff] [blame] | 57 | * of executeOps() indicates whether any commands were actually issued to the GPU. |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 58 | */ |
Brian Osman | 407b342 | 2017-08-22 15:01:32 -0400 | [diff] [blame] | 59 | void onPrepare(GrOpFlushState* flushState) override; |
| 60 | bool onExecute(GrOpFlushState* flushState) override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 61 | |
Michael Ludwig | fcdd061 | 2019-11-25 08:34:31 -0500 | [diff] [blame] | 62 | void addSampledTexture(GrSurfaceProxy* proxy) { |
| 63 | // This function takes a GrSurfaceProxy because all subsequent uses of the proxy do not |
| 64 | // require the specifics of GrTextureProxy, so this avoids a number of unnecessary virtual |
| 65 | // asTextureProxy() calls. However, sampling the proxy implicitly requires that the proxy |
| 66 | // be a texture. Eventually, when proxies are a unified type with flags, this can just |
| 67 | // assert that capability. |
| 68 | SkASSERT(proxy->asTextureProxy()); |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 69 | fSampledProxies.push_back(proxy); |
| 70 | } |
| 71 | |
Adlai Holler | abe4518 | 2020-11-17 09:22:13 -0500 | [diff] [blame] | 72 | void addOp(GrDrawingManager*, GrOp::Owner, GrTextureResolveManager, const GrCaps&); |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 73 | |
Adlai Holler | abe4518 | 2020-11-17 09:22:13 -0500 | [diff] [blame] | 74 | void addDrawOp(GrDrawingManager*, GrOp::Owner, const GrProcessorSet::Analysis&, |
| 75 | GrAppliedClip&&, const DstProxyView&, GrTextureResolveManager, const GrCaps&); |
robertphillips | 9199a9f | 2016-07-13 07:48:43 -0700 | [diff] [blame] | 76 | |
Robert Phillips | 380b90c | 2017-08-30 07:41:07 -0400 | [diff] [blame] | 77 | void discard(); |
| 78 | |
Robert Phillips | 44e2c5f | 2020-04-14 13:00:04 -0400 | [diff] [blame] | 79 | #ifdef SK_DEBUG |
Robert Phillips | 44e2c5f | 2020-04-14 13:00:04 -0400 | [diff] [blame] | 80 | int numClips() const override { return fNumClips; } |
| 81 | void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const override; |
| 82 | #endif |
Robert Phillips | c84c030 | 2017-05-08 15:35:11 -0400 | [diff] [blame] | 83 | |
Robert Phillips | 438d986 | 2019-11-14 12:46:05 -0500 | [diff] [blame] | 84 | #if GR_TEST_UTILS |
John Stiles | 1e0136e | 2020-08-12 18:44:00 -0400 | [diff] [blame] | 85 | void dump(bool printDependencies) const override; |
| 86 | const char* name() const final { return "Ops"; } |
Robert Phillips | 438d986 | 2019-11-14 12:46:05 -0500 | [diff] [blame] | 87 | int numOpChains() const { return fOpChains.count(); } |
| 88 | const GrOp* getChain(int index) const { return fOpChains[index].head(); } |
| 89 | #endif |
| 90 | |
Brian Salomon | 1354048 | 2018-07-09 10:31:47 -0400 | [diff] [blame] | 91 | private: |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 92 | bool isNoOp() const { |
Chris Dalton | a43e2d2 | 2019-08-30 01:14:33 -0600 | [diff] [blame] | 93 | // TODO: GrLoadOp::kDiscard (i.e., storing a discard) should also be grounds for skipping |
| 94 | // execution. We currently don't because of Vulkan. See http://skbug.com/9373. |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 95 | // |
| 96 | // TODO: We should also consider stencil load/store here. We get away with it for now |
| 97 | // because we never discard stencil buffers. |
Chris Dalton | a43e2d2 | 2019-08-30 01:14:33 -0600 | [diff] [blame] | 98 | return fOpChains.empty() && GrLoadOp::kLoad == fColorLoadOp; |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 99 | } |
| 100 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 101 | void deleteOps(); |
Robert Phillips | 9313aa7 | 2019-04-09 18:41:27 -0400 | [diff] [blame] | 102 | |
Chris Dalton | 674f77a | 2019-09-30 20:49:39 -0600 | [diff] [blame] | 103 | enum class StencilContent { |
| 104 | kDontCare, |
| 105 | kUserBitsCleared, // User bits: cleared |
| 106 | // Clip bit: don't care (Ganesh always pre-clears the clip bit.) |
| 107 | kPreserved |
| 108 | }; |
| 109 | |
| 110 | // Lets the caller specify what the content of the stencil buffer should be at the beginning |
| 111 | // of the render pass. |
| 112 | // |
| 113 | // When requesting kClear: Tilers will load the stencil buffer with a "clear" op; non-tilers |
| 114 | // will clear the stencil on first load, and then preserve it on subsequent loads. (Preserving |
| 115 | // works because renderTargetContexts are required to leave the user bits in a cleared state |
| 116 | // once finished.) |
| 117 | // |
| 118 | // NOTE: initialContent must not be kClear if caps.performStencilClearsAsDraws() is true. |
| 119 | void setInitialStencilContent(StencilContent initialContent) { |
| 120 | fInitialStencilContent = initialContent; |
| 121 | } |
| 122 | |
Brian Salomon | 1aa1f5f | 2020-12-11 17:25:17 -0500 | [diff] [blame] | 123 | // If a surfaceDrawContext splits its opsTask, it uses this method to guarantee stencil values |
Chris Dalton | 674f77a | 2019-09-30 20:49:39 -0600 | [diff] [blame] | 124 | // get preserved across its split tasks. |
| 125 | void setMustPreserveStencil() { fMustPreserveStencil = true; } |
| 126 | |
Brian Salomon | 0263bff | 2020-12-16 08:41:39 -0500 | [diff] [blame] | 127 | // Must only be called if native color buffer clearing is enabled. |
| 128 | void setColorLoadOp(GrLoadOp op, std::array<float, 4> color = {0, 0, 0, 0}); |
| 129 | |
| 130 | enum class CanDiscardPreviousOps : bool { |
| 131 | kYes = true, |
| 132 | kNo = false |
| 133 | }; |
| 134 | |
| 135 | // Perform book-keeping for a fullscreen clear, regardless of how the clear is implemented later |
| 136 | // (i.e. setColorLoadOp(), adding a ClearOp, or adding a GrFillRectOp that covers the device). |
| 137 | // Returns true if the clear can be converted into a load op (barring device caps). |
| 138 | bool resetForFullscreenClear(CanDiscardPreviousOps); |
| 139 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 140 | class OpChain { |
| 141 | public: |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 142 | OpChain(GrOp::Owner, GrProcessorSet::Analysis, GrAppliedClip*, const DstProxyView*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 143 | ~OpChain() { |
| 144 | // The ops are stored in a GrMemoryPool and must be explicitly deleted via the pool. |
| 145 | SkASSERT(fList.empty()); |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 146 | } |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 147 | |
John Stiles | 48025a0 | 2020-07-27 10:33:50 -0400 | [diff] [blame] | 148 | OpChain(const OpChain&) = delete; |
| 149 | OpChain& operator=(const OpChain&) = delete; |
| 150 | OpChain(OpChain&&) = default; |
| 151 | OpChain& operator=(OpChain&&) = default; |
| 152 | |
Chris Dalton | 1706cbf | 2019-05-21 19:35:29 -0600 | [diff] [blame] | 153 | void visitProxies(const GrOp::VisitProxyFunc&) const; |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 154 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 155 | GrOp* head() const { return fList.head(); } |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 156 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 157 | GrAppliedClip* appliedClip() const { return fAppliedClip; } |
Greg Daniel | 524e28b | 2019-11-01 11:48:53 -0400 | [diff] [blame] | 158 | const DstProxyView& dstProxyView() const { return fDstProxyView; } |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 159 | const SkRect& bounds() const { return fBounds; } |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 160 | |
Herb Derby | e32e1ab | 2020-10-27 10:29:46 -0400 | [diff] [blame] | 161 | // Deletes all the ops in the chain. |
| 162 | void deleteOps(); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 163 | |
| 164 | // Attempts to move the ops from the passed chain to this chain at the head. Also attempts |
| 165 | // to merge ops between the chains. Upon success the passed chain is empty. |
| 166 | // Fails when the chains aren't of the same op type, have different clips or dst proxies. |
Michael Ludwig | 28b0c5d | 2019-12-19 14:51:00 -0500 | [diff] [blame] | 167 | bool prependChain(OpChain*, const GrCaps&, GrRecordingContext::Arenas*, GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 168 | |
| 169 | // Attempts to add 'op' to this chain either by merging or adding to the tail. Returns |
| 170 | // 'op' to the caller upon failure, otherwise null. Fails when the op and chain aren't of |
| 171 | // the same op type, have different clips or dst proxies. |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 172 | GrOp::Owner appendOp(GrOp::Owner op, GrProcessorSet::Analysis, |
| 173 | const DstProxyView*, const GrAppliedClip*, const GrCaps&, |
| 174 | GrRecordingContext::Arenas*, GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 175 | |
Greg Daniel | 15ecdf9 | 2019-08-30 15:35:23 -0400 | [diff] [blame] | 176 | void setSkipExecuteFlag() { fSkipExecute = true; } |
| 177 | bool shouldExecute() const { |
| 178 | return SkToBool(this->head()) && !fSkipExecute; |
| 179 | } |
| 180 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 181 | private: |
| 182 | class List { |
| 183 | public: |
| 184 | List() = default; |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 185 | List(GrOp::Owner); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 186 | List(List&&); |
| 187 | List& operator=(List&& that); |
| 188 | |
| 189 | bool empty() const { return !SkToBool(fHead); } |
| 190 | GrOp* head() const { return fHead.get(); } |
| 191 | GrOp* tail() const { return fTail; } |
| 192 | |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 193 | GrOp::Owner popHead(); |
| 194 | GrOp::Owner removeOp(GrOp* op); |
| 195 | void pushHead(GrOp::Owner op); |
| 196 | void pushTail(GrOp::Owner); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 197 | |
| 198 | void validate() const; |
| 199 | |
| 200 | private: |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 201 | GrOp::Owner fHead{nullptr}; |
| 202 | GrOp* fTail{nullptr}; |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 203 | }; |
| 204 | |
| 205 | void validate() const; |
| 206 | |
Greg Daniel | 524e28b | 2019-11-01 11:48:53 -0400 | [diff] [blame] | 207 | bool tryConcat(List*, GrProcessorSet::Analysis, const DstProxyView&, const GrAppliedClip*, |
Michael Ludwig | 28b0c5d | 2019-12-19 14:51:00 -0500 | [diff] [blame] | 208 | const SkRect& bounds, const GrCaps&, GrRecordingContext::Arenas*, |
Michael Ludwig | d0840ec | 2019-12-12 09:48:38 -0500 | [diff] [blame] | 209 | GrAuditTrail*); |
Michael Ludwig | 28b0c5d | 2019-12-19 14:51:00 -0500 | [diff] [blame] | 210 | static List DoConcat(List, List, const GrCaps&, GrRecordingContext::Arenas*, GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 211 | |
| 212 | List fList; |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 213 | GrProcessorSet::Analysis fProcessorAnalysis; |
Greg Daniel | 524e28b | 2019-11-01 11:48:53 -0400 | [diff] [blame] | 214 | DstProxyView fDstProxyView; |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 215 | GrAppliedClip* fAppliedClip; |
| 216 | SkRect fBounds; |
Greg Daniel | 15ecdf9 | 2019-08-30 15:35:23 -0400 | [diff] [blame] | 217 | |
| 218 | // We set this flag to true if any of the ops' proxies fail to instantiate so that we know |
| 219 | // not to try and draw the op. |
| 220 | bool fSkipExecute = false; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 221 | }; |
| 222 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 223 | |
| 224 | bool onIsUsed(GrSurfaceProxy*) const override; |
| 225 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 226 | void handleInternalAllocationFailure() override; |
Greg Daniel | aa3dfbe | 2018-01-29 10:34:25 -0500 | [diff] [blame] | 227 | |
Robert Phillips | d375dbf | 2017-09-14 12:45:25 -0400 | [diff] [blame] | 228 | void gatherProxyIntervals(GrResourceAllocator*) const override; |
| 229 | |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 230 | void recordOp(GrOp::Owner, GrProcessorSet::Analysis, GrAppliedClip*, |
Adlai Holler | abe4518 | 2020-11-17 09:22:13 -0500 | [diff] [blame] | 231 | const DstProxyView*, const GrCaps&); |
Brian Salomon | 2790c52 | 2016-12-09 16:32:23 -0500 | [diff] [blame] | 232 | |
Robert Phillips | ee68365 | 2017-04-26 11:53:10 -0400 | [diff] [blame] | 233 | void forwardCombine(const GrCaps&); |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 234 | |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame] | 235 | ExpectedOutcome onMakeClosed(const GrCaps& caps, SkIRect* targetUpdateBounds) override; |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 236 | |
Robert Phillips | 089b7c9 | 2020-08-12 11:57:07 -0400 | [diff] [blame] | 237 | friend class OpsTaskTestingAccess; |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 238 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 239 | // The RTC and OpsTask have to work together to handle buffer clears. In most cases, buffer |
| 240 | // clearing can be done natively, in which case the op list's load ops are sufficient. In other |
| 241 | // cases, draw ops must be used, which makes the RTC the best place for those decisions. This, |
| 242 | // however, requires that the RTC be able to coordinate with the op list to achieve similar ends |
Brian Salomon | eebe735 | 2020-12-09 16:37:04 -0500 | [diff] [blame] | 243 | friend class GrSurfaceDrawContext; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 244 | |
Michael Ludwig | 28b0c5d | 2019-12-19 14:51:00 -0500 | [diff] [blame] | 245 | // This is a backpointer to the Arenas that holds the memory for this GrOpsTask's ops. In the |
| 246 | // DDL case, the Arenas must have been detached from the original recording context and moved |
| 247 | // into the owning DDL. |
| 248 | GrRecordingContext::Arenas fArenas; |
| 249 | GrAuditTrail* fAuditTrail; |
Brian Salomon | f1c9eae | 2020-05-01 15:00:34 -0400 | [diff] [blame] | 250 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 251 | GrLoadOp fColorLoadOp = GrLoadOp::kLoad; |
Brian Salomon | 07bc9a2 | 2020-12-02 13:37:16 -0500 | [diff] [blame] | 252 | std::array<float, 4> fLoadClearColor = {0, 0, 0, 0}; |
Chris Dalton | 674f77a | 2019-09-30 20:49:39 -0600 | [diff] [blame] | 253 | StencilContent fInitialStencilContent = StencilContent::kDontCare; |
| 254 | bool fMustPreserveStencil = false; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 255 | |
Brian Salomon | 3b8486a | 2020-04-21 12:43:26 -0400 | [diff] [blame] | 256 | uint32_t fLastClipStackGenID = SK_InvalidUniqueID; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 257 | SkIRect fLastDevClipBounds; |
John Stiles | 9e8f484 | 2020-07-09 11:30:05 -0400 | [diff] [blame] | 258 | int fLastClipNumAnalyticElements; |
csmartdalton | 7cdda99 | 2016-11-01 07:03:03 -0700 | [diff] [blame] | 259 | |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 260 | GrXferBarrierFlags fRenderPassXferBarriers = GrXferBarrierFlags::kNone; |
Greg Daniel | 9a18b08 | 2020-08-14 14:03:50 -0400 | [diff] [blame] | 261 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 262 | // For ops/opsTask we have mean: 5 stdDev: 28 |
John Stiles | 48025a0 | 2020-07-27 10:33:50 -0400 | [diff] [blame] | 263 | SkSTArray<25, OpChain> fOpChains; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 264 | |
Robert Phillips | f6d7eb1 | 2017-04-26 14:55:34 -0400 | [diff] [blame] | 265 | // MDB TODO: 4096 for the first allocation of the clip space will be huge overkill. |
| 266 | // Gather statistics to determine the correct size. |
Herb Derby | 6e2c56f | 2020-08-01 16:26:04 -0400 | [diff] [blame] | 267 | SkArenaAllocWithReset fClipAllocator{4096}; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 268 | SkDEBUGCODE(int fNumClips;) |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 269 | |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 270 | // TODO: We could look into this being a set if we find we're adding a lot of duplicates that is |
| 271 | // causing slow downs. |
Michael Ludwig | fcdd061 | 2019-11-25 08:34:31 -0500 | [diff] [blame] | 272 | SkTArray<GrSurfaceProxy*, true> fSampledProxies; |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame] | 273 | |
| 274 | SkRect fTotalBounds = SkRect::MakeEmpty(); |
Greg Daniel | 94ed83f | 2019-09-27 13:05:43 -0400 | [diff] [blame] | 275 | SkIRect fClippedContentBounds = SkIRect::MakeEmpty(); |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 276 | }; |
| 277 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 278 | #endif |