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 | |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 8 | #ifndef OpsTask_DEFINED |
| 9 | #define OpsTask_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" |
Brian Osman | a5842bc | 2021-05-11 13:41:46 -0400 | [diff] [blame] | 13 | #include "include/core/SkSpan.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 14 | #include "include/core/SkStrokeRec.h" |
| 15 | #include "include/core/SkTypes.h" |
Robert Phillips | b7bfbc2 | 2020-07-01 12:55:01 -0400 | [diff] [blame] | 16 | #include "include/gpu/GrRecordingContext.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 17 | #include "include/private/SkTArray.h" |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 18 | #include "include/private/SkTDArray.h" |
Ben Wagner | 729a23f | 2019-05-17 16:29:34 -0400 | [diff] [blame] | 19 | #include "src/core/SkArenaAlloc.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 20 | #include "src/core/SkClipStack.h" |
| 21 | #include "src/core/SkStringUtils.h" |
| 22 | #include "src/core/SkTLazy.h" |
| 23 | #include "src/gpu/GrAppliedClip.h" |
John Stiles | 87960de | 2021-06-03 16:44:53 -0400 | [diff] [blame] | 24 | #include "src/gpu/GrDstProxyView.h" |
Robert Phillips | 787fd9d | 2021-03-22 14:48:09 -0400 | [diff] [blame] | 25 | #include "src/gpu/GrGeometryProcessor.h" |
Robert Phillips | 06273bc | 2021-08-11 15:43:50 -0400 | [diff] [blame] | 26 | #include "src/gpu/GrProcessorSet.h" |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 27 | #include "src/gpu/GrRenderTask.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 28 | #include "src/gpu/ops/GrOp.h" |
Scroggo | 97c88c2 | 2011-05-11 14:05:25 +0000 | [diff] [blame] | 29 | |
joshualitt | 086cee1 | 2016-01-12 06:45:24 -0800 | [diff] [blame] | 30 | class GrAuditTrail; |
Greg Daniel | f21bf9e | 2019-08-22 20:12:20 +0000 | [diff] [blame] | 31 | class GrCaps; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 32 | class GrClearOp; |
| 33 | class GrGpuBuffer; |
Robert Phillips | c7635fa | 2016-10-28 13:25:24 -0400 | [diff] [blame] | 34 | class GrRenderTargetProxy; |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 35 | class OpsTaskTestingAccess; |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 36 | |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 37 | namespace skgpu::v1 { |
| 38 | |
| 39 | class SurfaceDrawContext; |
| 40 | |
| 41 | class OpsTask : public GrRenderTask { |
bsalomon@google.com | f660187 | 2012-08-28 21:11:35 +0000 | [diff] [blame] | 42 | public: |
Herb Derby | 0b1228d | 2021-04-05 18:38:35 -0400 | [diff] [blame] | 43 | // Manage the arenas life time by maintaining are reference to it. |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 44 | OpsTask(GrDrawingManager*, GrSurfaceProxyView, GrAuditTrail*, sk_sp<GrArenas>); |
| 45 | ~OpsTask() override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 46 | |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 47 | OpsTask* asOpsTask() override { return this; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 48 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 49 | bool isEmpty() const { return fOpChains.empty(); } |
Chris Dalton | 5dfb3f4 | 2021-04-30 17:16:12 -0600 | [diff] [blame] | 50 | bool usesMSAASurface() const { return fUsesMSAASurface; } |
Greg Daniel | 0b04b6b | 2021-06-24 19:19:00 -0400 | [diff] [blame] | 51 | GrXferBarrierFlags renderPassXferBarriers() const { return fRenderPassXferBarriers; } |
Robert Phillips | f5442bb | 2017-04-17 14:18:34 -0400 | [diff] [blame] | 52 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 53 | /** |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 54 | * Empties the draw buffer of any queued up draws. |
| 55 | */ |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame] | 56 | void endFlush(GrDrawingManager*) override; |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 57 | |
Robert Phillips | 29f3854 | 2019-10-16 09:20:25 -0400 | [diff] [blame] | 58 | void onPrePrepare(GrRecordingContext*) override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 59 | /** |
bsalomon | dc43898 | 2016-08-31 11:53:49 -0700 | [diff] [blame] | 60 | * Together these two functions flush all queued up draws to GrCommandBuffer. The return value |
Adlai Holler | 93439d9 | 2021-01-26 09:20:39 -0500 | [diff] [blame] | 61 | * of onExecute() indicates whether any commands were actually issued to the GPU. |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 62 | */ |
Brian Osman | 407b342 | 2017-08-22 15:01:32 -0400 | [diff] [blame] | 63 | void onPrepare(GrOpFlushState* flushState) override; |
| 64 | bool onExecute(GrOpFlushState* flushState) override; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 65 | |
Michael Ludwig | fcdd061 | 2019-11-25 08:34:31 -0500 | [diff] [blame] | 66 | void addSampledTexture(GrSurfaceProxy* proxy) { |
| 67 | // This function takes a GrSurfaceProxy because all subsequent uses of the proxy do not |
| 68 | // require the specifics of GrTextureProxy, so this avoids a number of unnecessary virtual |
| 69 | // asTextureProxy() calls. However, sampling the proxy implicitly requires that the proxy |
| 70 | // be a texture. Eventually, when proxies are a unified type with flags, this can just |
| 71 | // assert that capability. |
| 72 | SkASSERT(proxy->asTextureProxy()); |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 73 | fSampledProxies.push_back(proxy); |
| 74 | } |
| 75 | |
Adlai Holler | abe4518 | 2020-11-17 09:22:13 -0500 | [diff] [blame] | 76 | void addOp(GrDrawingManager*, GrOp::Owner, GrTextureResolveManager, const GrCaps&); |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 77 | |
Chris Dalton | b4403a9 | 2021-05-27 14:59:27 -0600 | [diff] [blame] | 78 | void addDrawOp(GrDrawingManager*, GrOp::Owner, bool usesMSAA, const GrProcessorSet::Analysis&, |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 79 | GrAppliedClip&&, const GrDstProxyView&, GrTextureResolveManager, const GrCaps&); |
robertphillips | 9199a9f | 2016-07-13 07:48:43 -0700 | [diff] [blame] | 80 | |
Robert Phillips | 380b90c | 2017-08-30 07:41:07 -0400 | [diff] [blame] | 81 | void discard(); |
| 82 | |
Brian Salomon | 590f567 | 2020-12-16 11:44:47 -0500 | [diff] [blame] | 83 | enum class CanDiscardPreviousOps : bool { |
| 84 | kYes = true, |
| 85 | kNo = false |
| 86 | }; |
| 87 | |
| 88 | // Perform book-keeping for a fullscreen clear, regardless of how the clear is implemented later |
| 89 | // (i.e. setColorLoadOp(), adding a ClearOp, or adding a GrFillRectOp that covers the device). |
| 90 | // Returns true if the clear can be converted into a load op (barring device caps). |
| 91 | bool resetForFullscreenClear(CanDiscardPreviousOps); |
| 92 | |
| 93 | // Must only be called if native color buffer clearing is enabled. |
| 94 | void setColorLoadOp(GrLoadOp op, std::array<float, 4> color = {0, 0, 0, 0}); |
| 95 | |
Greg Daniel | 0b04b6b | 2021-06-24 19:19:00 -0400 | [diff] [blame] | 96 | // Returns whether the given opsTask can be appended at the end of this one. |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 97 | bool canMerge(const OpsTask*) const; |
Greg Daniel | 0b04b6b | 2021-06-24 19:19:00 -0400 | [diff] [blame] | 98 | |
Adlai Holler | 93439d9 | 2021-01-26 09:20:39 -0500 | [diff] [blame] | 99 | // Merge as many opsTasks as possible from the head of 'tasks'. They should all be |
| 100 | // renderPass compatible. Return the number of tasks merged into 'this'. |
| 101 | int mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks); |
| 102 | |
Robert Phillips | 44e2c5f | 2020-04-14 13:00:04 -0400 | [diff] [blame] | 103 | #ifdef SK_DEBUG |
Robert Phillips | 44e2c5f | 2020-04-14 13:00:04 -0400 | [diff] [blame] | 104 | int numClips() const override { return fNumClips; } |
Robert Phillips | 294723d | 2021-06-17 09:23:58 -0400 | [diff] [blame] | 105 | void visitProxies_debugOnly(const GrVisitProxyFunc&) const override; |
Robert Phillips | 44e2c5f | 2020-04-14 13:00:04 -0400 | [diff] [blame] | 106 | #endif |
Robert Phillips | c84c030 | 2017-05-08 15:35:11 -0400 | [diff] [blame] | 107 | |
Robert Phillips | 438d986 | 2019-11-14 12:46:05 -0500 | [diff] [blame] | 108 | #if GR_TEST_UTILS |
Robert Phillips | 047d5bb | 2021-01-08 13:39:19 -0500 | [diff] [blame] | 109 | void dump(const SkString& label, |
| 110 | SkString indent, |
| 111 | bool printDependencies, |
| 112 | bool close) const override; |
John Stiles | 1e0136e | 2020-08-12 18:44:00 -0400 | [diff] [blame] | 113 | const char* name() const final { return "Ops"; } |
Robert Phillips | 438d986 | 2019-11-14 12:46:05 -0500 | [diff] [blame] | 114 | int numOpChains() const { return fOpChains.count(); } |
| 115 | const GrOp* getChain(int index) const { return fOpChains[index].head(); } |
| 116 | #endif |
| 117 | |
Chris Dalton | 83420eb | 2021-06-23 18:47:09 -0600 | [diff] [blame] | 118 | protected: |
Chris Dalton | 674f77a | 2019-09-30 20:49:39 -0600 | [diff] [blame] | 119 | enum class StencilContent { |
| 120 | kDontCare, |
| 121 | kUserBitsCleared, // User bits: cleared |
| 122 | // Clip bit: don't care (Ganesh always pre-clears the clip bit.) |
| 123 | kPreserved |
| 124 | }; |
| 125 | |
| 126 | // Lets the caller specify what the content of the stencil buffer should be at the beginning |
| 127 | // of the render pass. |
| 128 | // |
| 129 | // When requesting kClear: Tilers will load the stencil buffer with a "clear" op; non-tilers |
| 130 | // will clear the stencil on first load, and then preserve it on subsequent loads. (Preserving |
John Stiles | 0fbc6a3 | 2021-06-04 14:40:57 -0400 | [diff] [blame] | 131 | // works because SurfaceDrawContexts are required to leave the user bits in a cleared state |
Chris Dalton | 674f77a | 2019-09-30 20:49:39 -0600 | [diff] [blame] | 132 | // once finished.) |
| 133 | // |
| 134 | // NOTE: initialContent must not be kClear if caps.performStencilClearsAsDraws() is true. |
| 135 | void setInitialStencilContent(StencilContent initialContent) { |
| 136 | fInitialStencilContent = initialContent; |
| 137 | } |
| 138 | |
Chris Dalton | 83420eb | 2021-06-23 18:47:09 -0600 | [diff] [blame] | 139 | void recordOp(GrOp::Owner, bool usesMSAA, GrProcessorSet::Analysis, GrAppliedClip*, |
| 140 | const GrDstProxyView*, const GrCaps&); |
| 141 | |
| 142 | ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override; |
| 143 | |
| 144 | private: |
Greg Daniel | 0b04b6b | 2021-06-24 19:19:00 -0400 | [diff] [blame] | 145 | bool isColorNoOp() const { |
Chris Dalton | 83420eb | 2021-06-23 18:47:09 -0600 | [diff] [blame] | 146 | // TODO: GrLoadOp::kDiscard (i.e., storing a discard) should also be grounds for skipping |
| 147 | // execution. We currently don't because of Vulkan. See http://skbug.com/9373. |
Chris Dalton | 83420eb | 2021-06-23 18:47:09 -0600 | [diff] [blame] | 148 | return fOpChains.empty() && GrLoadOp::kLoad == fColorLoadOp; |
| 149 | } |
| 150 | |
| 151 | void deleteOps(); |
| 152 | |
Brian Salomon | 1aa1f5f | 2020-12-11 17:25:17 -0500 | [diff] [blame] | 153 | // 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] | 154 | // get preserved across its split tasks. |
| 155 | void setMustPreserveStencil() { fMustPreserveStencil = true; } |
| 156 | |
Greg Daniel | 0b04b6b | 2021-06-24 19:19:00 -0400 | [diff] [blame] | 157 | // Prevents this opsTask from merging backward. This is used by DMSAA when a non-multisampled |
| 158 | // opsTask cannot be promoted to MSAA, or when we split a multisampled opsTask in order to |
| 159 | // resolve its texture. |
| 160 | void setCannotMergeBackward() { fCannotMergeBackward = true; } |
| 161 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 162 | class OpChain { |
| 163 | public: |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 164 | OpChain(GrOp::Owner, GrProcessorSet::Analysis, GrAppliedClip*, const GrDstProxyView*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 165 | ~OpChain() { |
| 166 | // The ops are stored in a GrMemoryPool and must be explicitly deleted via the pool. |
| 167 | SkASSERT(fList.empty()); |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 168 | } |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 169 | |
John Stiles | 48025a0 | 2020-07-27 10:33:50 -0400 | [diff] [blame] | 170 | OpChain(const OpChain&) = delete; |
| 171 | OpChain& operator=(const OpChain&) = delete; |
| 172 | OpChain(OpChain&&) = default; |
| 173 | OpChain& operator=(OpChain&&) = default; |
| 174 | |
Robert Phillips | 294723d | 2021-06-17 09:23:58 -0400 | [diff] [blame] | 175 | void visitProxies(const GrVisitProxyFunc&) const; |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 176 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 177 | GrOp* head() const { return fList.head(); } |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 178 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 179 | GrAppliedClip* appliedClip() const { return fAppliedClip; } |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 180 | const GrDstProxyView& dstProxyView() const { return fDstProxyView; } |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 181 | const SkRect& bounds() const { return fBounds; } |
Chris Dalton | 8816b93 | 2017-11-29 16:48:25 -0700 | [diff] [blame] | 182 | |
Herb Derby | e32e1ab | 2020-10-27 10:29:46 -0400 | [diff] [blame] | 183 | // Deletes all the ops in the chain. |
| 184 | void deleteOps(); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 185 | |
| 186 | // Attempts to move the ops from the passed chain to this chain at the head. Also attempts |
| 187 | // to merge ops between the chains. Upon success the passed chain is empty. |
| 188 | // Fails when the chains aren't of the same op type, have different clips or dst proxies. |
Chris Dalton | f8d75c6 | 2021-04-02 11:24:58 -0600 | [diff] [blame] | 189 | bool prependChain(OpChain*, const GrCaps&, SkArenaAlloc* opsTaskArena, GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 190 | |
| 191 | // Attempts to add 'op' to this chain either by merging or adding to the tail. Returns |
| 192 | // 'op' to the caller upon failure, otherwise null. Fails when the op and chain aren't of |
| 193 | // the same op type, have different clips or dst proxies. |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 194 | GrOp::Owner appendOp(GrOp::Owner op, GrProcessorSet::Analysis, const GrDstProxyView*, |
Chris Dalton | f8d75c6 | 2021-04-02 11:24:58 -0600 | [diff] [blame] | 195 | const GrAppliedClip*, const GrCaps&, SkArenaAlloc* opsTaskArena, |
| 196 | GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 197 | |
Greg Daniel | 15ecdf9 | 2019-08-30 15:35:23 -0400 | [diff] [blame] | 198 | bool shouldExecute() const { |
Adlai Holler | 19fd514 | 2021-03-08 10:19:30 -0700 | [diff] [blame] | 199 | return SkToBool(this->head()); |
Greg Daniel | 15ecdf9 | 2019-08-30 15:35:23 -0400 | [diff] [blame] | 200 | } |
| 201 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 202 | private: |
| 203 | class List { |
| 204 | public: |
| 205 | List() = default; |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 206 | List(GrOp::Owner); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 207 | List(List&&); |
| 208 | List& operator=(List&& that); |
| 209 | |
| 210 | bool empty() const { return !SkToBool(fHead); } |
| 211 | GrOp* head() const { return fHead.get(); } |
| 212 | GrOp* tail() const { return fTail; } |
| 213 | |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 214 | GrOp::Owner popHead(); |
| 215 | GrOp::Owner removeOp(GrOp* op); |
| 216 | void pushHead(GrOp::Owner op); |
| 217 | void pushTail(GrOp::Owner); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 218 | |
| 219 | void validate() const; |
| 220 | |
| 221 | private: |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 222 | GrOp::Owner fHead{nullptr}; |
| 223 | GrOp* fTail{nullptr}; |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 224 | }; |
| 225 | |
| 226 | void validate() const; |
| 227 | |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 228 | bool tryConcat(List*, GrProcessorSet::Analysis, const GrDstProxyView&, const GrAppliedClip*, |
Chris Dalton | f8d75c6 | 2021-04-02 11:24:58 -0600 | [diff] [blame] | 229 | const SkRect& bounds, const GrCaps&, SkArenaAlloc* opsTaskArena, |
Michael Ludwig | d0840ec | 2019-12-12 09:48:38 -0500 | [diff] [blame] | 230 | GrAuditTrail*); |
Chris Dalton | f8d75c6 | 2021-04-02 11:24:58 -0600 | [diff] [blame] | 231 | static List DoConcat(List, List, const GrCaps&, SkArenaAlloc* opsTaskArena, GrAuditTrail*); |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 232 | |
| 233 | List fList; |
Chris Dalton | 945ee65 | 2019-01-23 09:10:36 -0700 | [diff] [blame] | 234 | GrProcessorSet::Analysis fProcessorAnalysis; |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 235 | GrDstProxyView fDstProxyView; |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 236 | GrAppliedClip* fAppliedClip; |
| 237 | SkRect fBounds; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 238 | }; |
| 239 | |
Adlai Holler | e9ea414 | 2021-04-27 14:31:56 -0400 | [diff] [blame] | 240 | void onMakeSkippable() override; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 241 | |
| 242 | bool onIsUsed(GrSurfaceProxy*) const override; |
| 243 | |
Robert Phillips | d375dbf | 2017-09-14 12:45:25 -0400 | [diff] [blame] | 244 | void gatherProxyIntervals(GrResourceAllocator*) const override; |
| 245 | |
Robert Phillips | ee68365 | 2017-04-26 11:53:10 -0400 | [diff] [blame] | 246 | void forwardCombine(const GrCaps&); |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 247 | |
Adlai Holler | 9c3b6df | 2021-02-08 11:31:57 -0500 | [diff] [blame] | 248 | // Remove all ops, proxies, etc. Used in the merging algorithm when tasks can be skipped. |
| 249 | void reset(); |
| 250 | |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 251 | friend class ::OpsTaskTestingAccess; |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 252 | |
Robert Phillips | 4dca831 | 2021-07-28 15:13:20 -0400 | [diff] [blame] | 253 | // The SDC and OpsTask have to work together to handle buffer clears. In most cases, buffer |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 254 | // clearing can be done natively, in which case the op list's load ops are sufficient. In other |
Robert Phillips | 4dca831 | 2021-07-28 15:13:20 -0400 | [diff] [blame] | 255 | // cases, draw ops must be used, which makes the SDC the best place for those decisions. This, |
| 256 | // however, requires that the SDC be able to coordinate with the op list to achieve similar ends |
| 257 | friend class skgpu::v1::SurfaceDrawContext; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 258 | |
Chris Dalton | f8d75c6 | 2021-04-02 11:24:58 -0600 | [diff] [blame] | 259 | GrAuditTrail* fAuditTrail; |
Brian Salomon | f1c9eae | 2020-05-01 15:00:34 -0400 | [diff] [blame] | 260 | |
Chris Dalton | 2517ce3 | 2021-04-13 00:21:15 -0600 | [diff] [blame] | 261 | bool fUsesMSAASurface; |
Brian Salomon | 982127b | 2021-01-21 10:43:35 -0500 | [diff] [blame] | 262 | GrSwizzle fTargetSwizzle; |
| 263 | GrSurfaceOrigin fTargetOrigin; |
| 264 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 265 | GrLoadOp fColorLoadOp = GrLoadOp::kLoad; |
Brian Salomon | 07bc9a2 | 2020-12-02 13:37:16 -0500 | [diff] [blame] | 266 | std::array<float, 4> fLoadClearColor = {0, 0, 0, 0}; |
Chris Dalton | 674f77a | 2019-09-30 20:49:39 -0600 | [diff] [blame] | 267 | StencilContent fInitialStencilContent = StencilContent::kDontCare; |
| 268 | bool fMustPreserveStencil = false; |
Greg Daniel | 0b04b6b | 2021-06-24 19:19:00 -0400 | [diff] [blame] | 269 | bool fCannotMergeBackward = false; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 270 | |
Brian Salomon | 3b8486a | 2020-04-21 12:43:26 -0400 | [diff] [blame] | 271 | uint32_t fLastClipStackGenID = SK_InvalidUniqueID; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 272 | SkIRect fLastDevClipBounds; |
John Stiles | 9e8f484 | 2020-07-09 11:30:05 -0400 | [diff] [blame] | 273 | int fLastClipNumAnalyticElements; |
csmartdalton | 7cdda99 | 2016-11-01 07:03:03 -0700 | [diff] [blame] | 274 | |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 275 | GrXferBarrierFlags fRenderPassXferBarriers = GrXferBarrierFlags::kNone; |
Greg Daniel | 9a18b08 | 2020-08-14 14:03:50 -0400 | [diff] [blame] | 276 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 277 | // For ops/opsTask we have mean: 5 stdDev: 28 |
John Stiles | 48025a0 | 2020-07-27 10:33:50 -0400 | [diff] [blame] | 278 | SkSTArray<25, OpChain> fOpChains; |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 279 | |
Herb Derby | 0b1228d | 2021-04-05 18:38:35 -0400 | [diff] [blame] | 280 | sk_sp<GrArenas> fArenas; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 281 | SkDEBUGCODE(int fNumClips;) |
Brian Salomon | 54d212e | 2017-03-21 14:22:38 -0400 | [diff] [blame] | 282 | |
Greg Daniel | b20d7e5 | 2019-09-03 13:54:39 -0400 | [diff] [blame] | 283 | // TODO: We could look into this being a set if we find we're adding a lot of duplicates that is |
| 284 | // causing slow downs. |
Michael Ludwig | fcdd061 | 2019-11-25 08:34:31 -0500 | [diff] [blame] | 285 | SkTArray<GrSurfaceProxy*, true> fSampledProxies; |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame] | 286 | |
| 287 | SkRect fTotalBounds = SkRect::MakeEmpty(); |
Greg Daniel | 94ed83f | 2019-09-27 13:05:43 -0400 | [diff] [blame] | 288 | SkIRect fClippedContentBounds = SkIRect::MakeEmpty(); |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 289 | }; |
| 290 | |
Robert Phillips | 3e87a8e | 2021-08-25 13:22:24 -0400 | [diff] [blame] | 291 | } // namespace skgpu::v1 |
| 292 | |
| 293 | #endif // OpsTask_DEFINED |