bsalomon | d309e7a | 2015-04-30 14:18:54 -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 GrResourceProvider_DEFINED |
| 9 | #define GrResourceProvider_DEFINED |
| 10 | |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 11 | #include "GrBuffer.h" |
bsalomon | 706f08f | 2015-05-22 07:35:58 -0700 | [diff] [blame] | 12 | #include "GrPathRange.h" |
Robert Phillips | 646e429 | 2017-06-13 12:44:56 -0400 | [diff] [blame] | 13 | #include "SkImageInfo.h" |
Robert Phillips | 009e9af | 2017-06-15 14:01:04 -0400 | [diff] [blame] | 14 | #include "SkScalerContext.h" |
bsalomon | d309e7a | 2015-04-30 14:18:54 -0700 | [diff] [blame] | 15 | |
Greg Daniel | bcf612b | 2017-05-01 13:50:58 +0000 | [diff] [blame] | 16 | class GrBackendRenderTarget; |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 17 | class GrBackendSemaphore; |
| 18 | class GrBackendTexture; |
Robert Phillips | 009e9af | 2017-06-15 14:01:04 -0400 | [diff] [blame] | 19 | class GrGpu; |
bsalomon | 706f08f | 2015-05-22 07:35:58 -0700 | [diff] [blame] | 20 | class GrPath; |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 21 | class GrRenderTarget; |
Robert Phillips | 646e429 | 2017-06-13 12:44:56 -0400 | [diff] [blame] | 22 | class GrSemaphore; |
joshualitt | 6d0872d | 2016-01-11 08:27:48 -0800 | [diff] [blame] | 23 | class GrSingleOwner; |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 24 | class GrStencilAttachment; |
Robert Phillips | 646e429 | 2017-06-13 12:44:56 -0400 | [diff] [blame] | 25 | class GrSurfaceProxy; |
| 26 | class GrTexture; |
| 27 | class GrTextureProxy; |
| 28 | |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 29 | class GrStyle; |
bsalomon | 706f08f | 2015-05-22 07:35:58 -0700 | [diff] [blame] | 30 | class SkDescriptor; |
| 31 | class SkPath; |
| 32 | class SkTypeface; |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 33 | |
bsalomon | d309e7a | 2015-04-30 14:18:54 -0700 | [diff] [blame] | 34 | /** |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 35 | * A factory for arbitrary resource types. This class is intended for use within the Gr code base. |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 36 | * |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 37 | * Some members force callers to make a flags (pendingIO) decision. This can be relaxed once |
| 38 | * https://bug.skia.org/4156 is fixed. |
bsalomon | d309e7a | 2015-04-30 14:18:54 -0700 | [diff] [blame] | 39 | */ |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 40 | class GrResourceProvider { |
bsalomon | d309e7a | 2015-04-30 14:18:54 -0700 | [diff] [blame] | 41 | public: |
joshualitt | 6d0872d | 2016-01-11 08:27:48 -0800 | [diff] [blame] | 42 | GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* owner); |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 43 | |
| 44 | template <typename T> T* findAndRefTByUniqueKey(const GrUniqueKey& key) { |
| 45 | return static_cast<T*>(this->findAndRefResourceByUniqueKey(key)); |
| 46 | } |
| 47 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 48 | /////////////////////////////////////////////////////////////////////////// |
| 49 | // Textures |
| 50 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 51 | /** Assigns a unique key to the texture. The texture will be findable via this key using |
| 52 | findTextureByUniqueKey(). If an existing texture has this key, it's key will be removed. */ |
Robert Phillips | d374948 | 2017-03-14 09:17:43 -0400 | [diff] [blame] | 53 | void assignUniqueKeyToProxy(const GrUniqueKey& key, GrTextureProxy*); |
| 54 | |
Robert Phillips | 3798c86 | 2017-03-27 11:08:16 -0400 | [diff] [blame] | 55 | /** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */ |
Robert Phillips | d374948 | 2017-03-14 09:17:43 -0400 | [diff] [blame] | 56 | sk_sp<GrTextureProxy> findProxyByUniqueKey(const GrUniqueKey& key); |
| 57 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 58 | /** |
| 59 | * Finds a texture that approximately matches the descriptor. Will be at least as large in width |
| 60 | * and height as desc specifies. If desc specifies that the texture should be a render target |
| 61 | * then result will be a render target. Format and sample count will always match the request. |
Robert Phillips | 67d52cf | 2017-06-05 13:38:13 -0400 | [diff] [blame] | 62 | * The contents of the texture are undefined. |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 63 | */ |
Robert Phillips | 67d52cf | 2017-06-05 13:38:13 -0400 | [diff] [blame] | 64 | sk_sp<GrTexture> createApproxTexture(const GrSurfaceDesc&, uint32_t flags); |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 65 | |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 66 | /** Create an exact fit texture with no initial data to upload. |
| 67 | */ |
Robert Phillips | 45fdae1 | 2017-04-17 12:57:27 -0400 | [diff] [blame] | 68 | sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, uint32_t flags = 0); |
| 69 | |
Robert Phillips | 8e8c755 | 2017-07-10 12:06:05 -0400 | [diff] [blame] | 70 | sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, |
Robert Phillips | 590533f | 2017-07-11 14:22:35 -0400 | [diff] [blame^] | 71 | const GrMipLevel texels[], int mipLevelCount, |
Robert Phillips | 8e8c755 | 2017-07-10 12:06:05 -0400 | [diff] [blame] | 72 | SkDestinationSurfaceColorMode mipColorMode); |
| 73 | |
Robert Phillips | 45fdae1 | 2017-04-17 12:57:27 -0400 | [diff] [blame] | 74 | sk_sp<GrTextureProxy> createTextureProxy(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel&); |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 75 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 76 | /////////////////////////////////////////////////////////////////////////// |
| 77 | // Wrapped Backend Surfaces |
| 78 | |
| 79 | /** |
| 80 | * Wraps an existing texture with a GrTexture object. |
| 81 | * |
| 82 | * OpenGL: if the object is a texture Gr may change its GL texture params |
| 83 | * when it is drawn. |
| 84 | * |
| 85 | * @return GrTexture object or NULL on failure. |
| 86 | */ |
Greg Daniel | 7ef28f3 | 2017-04-20 16:41:55 +0000 | [diff] [blame] | 87 | sk_sp<GrTexture> wrapBackendTexture(const GrBackendTexture& tex, |
| 88 | GrSurfaceOrigin origin, |
| 89 | GrBackendTextureFlags flags, |
| 90 | int sampleCnt, |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 91 | GrWrapOwnership = kBorrow_GrWrapOwnership); |
| 92 | |
| 93 | /** |
| 94 | * Wraps an existing render target with a GrRenderTarget object. It is |
| 95 | * similar to wrapBackendTexture but can be used to draw into surfaces |
| 96 | * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that |
| 97 | * the client will resolve to a texture). Currently wrapped render targets |
| 98 | * always use the kBorrow_GrWrapOwnership semantics. |
| 99 | * |
| 100 | * @return GrRenderTarget object or NULL on failure. |
| 101 | */ |
Greg Daniel | bcf612b | 2017-05-01 13:50:58 +0000 | [diff] [blame] | 102 | sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin); |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 103 | |
Robert Phillips | 1bfece8 | 2017-06-01 13:56:52 -0400 | [diff] [blame] | 104 | static const uint32_t kMinScratchTextureSize; |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 105 | |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 106 | /** |
Chris Dalton | ff92650 | 2017-05-03 14:36:54 -0400 | [diff] [blame] | 107 | * Either finds and refs, or creates an index buffer with a repeating pattern for drawing |
| 108 | * contiguous vertices of a repeated mesh. If the return is non-null, the caller owns a ref on |
| 109 | * the returned GrBuffer. |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 110 | * |
| 111 | * @param pattern the pattern of indices to repeat |
| 112 | * @param patternSize size in bytes of the pattern |
| 113 | * @param reps number of times to repeat the pattern |
| 114 | * @param vertCount number of vertices the pattern references |
| 115 | * @param key Key to be assigned to the index buffer. |
| 116 | * |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 117 | * @return The index buffer if successful, otherwise nullptr. |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 118 | */ |
Chris Dalton | ff92650 | 2017-05-03 14:36:54 -0400 | [diff] [blame] | 119 | const GrBuffer* findOrCreatePatternedIndexBuffer(const uint16_t* pattern, |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 120 | int patternSize, |
| 121 | int reps, |
| 122 | int vertCount, |
| 123 | const GrUniqueKey& key) { |
| 124 | if (GrBuffer* buffer = this->findAndRefTByUniqueKey<GrBuffer>(key)) { |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 125 | return buffer; |
| 126 | } |
Chris Dalton | ff92650 | 2017-05-03 14:36:54 -0400 | [diff] [blame] | 127 | return this->createPatternedIndexBuffer(pattern, patternSize, reps, vertCount, key); |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Returns an index buffer that can be used to render quads. |
| 132 | * Six indices per quad: 0, 1, 2, 0, 2, 3, etc. |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 133 | * The max number of quads is the buffer's index capacity divided by 6. |
Chris Dalton | 3809bab | 2017-06-13 10:55:06 -0600 | [diff] [blame] | 134 | * Draw with GrPrimitiveType::kTriangles |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 135 | * @ return the quad index buffer |
| 136 | */ |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 137 | const GrBuffer* refQuadIndexBuffer() { |
| 138 | if (GrBuffer* buffer = |
| 139 | this->findAndRefTByUniqueKey<GrBuffer>(fQuadIndexBufferKey)) { |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 140 | return buffer; |
| 141 | } |
| 142 | return this->createQuadIndexBuffer(); |
| 143 | } |
| 144 | |
bsalomon | 706f08f | 2015-05-22 07:35:58 -0700 | [diff] [blame] | 145 | /** |
| 146 | * Factories for GrPath and GrPathRange objects. It's an error to call these if path rendering |
| 147 | * is not supported. |
| 148 | */ |
Robert Phillips | 67d52cf | 2017-06-05 13:38:13 -0400 | [diff] [blame] | 149 | sk_sp<GrPath> createPath(const SkPath&, const GrStyle&); |
| 150 | sk_sp<GrPathRange> createPathRange(GrPathRange::PathGenerator*, const GrStyle&); |
| 151 | sk_sp<GrPathRange> createGlyphs(const SkTypeface*, const SkScalerContextEffects&, |
| 152 | const SkDescriptor*, const GrStyle&); |
bsalomon | 706f08f | 2015-05-22 07:35:58 -0700 | [diff] [blame] | 153 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 154 | /** These flags govern which scratch resources we are allowed to return */ |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 155 | enum Flags { |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 156 | kExact_Flag = 0x1, |
| 157 | |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 158 | /** If the caller intends to do direct reads/writes to/from the CPU then this flag must be |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 159 | * set when accessing resources during a GrOpList flush. This includes the execution of |
Brian Salomon | 25a8809 | 2016-12-01 09:36:50 -0500 | [diff] [blame] | 160 | * GrOp objects. The reason is that these memory operations are done immediately and |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 161 | * will occur out of order WRT the operations being flushed. |
halcanary | 6950de6 | 2015-11-07 05:29:00 -0800 | [diff] [blame] | 162 | * Make this automatic: https://bug.skia.org/4156 |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 163 | */ |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 164 | kNoPendingIO_Flag = 0x2, |
| 165 | |
| 166 | kNoCreate_Flag = 0x4, |
csmartdalton | 485a120 | 2016-07-13 10:16:32 -0700 | [diff] [blame] | 167 | |
| 168 | /** Normally the caps may indicate a preference for client-side buffers. Set this flag when |
| 169 | * creating a buffer to guarantee it resides in GPU memory. |
| 170 | */ |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 171 | kRequireGpuMemory_Flag = 0x8, |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 172 | }; |
| 173 | |
cdalton | e2e71c2 | 2016-04-07 18:13:29 -0700 | [diff] [blame] | 174 | /** |
| 175 | * Returns a buffer. |
| 176 | * |
| 177 | * @param size minimum size of buffer to return. |
| 178 | * @param intendedType hint to the graphics subsystem about what the buffer will be used for. |
| 179 | * @param GrAccessPattern hint to the graphics subsystem about how the data will be accessed. |
| 180 | * @param flags see Flags enum. |
cdalton | 1bf3e71 | 2016-04-19 10:00:02 -0700 | [diff] [blame] | 181 | * @param data optional data with which to initialize the buffer. |
cdalton | e2e71c2 | 2016-04-07 18:13:29 -0700 | [diff] [blame] | 182 | * |
| 183 | * @return the buffer if successful, otherwise nullptr. |
| 184 | */ |
cdalton | 1bf3e71 | 2016-04-19 10:00:02 -0700 | [diff] [blame] | 185 | GrBuffer* createBuffer(size_t size, GrBufferType intendedType, GrAccessPattern, uint32_t flags, |
| 186 | const void* data = nullptr); |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 187 | |
robertphillips | 1b8e1b5 | 2015-06-24 06:54:10 -0700 | [diff] [blame] | 188 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 189 | /** |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 190 | * If passed in render target already has a stencil buffer, return it. Otherwise attempt to |
| 191 | * attach one. |
| 192 | */ |
| 193 | GrStencilAttachment* attachStencilAttachment(GrRenderTarget* rt); |
| 194 | |
ericrk | f7b8b8a | 2016-02-24 14:49:51 -0800 | [diff] [blame] | 195 | /** |
| 196 | * Wraps an existing texture with a GrRenderTarget object. This is useful when the provided |
| 197 | * texture has a format that cannot be textured from by Skia, but we want to raster to it. |
| 198 | * |
kkinnunen | 49c4c22 | 2016-04-01 04:50:37 -0700 | [diff] [blame] | 199 | * The texture is wrapped as borrowed. The texture object will not be freed once the |
| 200 | * render target is destroyed. |
| 201 | * |
ericrk | f7b8b8a | 2016-02-24 14:49:51 -0800 | [diff] [blame] | 202 | * @return GrRenderTarget object or NULL on failure. |
| 203 | */ |
Greg Daniel | 7ef28f3 | 2017-04-20 16:41:55 +0000 | [diff] [blame] | 204 | sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTexture&, |
| 205 | GrSurfaceOrigin origin, |
| 206 | int sampleCnt); |
ericrk | f7b8b8a | 2016-02-24 14:49:51 -0800 | [diff] [blame] | 207 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 208 | /** |
| 209 | * Assigns a unique key to a resource. If the key is associated with another resource that |
| 210 | * association is removed and replaced by this resource. |
| 211 | */ |
| 212 | void assignUniqueKeyToResource(const GrUniqueKey&, GrGpuResource*); |
| 213 | |
| 214 | /** |
| 215 | * Finds a resource in the cache, based on the specified key. This is intended for use in |
| 216 | * conjunction with addResourceToCache(). The return value will be NULL if not found. The |
| 217 | * caller must balance with a call to unref(). |
| 218 | */ |
| 219 | GrGpuResource* findAndRefResourceByUniqueKey(const GrUniqueKey&); |
| 220 | |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 221 | sk_sp<GrSemaphore> SK_WARN_UNUSED_RESULT makeSemaphore(bool isOwned = true); |
| 222 | |
| 223 | sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore&, |
| 224 | GrWrapOwnership = kBorrow_GrWrapOwnership); |
Greg Daniel | d85f97d | 2017-03-07 13:37:21 -0500 | [diff] [blame] | 225 | |
| 226 | // Takes the GrSemaphore and sets the ownership of the semaphore to the GrGpu object used by |
| 227 | // this class. This call is only used when passing a GrSemaphore from one context to another. |
| 228 | void takeOwnershipOfSemaphore(sk_sp<GrSemaphore>); |
| 229 | // Takes the GrSemaphore and resets the ownership of the semaphore so that it is not owned by |
| 230 | // any GrGpu. A follow up call to takeOwnershipofSemaphore must be made so that the underlying |
| 231 | // semaphore can be deleted. This call is only used when passing a GrSemaphore from one context |
| 232 | // to another. |
| 233 | void releaseOwnershipOfSemaphore(sk_sp<GrSemaphore>); |
| 234 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 235 | void abandon() { |
Robert Phillips | 26c90e0 | 2017-03-14 14:39:29 -0400 | [diff] [blame] | 236 | fCache = nullptr; |
| 237 | fGpu = nullptr; |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 238 | } |
| 239 | |
Robert Phillips | f7a7261 | 2017-03-31 10:03:45 -0400 | [diff] [blame] | 240 | // 'proxy' is about to be used as a texture src or drawn to. This query can be used to |
| 241 | // determine if it is going to need a texture domain or a full clear. |
| 242 | static bool IsFunctionallyExact(GrSurfaceProxy* proxy); |
Robert Phillips | b66b42f | 2017-03-14 08:53:02 -0400 | [diff] [blame] | 243 | |
Robert Phillips | 26c90e0 | 2017-03-14 14:39:29 -0400 | [diff] [blame] | 244 | const GrCaps* caps() const { return fCaps.get(); } |
| 245 | |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 246 | private: |
Robert Phillips | 3798c86 | 2017-03-27 11:08:16 -0400 | [diff] [blame] | 247 | GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key); |
Robert Phillips | 646e429 | 2017-06-13 12:44:56 -0400 | [diff] [blame] | 248 | void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture); |
Robert Phillips | 3798c86 | 2017-03-27 11:08:16 -0400 | [diff] [blame] | 249 | |
Robert Phillips | 67d52cf | 2017-06-05 13:38:13 -0400 | [diff] [blame] | 250 | sk_sp<GrTexture> refScratchTexture(const GrSurfaceDesc&, uint32_t scratchTextureFlags); |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 251 | |
Robert Phillips | 45fdae1 | 2017-04-17 12:57:27 -0400 | [diff] [blame] | 252 | /* |
| 253 | * Try to find an existing scratch texture that exactly matches 'desc'. If successful |
| 254 | * update the budgeting accordingly. |
| 255 | */ |
| 256 | sk_sp<GrTexture> getExactScratch(const GrSurfaceDesc&, SkBudgeted, uint32_t flags); |
| 257 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 258 | GrResourceCache* cache() { return fCache; } |
| 259 | const GrResourceCache* cache() const { return fCache; } |
| 260 | |
| 261 | GrGpu* gpu() { return fGpu; } |
| 262 | const GrGpu* gpu() const { return fGpu; } |
| 263 | |
| 264 | bool isAbandoned() const { |
| 265 | SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); |
| 266 | return !SkToBool(fCache); |
| 267 | } |
| 268 | |
Chris Dalton | ff92650 | 2017-05-03 14:36:54 -0400 | [diff] [blame] | 269 | const GrBuffer* createPatternedIndexBuffer(const uint16_t* pattern, |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 270 | int patternSize, |
| 271 | int reps, |
| 272 | int vertCount, |
| 273 | const GrUniqueKey& key); |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 274 | |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 275 | const GrBuffer* createQuadIndexBuffer(); |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 276 | |
Robert Phillips | 26c90e0 | 2017-03-14 14:39:29 -0400 | [diff] [blame] | 277 | GrResourceCache* fCache; |
| 278 | GrGpu* fGpu; |
| 279 | sk_sp<const GrCaps> fCaps; |
| 280 | GrUniqueKey fQuadIndexBufferKey; |
bsalomon | ed0bcad | 2015-05-04 10:36:42 -0700 | [diff] [blame] | 281 | |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 282 | // In debug builds we guard against improper thread handling |
| 283 | SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
bsalomon | d309e7a | 2015-04-30 14:18:54 -0700 | [diff] [blame] | 284 | }; |
| 285 | |
| 286 | #endif |