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" |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 15 | #include "include/private/SkColorData.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; |
| 33 | class GrOpMemoryPool; |
Robert Phillips | c7635fa | 2016-10-28 13:25:24 -0400 | [diff] [blame] | 34 | class GrRenderTargetProxy; |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 35 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 36 | class GrOpsTask : public GrRenderTask { |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 37 | private: |
Robert Phillips | bb581ce | 2017-05-29 15:05:15 -0400 | [diff] [blame] | 38 | using DstProxy = GrXferProcessor::DstProxy; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 39 | |
bsalomon@google.com | f660187 | 2012-08-28 21:11:35 +0000 | [diff] [blame] | 40 | public: |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 41 | GrOpsTask(sk_sp<GrOpMemoryPool>, sk_sp<GrRenderTargetProxy>, GrAuditTrail*); |
| 42 | ~GrOpsTask() override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 43 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 44 | GrOpsTask* asOpsTask() override { return this; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 45 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 46 | bool isEmpty() const { return fOpChains.empty(); } |
Robert Phillips | f5442bb | 2017-04-17 14:18:34 -0400 | [diff] [blame] | 47 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 48 | /** |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 49 | * Empties the draw buffer of any queued up draws. |
| 50 | */ |
Chris Dalton | a84cacf | 2017-10-04 10:30:29 -0600 | [diff] [blame] | 51 | void endFlush() override; |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 52 | |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 53 | /** |
bsalomon | dc43898 | 2016-08-31 11:53:49 -0700 | [diff] [blame] | 54 | * 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] | 55 | * of executeOps() indicates whether any commands were actually issued to the GPU. |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 56 | */ |
Brian Osman | 407b342 | 2017-08-22 15:01:32 -0400 | [diff] [blame] | 57 | void onPrepare(GrOpFlushState* flushState) override; |
| 58 | bool onExecute(GrOpFlushState* flushState) override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 59 | |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 60 | void addSampledTexture(GrTextureProxy* proxy) { |
| 61 | fSampledProxies.push_back(proxy); |
| 62 | } |
| 63 | |
Chris Dalton | 0875512 | 2019-08-05 16:13:47 -0600 | [diff] [blame] | 64 | void addOp(std::unique_ptr<GrOp> op, GrTextureResolveManager textureResolveManager, |
| 65 | const GrCaps& caps) { |
| 66 | auto addDependency = [ textureResolveManager, &caps, this ] ( |
Greg Daniel | dcf9ca1 | 2019-08-27 14:30:21 -0400 | [diff] [blame] | 67 | GrTextureProxy* p, GrMipMapped mipmapped) { |
Chris Dalton | 0875512 | 2019-08-05 16:13:47 -0600 | [diff] [blame] | 68 | this->addDependency(p, mipmapped, textureResolveManager, caps); |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | op->visitProxies(addDependency); |
| 72 | |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 73 | this->recordOp(std::move(op), GrProcessorSet::EmptySetAnalysis(), nullptr, nullptr, caps); |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 74 | } |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 75 | |
Chris Dalton | 0875512 | 2019-08-05 16:13:47 -0600 | [diff] [blame] | 76 | void addWaitOp(std::unique_ptr<GrOp> op, GrTextureResolveManager textureResolveManager, |
| 77 | const GrCaps& caps) { |
| 78 | fHasWaitOp = true; |
| 79 | this->addOp(std::move(op), textureResolveManager, caps); |
Greg Daniel | cb32415 | 2019-02-25 11:36:53 -0500 | [diff] [blame] | 80 | } |
| 81 | |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 82 | void addDrawOp(std::unique_ptr<GrDrawOp> op, const GrProcessorSet::Analysis& processorAnalysis, |
Chris Dalton | 0875512 | 2019-08-05 16:13:47 -0600 | [diff] [blame] | 83 | GrAppliedClip&& clip, const DstProxy& dstProxy, |
| 84 | GrTextureResolveManager textureResolveManager, const GrCaps& caps) { |
| 85 | auto addDependency = [ textureResolveManager, &caps, this ] ( |
Greg Daniel | dcf9ca1 | 2019-08-27 14:30:21 -0400 | [diff] [blame] | 86 | GrTextureProxy* p, GrMipMapped mipmapped) { |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 87 | this->addSampledTexture(p); |
Chris Dalton | 0875512 | 2019-08-05 16:13:47 -0600 | [diff] [blame] | 88 | this->addDependency(p, mipmapped, textureResolveManager, caps); |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | op->visitProxies(addDependency); |
| 92 | clip.visitProxies(addDependency); |
Robert Phillips | 2739ab0 | 2018-07-27 07:35:55 -0400 | [diff] [blame] | 93 | if (dstProxy.proxy()) { |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 94 | this->addSampledTexture(dstProxy.proxy()); |
Chris Dalton | 7eb5c0f | 2019-05-23 15:15:47 -0600 | [diff] [blame] | 95 | addDependency(dstProxy.proxy(), GrMipMapped::kNo); |
Robert Phillips | 2739ab0 | 2018-07-27 07:35:55 -0400 | [diff] [blame] | 96 | } |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 97 | |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 98 | this->recordOp(std::move(op), processorAnalysis, clip.doesClip() ? &clip : nullptr, |
| 99 | &dstProxy, caps); |
Brian Salomon | 69868af | 2016-12-22 15:42:51 -0500 | [diff] [blame] | 100 | } |
robertphillips | 9199a9f | 2016-07-13 07:48:43 -0700 | [diff] [blame] | 101 | |
Robert Phillips | 380b90c | 2017-08-30 07:41:07 -0400 | [diff] [blame] | 102 | void discard(); |
| 103 | |
Robert Phillips | 2748391 | 2018-04-20 12:43:18 -0400 | [diff] [blame] | 104 | SkDEBUGCODE(void dump(bool printDependencies) const override;) |
Robert Phillips | c84c030 | 2017-05-08 15:35:11 -0400 | [diff] [blame] | 105 | SkDEBUGCODE(int numClips() const override { return fNumClips; }) |
Greg Daniel | dcf9ca1 | 2019-08-27 14:30:21 -0400 | [diff] [blame] | 106 | SkDEBUGCODE(void visitProxies_debugOnly(const VisitSurfaceProxyFunc&) const override;) |
Robert Phillips | c84c030 | 2017-05-08 15:35:11 -0400 | [diff] [blame] | 107 | |
Brian Salomon | 1354048 | 2018-07-09 10:31:47 -0400 | [diff] [blame] | 108 | private: |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 109 | bool isNoOp() const { |
Chris Dalton | a43e2d2 | 2019-08-30 01:14:33 -0600 | [diff] [blame] | 110 | // TODO: GrLoadOp::kDiscard (i.e., storing a discard) should also be grounds for skipping |
| 111 | // 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] | 112 | // |
| 113 | // TODO: We should also consider stencil load/store here. We get away with it for now |
| 114 | // because we never discard stencil buffers. |
Chris Dalton | a43e2d2 | 2019-08-30 01:14:33 -0600 | [diff] [blame] | 115 | return fOpChains.empty() && GrLoadOp::kLoad == fColorLoadOp; |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 116 | } |
| 117 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 118 | void deleteOps(); |
Robert Phillips | 9313aa7 | 2019-04-09 18:41:27 -0400 | [diff] [blame] | 119 | |
Michael Ludwig | 6e17f1d | 2019-05-15 14:00:20 +0000 | [diff] [blame] | 120 | // Must only be called if native stencil buffer clearing is enabled |
Chris Dalton | 6b98280 | 2019-06-27 13:53:46 -0600 | [diff] [blame] | 121 | void setStencilLoadOp(GrLoadOp op) { fStencilLoadOp = op; } |
Michael Ludwig | c39d0c8 | 2019-01-15 10:03:43 -0500 | [diff] [blame] | 122 | // Must only be called if native color buffer clearing is enabled. |
| 123 | void setColorLoadOp(GrLoadOp op, const SkPMColor4f& color); |
| 124 | // Sets the clear color to transparent black |
| 125 | void setColorLoadOp(GrLoadOp op) { |
| 126 | static const SkPMColor4f kDefaultClearColor = {0.f, 0.f, 0.f, 0.f}; |
| 127 | this->setColorLoadOp(op, kDefaultClearColor); |
| 128 | } |
| 129 | |
Chris Dalton | 6b98280 | 2019-06-27 13:53:46 -0600 | [diff] [blame] | 130 | enum class CanDiscardPreviousOps : bool { |
| 131 | kYes = true, |
| 132 | kNo = false |
| 133 | }; |
| 134 | |
Michael Ludwig | c39d0c8 | 2019-01-15 10:03:43 -0500 | [diff] [blame] | 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). |
Chris Dalton | 6b98280 | 2019-06-27 13:53:46 -0600 | [diff] [blame] | 138 | bool resetForFullscreenClear(CanDiscardPreviousOps); |
Michael Ludwig | c39d0c8 | 2019-01-15 10:03:43 -0500 | [diff] [blame] | 139 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 140 | class OpChain { |
| 141 | public: |
| 142 | OpChain(const OpChain&) = delete; |
| 143 | OpChain& operator=(const OpChain&) = delete; |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 144 | OpChain(std::unique_ptr<GrOp>, GrProcessorSet::Analysis, GrAppliedClip*, const DstProxy*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 145 | |
| 146 | ~OpChain() { |
| 147 | // The ops are stored in a GrMemoryPool and must be explicitly deleted via the pool. |
| 148 | SkASSERT(fList.empty()); |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 149 | } |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 150 | |
Chris Dalton | 1706cbf | 2019-05-21 19:35:29 -0600 | [diff] [blame] | 151 | void visitProxies(const GrOp::VisitProxyFunc&) const; |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 152 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 153 | GrOp* head() const { return fList.head(); } |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 154 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 155 | GrAppliedClip* appliedClip() const { return fAppliedClip; } |
| 156 | const DstProxy& dstProxy() const { return fDstProxy; } |
| 157 | const SkRect& bounds() const { return fBounds; } |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 158 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 159 | // Deletes all the ops in the chain via the pool. |
| 160 | void deleteOps(GrOpMemoryPool* pool); |
| 161 | |
| 162 | // Attempts to move the ops from the passed chain to this chain at the head. Also attempts |
| 163 | // to merge ops between the chains. Upon success the passed chain is empty. |
| 164 | // Fails when the chains aren't of the same op type, have different clips or dst proxies. |
| 165 | bool prependChain(OpChain*, const GrCaps&, GrOpMemoryPool*, GrAuditTrail*); |
| 166 | |
| 167 | // Attempts to add 'op' to this chain either by merging or adding to the tail. Returns |
| 168 | // 'op' to the caller upon failure, otherwise null. Fails when the op and chain aren't of |
| 169 | // the same op type, have different clips or dst proxies. |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 170 | std::unique_ptr<GrOp> appendOp(std::unique_ptr<GrOp> op, GrProcessorSet::Analysis, |
| 171 | const DstProxy*, const GrAppliedClip*, const GrCaps&, |
| 172 | GrOpMemoryPool*, GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 173 | |
Greg Daniel | 15ecdf9 | 2019-08-30 15:35:23 -0400 | [diff] [blame] | 174 | void setSkipExecuteFlag() { fSkipExecute = true; } |
| 175 | bool shouldExecute() const { |
| 176 | return SkToBool(this->head()) && !fSkipExecute; |
| 177 | } |
| 178 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 179 | private: |
| 180 | class List { |
| 181 | public: |
| 182 | List() = default; |
| 183 | List(std::unique_ptr<GrOp>); |
| 184 | List(List&&); |
| 185 | List& operator=(List&& that); |
| 186 | |
| 187 | bool empty() const { return !SkToBool(fHead); } |
| 188 | GrOp* head() const { return fHead.get(); } |
| 189 | GrOp* tail() const { return fTail; } |
| 190 | |
| 191 | std::unique_ptr<GrOp> popHead(); |
| 192 | std::unique_ptr<GrOp> removeOp(GrOp* op); |
| 193 | void pushHead(std::unique_ptr<GrOp> op); |
| 194 | void pushTail(std::unique_ptr<GrOp>); |
| 195 | |
| 196 | void validate() const; |
| 197 | |
| 198 | private: |
| 199 | std::unique_ptr<GrOp> fHead; |
| 200 | GrOp* fTail = nullptr; |
| 201 | }; |
| 202 | |
| 203 | void validate() const; |
| 204 | |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 205 | bool tryConcat(List*, GrProcessorSet::Analysis, const DstProxy&, const GrAppliedClip*, |
| 206 | const SkRect& bounds, const GrCaps&, GrOpMemoryPool*, GrAuditTrail*); |
Chris Dalton | 6f6ae6a | 2019-01-18 12:10:36 -0700 | [diff] [blame] | 207 | static List DoConcat(List, List, const GrCaps&, GrOpMemoryPool*, GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 208 | |
| 209 | List fList; |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 210 | GrProcessorSet::Analysis fProcessorAnalysis; |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 211 | DstProxy fDstProxy; |
| 212 | GrAppliedClip* fAppliedClip; |
| 213 | SkRect fBounds; |
Greg Daniel | 15ecdf9 | 2019-08-30 15:35:23 -0400 | [diff] [blame] | 214 | |
| 215 | // We set this flag to true if any of the ops' proxies fail to instantiate so that we know |
| 216 | // not to try and draw the op. |
| 217 | bool fSkipExecute = false; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 218 | }; |
| 219 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 220 | |
| 221 | bool onIsUsed(GrSurfaceProxy*) const override; |
| 222 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 223 | void handleInternalAllocationFailure() override; |
Greg Daniel | aa3dfbe | 2018-01-29 10:34:25 -0500 | [diff] [blame] | 224 | |
Robert Phillips | d375dbf | 2017-09-14 12:45:25 -0400 | [diff] [blame] | 225 | void gatherProxyIntervals(GrResourceAllocator*) const override; |
| 226 | |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 227 | void recordOp(std::unique_ptr<GrOp>, GrProcessorSet::Analysis, GrAppliedClip*, const DstProxy*, |
| 228 | const GrCaps& caps); |
Brian Salomon | 2790c52 | 2016-12-09 16:32:23 -0500 | [diff] [blame] | 229 | |
Robert Phillips | ee68365 | 2017-04-26 11:53:10 -0400 | [diff] [blame] | 230 | void forwardCombine(const GrCaps&); |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 231 | |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame^] | 232 | ExpectedOutcome onMakeClosed(const GrCaps& caps, SkIRect* targetUpdateBounds) override; |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 233 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 234 | friend class GrRenderTargetContextPriv; // for stencil clip state. TODO: this is invasive |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 235 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 236 | // The RTC and OpsTask have to work together to handle buffer clears. In most cases, buffer |
| 237 | // clearing can be done natively, in which case the op list's load ops are sufficient. In other |
| 238 | // cases, draw ops must be used, which makes the RTC the best place for those decisions. This, |
| 239 | // however, requires that the RTC be able to coordinate with the op list to achieve similar ends |
| 240 | friend class GrRenderTargetContext; |
| 241 | |
| 242 | // This is a backpointer to the GrOpMemoryPool that holds the memory for this GrOpsTask's ops. |
| 243 | // In the DDL case, these back pointers keep the DDL's GrOpMemoryPool alive as long as its |
| 244 | // constituent GrOpsTask survives. |
| 245 | sk_sp<GrOpMemoryPool> fOpMemoryPool; |
| 246 | GrAuditTrail* fAuditTrail; |
| 247 | |
| 248 | GrLoadOp fColorLoadOp = GrLoadOp::kLoad; |
| 249 | SkPMColor4f fLoadClearColor = SK_PMColor4fTRANSPARENT; |
| 250 | GrLoadOp fStencilLoadOp = GrLoadOp::kLoad; |
| 251 | |
| 252 | uint32_t fLastClipStackGenID; |
| 253 | SkIRect fLastDevClipBounds; |
| 254 | int fLastClipNumAnalyticFPs; |
csmartdalton | 7cdda99 | 2016-11-01 07:03:03 -0700 | [diff] [blame] | 255 | |
Greg Daniel | cb32415 | 2019-02-25 11:36:53 -0500 | [diff] [blame] | 256 | // We must track if we have a wait op so that we don't delete the op when we have a full clear. |
| 257 | bool fHasWaitOp = false;; |
| 258 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 259 | // For ops/opsTask we have mean: 5 stdDev: 28 |
| 260 | SkSTArray<25, OpChain, true> fOpChains; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 261 | |
Robert Phillips | f6d7eb1 | 2017-04-26 14:55:34 -0400 | [diff] [blame] | 262 | // MDB TODO: 4096 for the first allocation of the clip space will be huge overkill. |
| 263 | // Gather statistics to determine the correct size. |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 264 | SkArenaAlloc fClipAllocator{4096}; |
| 265 | SkDEBUGCODE(int fNumClips;) |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 266 | |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 267 | // TODO: We could look into this being a set if we find we're adding a lot of duplicates that is |
| 268 | // causing slow downs. |
| 269 | SkTArray<GrTextureProxy*, true> fSampledProxies; |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame^] | 270 | |
| 271 | SkRect fTotalBounds = SkRect::MakeEmpty(); |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 272 | }; |
| 273 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 274 | #endif |