robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 8 | #ifndef GrDrawingManager_DEFINED |
| 9 | #define GrDrawingManager_DEFINED |
| 10 | |
Robert Phillips | 15c9142 | 2019-05-07 16:54:48 -0400 | [diff] [blame] | 11 | #include <set> |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/core/SkSurface.h" |
| 13 | #include "include/private/SkTArray.h" |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame^] | 14 | #include "include/private/SkTHash.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 15 | #include "src/gpu/GrBufferAllocPool.h" |
| 16 | #include "src/gpu/GrDeferredUpload.h" |
| 17 | #include "src/gpu/GrPathRenderer.h" |
| 18 | #include "src/gpu/GrPathRendererChain.h" |
| 19 | #include "src/gpu/GrResourceCache.h" |
| 20 | #include "src/gpu/text/GrTextContext.h" |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 21 | |
Robert Phillips | d81379d | 2020-04-21 10:39:02 -0400 | [diff] [blame] | 22 | // Enabling this will print out which path renderers are being chosen |
| 23 | #define GR_PATH_RENDERER_SPEW 0 |
| 24 | |
Chris Dalton | fddb6c0 | 2017-11-04 15:22:22 -0600 | [diff] [blame] | 25 | class GrCoverageCountingPathRenderer; |
Robert Phillips | fbcef6e | 2017-06-15 12:07:18 -0400 | [diff] [blame] | 26 | class GrOnFlushCallbackObject; |
Herb Derby | dc214c2 | 2018-11-08 13:31:39 -0500 | [diff] [blame] | 27 | class GrOpFlushState; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 28 | class GrOpsTask; |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 29 | class GrRecordingContext; |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 30 | class GrRenderTargetContext; |
Robert Phillips | c7635fa | 2016-10-28 13:25:24 -0400 | [diff] [blame] | 31 | class GrRenderTargetProxy; |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 32 | class GrSoftwarePathRenderer; |
Greg Daniel | 46e366a | 2019-12-16 14:38:36 -0500 | [diff] [blame] | 33 | class GrSurfaceContext; |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 34 | class GrSurfaceProxyView; |
Chris Dalton | e2a903e | 2019-09-18 13:41:50 -0600 | [diff] [blame] | 35 | class GrTextureResolveRenderTask; |
Brian Salomon | 653f42f | 2018-07-10 10:07:31 -0400 | [diff] [blame] | 36 | class SkDeferredDisplayList; |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 37 | |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 38 | class GrDrawingManager { |
| 39 | public: |
| 40 | ~GrDrawingManager(); |
| 41 | |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 42 | void freeGpuResources(); |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 43 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 44 | // A managed opsTask is controlled by the drawing manager (i.e., sorted & flushed with the |
Robert Phillips | 831a293 | 2019-04-12 17:18:39 -0400 | [diff] [blame] | 45 | // others). An unmanaged one is created and used by the onFlushCallback. |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 46 | sk_sp<GrOpsTask> newOpsTask(GrSurfaceProxyView, bool managedOpsTask); |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 47 | |
Chris Dalton | e2a903e | 2019-09-18 13:41:50 -0600 | [diff] [blame] | 48 | // Create a render task that can resolve MSAA and/or regenerate mipmap levels on proxies. This |
| 49 | // method will only add the new render task to the list. It is up to the caller to call |
| 50 | // addProxy() on the returned object. |
| 51 | GrTextureResolveRenderTask* newTextureResolveRenderTask(const GrCaps&); |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 52 | |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 53 | // Create a new render task that will cause the gpu to wait on semaphores before executing any |
| 54 | // more RenderTasks that target proxy. It is possible for this wait to also block additional |
| 55 | // work (even to other proxies) that has already been recorded or will be recorded later. The |
| 56 | // only guarantee is that future work to the passed in proxy will wait on the semaphores to be |
| 57 | // signaled. |
Greg Daniel | 301015c | 2019-11-18 14:06:46 -0500 | [diff] [blame] | 58 | void newWaitRenderTask(sk_sp<GrSurfaceProxy> proxy, |
| 59 | std::unique_ptr<std::unique_ptr<GrSemaphore>[]>, |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 60 | int numSemaphores); |
| 61 | |
Greg Daniel | bbfec9d | 2019-08-20 10:56:51 -0400 | [diff] [blame] | 62 | // Create a new render task which copies the pixels from the srcProxy into the dstBuffer. This |
| 63 | // is used to support the asynchronous readback API. The srcRect is the region of the srcProxy |
| 64 | // to be copied. The surfaceColorType says how we should interpret the data when reading back |
| 65 | // from the source. DstColorType describes how the data should be stored in the dstBuffer. |
| 66 | // DstOffset is the offset into the dstBuffer where we will start writing data. |
| 67 | void newTransferFromRenderTask(sk_sp<GrSurfaceProxy> srcProxy, const SkIRect& srcRect, |
| 68 | GrColorType surfaceColorType, GrColorType dstColorType, |
| 69 | sk_sp<GrGpuBuffer> dstBuffer, size_t dstOffset); |
| 70 | |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 71 | // Creates a new render task which copies a pixel rectangle from srcView into dstView. The src |
Greg Daniel | e227fe4 | 2019-08-21 13:52:24 -0400 | [diff] [blame] | 72 | // pixels copied are specified by srcRect. They are copied to a rect of the same size in |
| 73 | // dstProxy with top left at dstPoint. If the src rect is clipped by the src bounds then pixel |
| 74 | // values in the dst rect corresponding to the area clipped by the src rect are not overwritten. |
| 75 | // This method is not guaranteed to succeed depending on the type of surface, formats, etc, and |
| 76 | // the backend-specific limitations. |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 77 | bool newCopyRenderTask(GrSurfaceProxyView srcView, const SkIRect& srcRect, |
| 78 | GrSurfaceProxyView dstView, const SkIPoint& dstPoint); |
Greg Daniel | e227fe4 | 2019-08-21 13:52:24 -0400 | [diff] [blame] | 79 | |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 80 | GrRecordingContext* getContext() { return fContext; } |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 81 | |
Herb Derby | 26cbe51 | 2018-05-24 14:39:01 -0400 | [diff] [blame] | 82 | GrTextContext* getTextContext(); |
brianosman | 86e7626 | 2016-08-11 12:17:31 -0700 | [diff] [blame] | 83 | |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 84 | GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
| 85 | bool allowSW, |
| 86 | GrPathRendererChain::DrawType drawType, |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 87 | GrPathRenderer::StencilSupport* stencilSupport = nullptr); |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 88 | |
Brian Salomon | e7df0bb | 2018-05-07 14:44:57 -0400 | [diff] [blame] | 89 | GrPathRenderer* getSoftwarePathRenderer(); |
| 90 | |
Chris Dalton | fddb6c0 | 2017-11-04 15:22:22 -0600 | [diff] [blame] | 91 | // Returns a direct pointer to the coverage counting path renderer, or null if it is not |
| 92 | // supported and turned on. |
| 93 | GrCoverageCountingPathRenderer* getCoverageCountingPathRenderer(); |
| 94 | |
Brian Salomon | 653f42f | 2018-07-10 10:07:31 -0400 | [diff] [blame] | 95 | void flushIfNecessary(); |
bsalomon | b77a907 | 2016-09-07 10:02:04 -0700 | [diff] [blame] | 96 | |
Greg Daniel | 78325c1 | 2017-06-19 16:39:13 -0400 | [diff] [blame] | 97 | static bool ProgramUnitTest(GrContext* context, int maxStages, int maxLevels); |
robertphillips | a13e202 | 2015-11-11 12:01:09 -0800 | [diff] [blame] | 98 | |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 99 | GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy* proxies[], |
| 100 | int cnt, |
| 101 | SkSurface::BackendSurfaceAccess access, |
| 102 | const GrFlushInfo& info); |
Greg Daniel | 55f040b | 2020-02-13 15:38:32 +0000 | [diff] [blame] | 103 | GrSemaphoresSubmitted flushSurface(GrSurfaceProxy* proxy, |
Greg Daniel | 4aa13e7 | 2019-04-15 14:42:20 -0400 | [diff] [blame] | 104 | SkSurface::BackendSurfaceAccess access, |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 105 | const GrFlushInfo& info) { |
Greg Daniel | 55f040b | 2020-02-13 15:38:32 +0000 | [diff] [blame] | 106 | return this->flushSurfaces(&proxy, 1, access, info); |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 107 | } |
bsalomon | 6a2b194 | 2016-09-08 11:28:59 -0700 | [diff] [blame] | 108 | |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 109 | void addOnFlushCallbackObject(GrOnFlushCallbackObject*); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 110 | |
| 111 | #if GR_TEST_UTILS |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 112 | void testingOnly_removeOnFlushCallbackObject(GrOnFlushCallbackObject*); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 113 | #endif |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 114 | |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame^] | 115 | GrRenderTask* getLastRenderTask(const GrSurfaceProxy*) const; |
| 116 | GrOpsTask* getLastOpsTask(const GrSurfaceProxy*) const; |
| 117 | void setLastRenderTask(const GrSurfaceProxy*, GrRenderTask*); |
| 118 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 119 | void moveRenderTasksToDDL(SkDeferredDisplayList* ddl); |
| 120 | void copyRenderTasksFromDDL(const SkDeferredDisplayList*, GrRenderTargetProxy* newDest); |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 121 | |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 122 | private: |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 123 | // This class encapsulates maintenance and manipulation of the drawing manager's DAG of |
| 124 | // renderTasks. |
| 125 | class RenderTaskDAG { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 126 | public: |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 127 | RenderTaskDAG(bool sortRenderTasks); |
| 128 | ~RenderTaskDAG(); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 129 | |
| 130 | // Currently, when explicitly allocating resources, this call will topologically sort the |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 131 | // GrRenderTasks. |
| 132 | // MDB TODO: remove once incremental GrRenderTask sorting is enabled |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 133 | void prepForFlush(); |
| 134 | |
| 135 | void closeAll(const GrCaps* caps); |
| 136 | |
| 137 | // A yucky combination of closeAll and reset |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame^] | 138 | void cleanup(GrDrawingManager*, const GrCaps* caps); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 139 | |
| 140 | void gatherIDs(SkSTArray<8, uint32_t, true>* idArray) const; |
| 141 | |
| 142 | void reset(); |
| 143 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 144 | // These calls forceably remove a GrRenderTask from the DAG. They are problematic bc they |
| 145 | // just remove the GrRenderTask but don't cleanup any refering pointers (i.e., dependency |
| 146 | // pointers in the DAG). They work right now bc they are only called at flush time, after |
| 147 | // the topological sort is complete (so the dangling pointers aren't used). |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 148 | void removeRenderTask(int index); |
| 149 | void removeRenderTasks(int startIndex, int stopIndex); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 150 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 151 | bool empty() const { return fRenderTasks.empty(); } |
| 152 | int numRenderTasks() const { return fRenderTasks.count(); } |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 153 | |
Robert Phillips | 9313aa7 | 2019-04-09 18:41:27 -0400 | [diff] [blame] | 154 | bool isUsed(GrSurfaceProxy*) const; |
| 155 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 156 | GrRenderTask* renderTask(int index) { return fRenderTasks[index].get(); } |
| 157 | const GrRenderTask* renderTask(int index) const { return fRenderTasks[index].get(); } |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 158 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 159 | GrRenderTask* back() { return fRenderTasks.back().get(); } |
| 160 | const GrRenderTask* back() const { return fRenderTasks.back().get(); } |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 161 | |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 162 | GrRenderTask* add(sk_sp<GrRenderTask>); |
| 163 | GrRenderTask* addBeforeLast(sk_sp<GrRenderTask>); |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 164 | void add(const SkTArray<sk_sp<GrRenderTask>>&); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 165 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 166 | void swap(SkTArray<sk_sp<GrRenderTask>>* renderTasks); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 167 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 168 | bool sortingRenderTasks() const { return fSortRenderTasks; } |
Robert Phillips | 46acf9d | 2018-10-09 09:31:40 -0400 | [diff] [blame] | 169 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 170 | private: |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 171 | SkTArray<sk_sp<GrRenderTask>> fRenderTasks; |
| 172 | bool fSortRenderTasks; |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 173 | }; |
| 174 | |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 175 | GrDrawingManager(GrRecordingContext*, const GrPathRendererChain::Options&, |
Robert Phillips | 0d075de | 2019-03-04 11:08:13 -0500 | [diff] [blame] | 176 | const GrTextContext::Options&, |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 177 | bool sortRenderTasks, |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 178 | bool reduceOpsTaskSplitting); |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 179 | |
Robert Phillips | a9162df | 2019-02-11 14:12:03 -0500 | [diff] [blame] | 180 | bool wasAbandoned() const; |
| 181 | |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 182 | void cleanup(); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 183 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 184 | // Closes the target's dependent render tasks (or, if not in sorting/opsTask-splitting-reduction |
| 185 | // mode, closes fActiveOpsTask) in preparation for us opening a new opsTask that will write to |
Chris Dalton | 5fe9977 | 2019-08-06 11:57:39 -0600 | [diff] [blame] | 186 | // 'target'. |
Greg Daniel | bbfec9d | 2019-08-20 10:56:51 -0400 | [diff] [blame] | 187 | void closeRenderTasksForNewRenderTask(GrSurfaceProxy* target); |
Chris Dalton | 5fe9977 | 2019-08-06 11:57:39 -0600 | [diff] [blame] | 188 | |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 189 | // return true if any GrRenderTasks were actually executed; false otherwise |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 190 | bool executeRenderTasks(int startIndex, int stopIndex, GrOpFlushState*, |
| 191 | int* numRenderTasksExecuted); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 192 | |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame^] | 193 | void removeRenderTasks(int startIndex, int stopIndex); |
| 194 | |
Greg Daniel | fe15962 | 2020-04-10 17:43:51 +0000 | [diff] [blame] | 195 | bool flush(GrSurfaceProxy* proxies[], |
| 196 | int numProxies, |
| 197 | SkSurface::BackendSurfaceAccess access, |
| 198 | const GrFlushInfo&, |
| 199 | const GrPrepareForExternalIORequests&); |
| 200 | |
| 201 | bool submitToGpu(bool syncToCpu); |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 202 | |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 203 | SkDEBUGCODE(void validate() const); |
| 204 | |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 205 | friend class GrContext; // access to: flush & cleanup |
Robert Phillips | 7ee385e | 2017-03-30 08:02:11 -0400 | [diff] [blame] | 206 | friend class GrContextPriv; // access to: flush |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 207 | friend class GrOnFlushResourceProvider; // this is just a shallow wrapper around this class |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 208 | friend class GrRecordingContext; // access to: ctor |
Greg Daniel | b6c15ba | 2019-03-04 13:08:25 -0500 | [diff] [blame] | 209 | friend class SkImage; // for access to: flush |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 210 | |
| 211 | static const int kNumPixelGeometries = 5; // The different pixel geometries |
| 212 | static const int kNumDFTOptions = 2; // DFT or no DFT |
| 213 | |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 214 | GrRecordingContext* fContext; |
bsalomon | 6b2552f | 2016-09-15 13:50:26 -0700 | [diff] [blame] | 215 | GrPathRendererChain::Options fOptionsForPathRendererChain; |
Herb Derby | 26cbe51 | 2018-05-24 14:39:01 -0400 | [diff] [blame] | 216 | GrTextContext::Options fOptionsForTextContext; |
Brian Salomon | 601ac80 | 2019-02-07 13:37:16 -0500 | [diff] [blame] | 217 | // This cache is used by both the vertex and index pools. It reuses memory across multiple |
| 218 | // flushes. |
| 219 | sk_sp<GrBufferAllocPool::CpuBufferCache> fCpuBufferCache; |
joshualitt | de8dc7e | 2016-01-08 10:09:13 -0800 | [diff] [blame] | 220 | |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 221 | RenderTaskDAG fDAG; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 222 | GrOpsTask* fActiveOpsTask = nullptr; |
| 223 | // These are the IDs of the opsTask currently being flushed (in internalFlush) |
Chris Dalton | 6b49810 | 2019-08-01 14:14:52 -0600 | [diff] [blame] | 224 | SkSTArray<8, uint32_t, true> fFlushingRenderTaskIDs; |
Chris Dalton | c4b4735 | 2019-08-23 10:10:36 -0600 | [diff] [blame] | 225 | // These are the new renderTasks generated by the onFlush CBs |
| 226 | SkSTArray<4, sk_sp<GrRenderTask>> fOnFlushRenderTasks; |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 227 | |
Herb Derby | 26cbe51 | 2018-05-24 14:39:01 -0400 | [diff] [blame] | 228 | std::unique_ptr<GrTextContext> fTextContext; |
robertphillips | a13e202 | 2015-11-11 12:01:09 -0800 | [diff] [blame] | 229 | |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 230 | std::unique_ptr<GrPathRendererChain> fPathRendererChain; |
| 231 | sk_sp<GrSoftwarePathRenderer> fSoftwarePathRenderer; |
brianosman | 86e7626 | 2016-08-11 12:17:31 -0700 | [diff] [blame] | 232 | |
Robert Phillips | 40a29d7 | 2018-01-18 12:59:22 -0500 | [diff] [blame] | 233 | GrTokenTracker fTokenTracker; |
brianosman | 86e7626 | 2016-08-11 12:17:31 -0700 | [diff] [blame] | 234 | bool fFlushing; |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 235 | bool fReduceOpsTaskSplitting; |
bsalomon | b77a907 | 2016-09-07 10:02:04 -0700 | [diff] [blame] | 236 | |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 237 | SkTArray<GrOnFlushCallbackObject*> fOnFlushCBObjects; |
Robert Phillips | 15c9142 | 2019-05-07 16:54:48 -0400 | [diff] [blame] | 238 | |
| 239 | void addDDLTarget(GrSurfaceProxy* proxy) { fDDLTargets.insert(proxy); } |
| 240 | bool isDDLTarget(GrSurfaceProxy* proxy) { return fDDLTargets.find(proxy) != fDDLTargets.end(); } |
| 241 | void clearDDLTargets() { fDDLTargets.clear(); } |
| 242 | |
| 243 | // We play a trick with lazy proxies to retarget the base target of a DDL to the SkSurface |
| 244 | // it is replayed on. Because of this remapping we need to explicitly store the targets of |
| 245 | // DDL replaying. |
| 246 | // Note: we do not expect a whole lot of these per flush |
| 247 | std::set<GrSurfaceProxy*> fDDLTargets; |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame^] | 248 | |
| 249 | // Keys are UniqueID of GrSurfaceProxys. |
| 250 | SkTHashMap<uint32_t, GrRenderTask*> fLastRenderTasks; |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 251 | }; |
| 252 | |
| 253 | #endif |