reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2011 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. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 8 | #ifndef GrGpu_DEFINED |
| 9 | #define GrGpu_DEFINED |
| 10 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 11 | #include "GrPipelineBuilder.h" |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 12 | #include "GrProgramDesc.h" |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 13 | #include "GrStencil.h" |
bsalomon | 045802d | 2015-10-20 07:58:01 -0700 | [diff] [blame] | 14 | #include "GrTextureParamsAdjuster.h" |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 15 | #include "GrXferProcessor.h" |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 16 | #include "SkPath.h" |
| 17 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 18 | class GrBatchTracker; |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 19 | class GrContext; |
reed | f9ad558 | 2015-06-25 21:29:25 -0700 | [diff] [blame] | 20 | class GrGLContext; |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 21 | class GrIndexBuffer; |
bsalomon | e64eb57 | 2015-05-07 11:35:55 -0700 | [diff] [blame] | 22 | class GrNonInstancedVertices; |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 23 | class GrPath; |
cdalton | b85a0aa | 2014-07-21 15:32:44 -0700 | [diff] [blame] | 24 | class GrPathRange; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 25 | class GrPathRenderer; |
| 26 | class GrPathRendererChain; |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 27 | class GrPathRendering; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 28 | class GrPipeline; |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 29 | class GrPrimitiveProcessor; |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 30 | class GrRenderTarget; |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 31 | class GrStencilAttachment; |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 32 | class GrSurface; |
| 33 | class GrTexture; |
| 34 | class GrVertexBuffer; |
bsalomon | cb8979d | 2015-05-05 09:51:38 -0700 | [diff] [blame] | 35 | class GrVertices; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 36 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 37 | class GrGpu : public SkRefCnt { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 38 | public: |
| 39 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 40 | * Create an instance of GrGpu that matches the specified backend. If the requested backend is |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 41 | * not supported (at compile-time or run-time) this returns nullptr. The context will not be |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 42 | * fully constructed and should not be used by GrGpu until after this function returns. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 43 | */ |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 44 | static GrGpu* Create(GrBackend, GrBackendContext, const GrContextOptions&, GrContext* context); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 45 | |
| 46 | //////////////////////////////////////////////////////////////////////////// |
| 47 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 48 | GrGpu(GrContext* context); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 49 | ~GrGpu() override; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 50 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 51 | GrContext* getContext() { return fContext; } |
| 52 | const GrContext* getContext() const { return fContext; } |
| 53 | |
| 54 | /** |
| 55 | * Gets the capabilities of the draw target. |
| 56 | */ |
bsalomon | 4b91f76 | 2015-05-19 09:29:46 -0700 | [diff] [blame] | 57 | const GrCaps* caps() const { return fCaps.get(); } |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 58 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 59 | GrPathRendering* pathRendering() { return fPathRendering.get(); } |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 60 | |
bsalomon | c8dc1f7 | 2014-08-21 13:02:13 -0700 | [diff] [blame] | 61 | // Called by GrContext when the underlying backend context has been destroyed. |
| 62 | // GrGpu should use this to ensure that no backend API calls will be made from |
| 63 | // here onward, including in its destructor. Subclasses should call |
robertphillips | e337130 | 2014-09-17 06:01:06 -0700 | [diff] [blame] | 64 | // INHERITED::contextAbandoned() if they override this. |
| 65 | virtual void contextAbandoned(); |
bsalomon | c8dc1f7 | 2014-08-21 13:02:13 -0700 | [diff] [blame] | 66 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 67 | /** |
| 68 | * The GrGpu object normally assumes that no outsider is setting state |
| 69 | * within the underlying 3D API's context/device/whatever. This call informs |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 70 | * the GrGpu that the state was modified and it shouldn't make assumptions |
| 71 | * about the state. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 72 | */ |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 73 | void markContextDirty(uint32_t state = kAll_GrBackendState) { fResetBits |= state; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 74 | |
| 75 | /** |
bsalomon | 6d467ec | 2014-11-18 07:36:19 -0800 | [diff] [blame] | 76 | * Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can |
| 77 | * be used as a render target by calling GrTexture::asRenderTarget(). Not all |
| 78 | * pixel configs can be used as render targets. Support for configs as textures |
bsalomon | 4b91f76 | 2015-05-19 09:29:46 -0700 | [diff] [blame] | 79 | * or render targets can be checked using GrCaps. |
bsalomon@google.com | 1da0746 | 2011-03-10 14:51:57 +0000 | [diff] [blame] | 80 | * |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 81 | * @param desc describes the texture to be created. |
bsalomon | 5236cf4 | 2015-01-14 10:42:08 -0800 | [diff] [blame] | 82 | * @param budgeted does this texture count against the resource cache budget? |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 83 | * @param srcData texel data to load texture. Begins with full-size |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 84 | * palette data for paletted textures. For compressed |
| 85 | * formats it contains the compressed pixel data. Otherwise, |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 86 | * it contains width*height texels. If nullptr texture data |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 87 | * is uninitialized. |
| 88 | * @param rowBytes the number of bytes between consecutive rows. Zero |
| 89 | * means rows are tightly packed. This field is ignored |
| 90 | * for compressed formats. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 91 | * |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 92 | * @return The texture object if successful, otherwise nullptr. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 93 | */ |
bsalomon | 5236cf4 | 2015-01-14 10:42:08 -0800 | [diff] [blame] | 94 | GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
| 95 | const void* srcData, size_t rowBytes); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 96 | |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 97 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 98 | * Implements GrContext::wrapBackendTexture |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 99 | */ |
bsalomon | 6dc6f5f | 2015-06-18 09:12:16 -0700 | [diff] [blame] | 100 | GrTexture* wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership); |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 101 | |
| 102 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 103 | * Implements GrContext::wrapBackendTexture |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 104 | */ |
bsalomon | 6dc6f5f | 2015-06-18 09:12:16 -0700 | [diff] [blame] | 105 | GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, GrWrapOwnership); |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 106 | |
| 107 | /** |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 108 | * Creates a vertex buffer. |
| 109 | * |
| 110 | * @param size size in bytes of the vertex buffer |
| 111 | * @param dynamic hints whether the data will be frequently changed |
commit-bot@chromium.org | 8341eb7 | 2014-05-07 20:51:05 +0000 | [diff] [blame] | 112 | * by either GrVertexBuffer::map() or |
| 113 | * GrVertexBuffer::updateData(). |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 114 | * |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 115 | * @return The vertex buffer if successful, otherwise nullptr. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 116 | */ |
robertphillips@google.com | adacc70 | 2013-10-14 21:53:24 +0000 | [diff] [blame] | 117 | GrVertexBuffer* createVertexBuffer(size_t size, bool dynamic); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Creates an index buffer. |
| 121 | * |
| 122 | * @param size size in bytes of the index buffer |
| 123 | * @param dynamic hints whether the data will be frequently changed |
commit-bot@chromium.org | 8341eb7 | 2014-05-07 20:51:05 +0000 | [diff] [blame] | 124 | * by either GrIndexBuffer::map() or |
| 125 | * GrIndexBuffer::updateData(). |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 126 | * |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 127 | * @return The index buffer if successful, otherwise nullptr. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 128 | */ |
robertphillips@google.com | adacc70 | 2013-10-14 21:53:24 +0000 | [diff] [blame] | 129 | GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 130 | |
| 131 | /** |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 132 | * Resolves MSAA. |
| 133 | */ |
| 134 | void resolveRenderTarget(GrRenderTarget* target); |
| 135 | |
bsalomon | f067451 | 2015-07-28 13:26:15 -0700 | [diff] [blame] | 136 | /** Info struct returned by getReadPixelsInfo about performing intermediate draws before |
bsalomon | 3982602 | 2015-07-23 08:07:21 -0700 | [diff] [blame] | 137 | reading pixels for performance or correctness. */ |
| 138 | struct ReadPixelTempDrawInfo { |
| 139 | /** If the GrGpu is requesting that the caller do a draw to an intermediate surface then |
| 140 | this is descriptor for the temp surface. The draw should always be a rect with |
| 141 | dst 0,0,w,h. */ |
| 142 | GrSurfaceDesc fTempSurfaceDesc; |
| 143 | /** Indicates whether there is a performance advantage to using an exact match texture |
| 144 | (in terms of width and height) for the intermediate texture instead of approximate. */ |
| 145 | bool fUseExactScratch; |
| 146 | /** The caller should swap the R and B channel in the temp draw and then instead of reading |
| 147 | the desired config back it should read GrPixelConfigSwapRAndB(readConfig). The swap |
| 148 | during the draw and the swap at readback time cancel and the client gets the correct |
| 149 | data. The swapped read back is either faster for or required by the underlying backend |
| 150 | 3D API. */ |
| 151 | bool fSwapRAndB; |
| 152 | }; |
| 153 | /** Describes why an intermediate draw must/should be performed before readPixels. */ |
| 154 | enum DrawPreference { |
| 155 | /** On input means that the caller would proceed without draw if the GrGpu doesn't request |
| 156 | one. |
| 157 | On output means that the GrGpu is not requesting a draw. */ |
| 158 | kNoDraw_DrawPreference, |
| 159 | /** Means that the client would prefer a draw for performance of the readback but |
| 160 | can satisfy a straight readPixels call on the inputs without an intermediate draw. |
| 161 | getReadPixelsInfo will never set the draw preference to this value but may leave |
| 162 | it set. */ |
| 163 | kCallerPrefersDraw_DrawPreference, |
| 164 | /** On output means that GrGpu would prefer a draw for performance of the readback but |
| 165 | can satisfy a straight readPixels call on the inputs without an intermediate draw. The |
| 166 | caller of getReadPixelsInfo should never specify this on intput. */ |
| 167 | kGpuPrefersDraw_DrawPreference, |
| 168 | /** On input means that the caller requires a draw to do a transformation and there is no |
| 169 | CPU fallback. |
| 170 | On output means that GrGpu can only satisfy the readPixels request if the intermediate |
| 171 | draw is performed. |
| 172 | */ |
| 173 | kRequireDraw_DrawPreference |
| 174 | }; |
| 175 | |
bsalomon | f067451 | 2015-07-28 13:26:15 -0700 | [diff] [blame] | 176 | /** |
| 177 | * Used to negotiate whether and how an intermediate draw should or must be performed before |
| 178 | * a readPixels call. If this returns false then GrGpu could not deduce an intermediate draw |
| 179 | * that would allow a successful readPixels call. The passed width, height, and rowBytes, |
| 180 | * must be non-zero and already reflect clipping to the src bounds. |
| 181 | */ |
| 182 | bool getReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes, |
| 183 | GrPixelConfig readConfig, DrawPreference*, ReadPixelTempDrawInfo*); |
| 184 | |
| 185 | /** Info struct returned by getWritePixelsInfo about performing an intermediate draw in order |
| 186 | to write pixels to a GrSurface for either performance or correctness reasons. */ |
| 187 | struct WritePixelTempDrawInfo { |
| 188 | /** If the GrGpu is requesting that the caller upload to an intermediate surface and draw |
| 189 | that to the dst then this is the descriptor for the intermediate surface. The caller |
| 190 | should upload the pixels such that the upper left pixel of the upload rect is at 0,0 in |
| 191 | the intermediate surface.*/ |
| 192 | GrSurfaceDesc fTempSurfaceDesc; |
| 193 | /** If set, fTempSurfaceDesc's config will be a R/B swap of the src pixel config. The caller |
| 194 | should upload the pixels as is such that R and B will be swapped in the intermediate |
| 195 | surface. When the intermediate is drawn to the dst the shader should swap R/B again |
| 196 | such that the correct swizzle results in the dst. This is done to work around either |
| 197 | performance or API restrictions in the backend 3D API implementation. */ |
| 198 | bool fSwapRAndB; |
| 199 | }; |
bsalomon | 3982602 | 2015-07-23 08:07:21 -0700 | [diff] [blame] | 200 | |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 201 | /** |
bsalomon | f067451 | 2015-07-28 13:26:15 -0700 | [diff] [blame] | 202 | * Used to negotiate whether and how an intermediate surface should be used to write pixels to |
| 203 | * a GrSurface. If this returns false then GrGpu could not deduce an intermediate draw |
| 204 | * that would allow a successful transfer of the src pixels to the dst. The passed width, |
| 205 | * height, and rowBytes, must be non-zero and already reflect clipping to the dst bounds. |
bsalomon@google.com | 0a97be2 | 2011-11-08 19:20:57 +0000 | [diff] [blame] | 206 | */ |
bsalomon | f067451 | 2015-07-28 13:26:15 -0700 | [diff] [blame] | 207 | bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes, |
| 208 | GrPixelConfig srcConfig, DrawPreference*, WritePixelTempDrawInfo*); |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 209 | |
| 210 | /** |
bsalomon@google.com | a04e8e8 | 2012-08-27 12:53:13 +0000 | [diff] [blame] | 211 | * Reads a rectangle of pixels from a render target. |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 212 | * |
bsalomon | 6cb3cbe | 2015-07-30 07:34:27 -0700 | [diff] [blame] | 213 | * @param surface The surface to read from |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 214 | * @param left left edge of the rectangle to read (inclusive) |
| 215 | * @param top top edge of the rectangle to read (inclusive) |
| 216 | * @param width width of rectangle to read in pixels. |
| 217 | * @param height height of rectangle to read in pixels. |
| 218 | * @param config the pixel config of the destination buffer |
| 219 | * @param buffer memory to read the rectangle into. |
bsalomon@google.com | c698097 | 2011-11-02 19:57:21 +0000 | [diff] [blame] | 220 | * @param rowBytes the number of bytes between consecutive rows. Zero |
| 221 | * means rows are tightly packed. |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 222 | * @param invertY buffer should be populated bottom-to-top as opposed |
| 223 | * to top-to-bottom (skia's usual order) |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 224 | * |
| 225 | * @return true if the read succeeded, false if not. The read can fail |
| 226 | * because of a unsupported pixel config or because no render |
| 227 | * target is currently set. |
| 228 | */ |
bsalomon | 6cb3cbe | 2015-07-30 07:34:27 -0700 | [diff] [blame] | 229 | bool readPixels(GrSurface* surface, |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 230 | int left, int top, int width, int height, |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 231 | GrPixelConfig config, void* buffer, size_t rowBytes); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 232 | |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 233 | /** |
bsalomon | 6cb3cbe | 2015-07-30 07:34:27 -0700 | [diff] [blame] | 234 | * Updates the pixels in a rectangle of a surface. |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 235 | * |
bsalomon | 6cb3cbe | 2015-07-30 07:34:27 -0700 | [diff] [blame] | 236 | * @param surface The surface to write to. |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 237 | * @param left left edge of the rectangle to write (inclusive) |
| 238 | * @param top top edge of the rectangle to write (inclusive) |
| 239 | * @param width width of rectangle to write in pixels. |
| 240 | * @param height height of rectangle to write in pixels. |
| 241 | * @param config the pixel config of the source buffer |
| 242 | * @param buffer memory to read pixels from |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 243 | * @param rowBytes number of bytes between consecutive rows. Zero |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 244 | * means rows are tightly packed. |
| 245 | */ |
bsalomon | 6cb3cbe | 2015-07-30 07:34:27 -0700 | [diff] [blame] | 246 | bool writePixels(GrSurface* surface, |
| 247 | int left, int top, int width, int height, |
| 248 | GrPixelConfig config, const void* buffer, |
| 249 | size_t rowBytes); |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 250 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 251 | /** |
egdaniel | 51c8d40 | 2015-08-06 10:54:13 -0700 | [diff] [blame] | 252 | * Clear the passed in render target. Ignores the draw state and clip. |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 253 | */ |
egdaniel | 51c8d40 | 2015-08-06 10:54:13 -0700 | [diff] [blame] | 254 | void clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget); |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 255 | |
| 256 | |
bsalomon | 6d467ec | 2014-11-18 07:36:19 -0800 | [diff] [blame] | 257 | void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* renderTarget); |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 258 | |
| 259 | /** |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 260 | * Discards the contents render target. nullptr indicates that the current render target should |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 261 | * be discarded. |
| 262 | **/ |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 263 | virtual void discard(GrRenderTarget* = nullptr) = 0; |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 264 | |
| 265 | /** |
| 266 | * This is can be called before allocating a texture to be a dst for copySurface. It will |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 267 | * populate the origin, config, and flags fields of the desc such that copySurface can |
| 268 | * efficiently succeed. It should only succeed if it can allow copySurface to perform a copy |
| 269 | * that would be more effecient than drawing the src to a dst render target. |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 270 | */ |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 271 | virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const = 0; |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 272 | |
bsalomon@google.com | 80d09b9 | 2011-11-05 21:21:13 +0000 | [diff] [blame] | 273 | // After the client interacts directly with the 3D context state the GrGpu |
| 274 | // must resync its internal state and assumptions about 3D context state. |
| 275 | // Each time this occurs the GrGpu bumps a timestamp. |
| 276 | // state of the 3D context |
| 277 | // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about |
| 278 | // a billion years. |
| 279 | typedef uint64_t ResetTimestamp; |
| 280 | |
| 281 | // This timestamp is always older than the current timestamp |
| 282 | static const ResetTimestamp kExpiredTimestamp = 0; |
| 283 | // Returns a timestamp based on the number of times the context was reset. |
| 284 | // This timestamp can be used to lazily detect when cached 3D context state |
| 285 | // is dirty. |
bsalomon | 6d467ec | 2014-11-18 07:36:19 -0800 | [diff] [blame] | 286 | ResetTimestamp getResetTimestamp() const { return fResetTimestamp; } |
bsalomon@google.com | 80d09b9 | 2011-11-05 21:21:13 +0000 | [diff] [blame] | 287 | |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 288 | virtual void buildProgramDesc(GrProgramDesc*, |
| 289 | const GrPrimitiveProcessor&, |
joshualitt | 465283c | 2015-09-11 08:19:35 -0700 | [diff] [blame] | 290 | const GrPipeline&) const = 0; |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 291 | |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 292 | // Called to perform a surface to surface copy. Fallbacks to issuing a draw from the src to dst |
| 293 | // take place at the GrDrawTarget level and this function implement faster copy paths. The rect |
| 294 | // and point are pre-clipped. The src rect and implied dst rect are guaranteed to be within the |
| 295 | // src/dst bounds and non-empty. |
joshualitt | 1cbdcde | 2015-08-21 11:53:29 -0700 | [diff] [blame] | 296 | bool copySurface(GrSurface* dst, |
| 297 | GrSurface* src, |
| 298 | const SkIRect& srcRect, |
| 299 | const SkIPoint& dstPoint); |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 300 | |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 301 | struct DrawArgs { |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 302 | DrawArgs(const GrPrimitiveProcessor* primProc, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 303 | const GrPipeline* pipeline, |
joshualitt | 465283c | 2015-09-11 08:19:35 -0700 | [diff] [blame] | 304 | const GrProgramDesc* desc) |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 305 | : fPrimitiveProcessor(primProc) |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 306 | , fPipeline(pipeline) |
joshualitt | 465283c | 2015-09-11 08:19:35 -0700 | [diff] [blame] | 307 | , fDesc(desc) { |
| 308 | SkASSERT(primProc && pipeline && desc); |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 309 | } |
| 310 | const GrPrimitiveProcessor* fPrimitiveProcessor; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 311 | const GrPipeline* fPipeline; |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 312 | const GrProgramDesc* fDesc; |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 313 | }; |
| 314 | |
bsalomon | cb8979d | 2015-05-05 09:51:38 -0700 | [diff] [blame] | 315 | void draw(const DrawArgs&, const GrVertices&); |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 316 | |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 317 | /////////////////////////////////////////////////////////////////////////// |
| 318 | // Debugging and Stats |
| 319 | |
| 320 | class Stats { |
| 321 | public: |
| 322 | #if GR_GPU_STATS |
| 323 | Stats() { this->reset(); } |
| 324 | |
bsalomon | b12ea41 | 2015-02-02 21:19:50 -0800 | [diff] [blame] | 325 | void reset() { |
| 326 | fRenderTargetBinds = 0; |
| 327 | fShaderCompilations = 0; |
| 328 | fTextureCreates = 0; |
| 329 | fTextureUploads = 0; |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 330 | fStencilAttachmentCreates = 0; |
joshualitt | 87a5c9f | 2015-09-08 13:42:05 -0700 | [diff] [blame] | 331 | fNumDraws = 0; |
bsalomon | b12ea41 | 2015-02-02 21:19:50 -0800 | [diff] [blame] | 332 | } |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 333 | |
| 334 | int renderTargetBinds() const { return fRenderTargetBinds; } |
| 335 | void incRenderTargetBinds() { fRenderTargetBinds++; } |
| 336 | int shaderCompilations() const { return fShaderCompilations; } |
| 337 | void incShaderCompilations() { fShaderCompilations++; } |
bsalomon | b12ea41 | 2015-02-02 21:19:50 -0800 | [diff] [blame] | 338 | int textureCreates() const { return fTextureCreates; } |
| 339 | void incTextureCreates() { fTextureCreates++; } |
| 340 | int textureUploads() const { return fTextureUploads; } |
| 341 | void incTextureUploads() { fTextureUploads++; } |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 342 | void incStencilAttachmentCreates() { fStencilAttachmentCreates++; } |
joshualitt | 87a5c9f | 2015-09-08 13:42:05 -0700 | [diff] [blame] | 343 | void incNumDraws() { fNumDraws++; } |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 344 | void dump(SkString*); |
| 345 | |
| 346 | private: |
| 347 | int fRenderTargetBinds; |
| 348 | int fShaderCompilations; |
bsalomon | b12ea41 | 2015-02-02 21:19:50 -0800 | [diff] [blame] | 349 | int fTextureCreates; |
| 350 | int fTextureUploads; |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 351 | int fStencilAttachmentCreates; |
joshualitt | 87a5c9f | 2015-09-08 13:42:05 -0700 | [diff] [blame] | 352 | int fNumDraws; |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 353 | #else |
| 354 | void dump(SkString*) {}; |
| 355 | void incRenderTargetBinds() {} |
| 356 | void incShaderCompilations() {} |
bsalomon | b12ea41 | 2015-02-02 21:19:50 -0800 | [diff] [blame] | 357 | void incTextureCreates() {} |
| 358 | void incTextureUploads() {} |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 359 | void incStencilAttachmentCreates() {} |
joshualitt | 87a5c9f | 2015-09-08 13:42:05 -0700 | [diff] [blame] | 360 | void incNumDraws() {} |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 361 | #endif |
| 362 | }; |
| 363 | |
| 364 | Stats* stats() { return &fStats; } |
| 365 | |
bsalomon | 67d7620 | 2015-11-11 12:40:42 -0800 | [diff] [blame] | 366 | /** Creates a texture directly in the backend API without wrapping it in a GrTexture. This is |
| 367 | only to be used for testing (particularly for testing the methods that import an externally |
| 368 | created texture into Skia. Must be matched with a call to deleteTestingOnlyTexture(). */ |
jvanverth | 8895792 | 2015-07-14 11:02:52 -0700 | [diff] [blame] | 369 | virtual GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, |
| 370 | GrPixelConfig config) const = 0; |
bsalomon | 67d7620 | 2015-11-11 12:40:42 -0800 | [diff] [blame] | 371 | /** Check a handle represents an actual texture in the backend API that has not been freed. */ |
| 372 | virtual bool isTestingOnlyBackendTexture(GrBackendObject) const = 0; |
| 373 | /** If ownership of the backend texture has been transferred pass true for abandonTexture. This |
| 374 | will do any necessary cleanup of the handle without freeing the texture in the backend |
| 375 | API. */ |
| 376 | virtual void deleteTestingOnlyBackendTexture(GrBackendObject, |
| 377 | bool abandonTexture = false) const = 0; |
jvanverth | 672bb7f | 2015-07-13 07:19:57 -0700 | [diff] [blame] | 378 | |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 379 | // width and height may be larger than rt (if underlying API allows it). |
| 380 | // Returns nullptr if compatible sb could not be created, otherwise the caller owns the ref on |
| 381 | // the GrStencilAttachment. |
| 382 | virtual GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*, |
| 383 | int width, |
| 384 | int height) = 0; |
| 385 | // clears target's entire stencil buffer to 0 |
| 386 | virtual void clearStencil(GrRenderTarget* target) = 0; |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 387 | |
bsalomon | 045802d | 2015-10-20 07:58:01 -0700 | [diff] [blame] | 388 | |
| 389 | // Determines whether a copy of a texture must be made in order to be compatible with |
| 390 | // a given GrTextureParams. If so, the width, height and filter used for the copy are |
| 391 | // output via the CopyParams. |
| 392 | bool makeCopyForTextureParams(int width, int height, const GrTextureParams&, |
bsalomon | 89fe56b | 2015-10-29 10:49:28 -0700 | [diff] [blame] | 393 | GrTextureProducer::CopyParams*) const; |
bsalomon | 045802d | 2015-10-20 07:58:01 -0700 | [diff] [blame] | 394 | |
jvanverth | 672bb7f | 2015-07-13 07:19:57 -0700 | [diff] [blame] | 395 | // This is only to be used in GL-specific tests. |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 396 | virtual const GrGLContext* glContextForTesting() const { return nullptr; } |
bsalomon | 993a421 | 2015-05-29 11:37:25 -0700 | [diff] [blame] | 397 | |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame] | 398 | protected: |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 399 | // Functions used to map clip-respecting stencil tests into normal |
| 400 | // stencil funcs supported by GPUs. |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 401 | static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 402 | GrStencilFunc func); |
| 403 | static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 404 | bool clipInStencil, |
| 405 | unsigned int clipBit, |
| 406 | unsigned int userBits, |
| 407 | unsigned int* ref, |
| 408 | unsigned int* mask); |
| 409 | |
bsalomon | f067451 | 2015-07-28 13:26:15 -0700 | [diff] [blame] | 410 | static void ElevateDrawPreference(GrGpu::DrawPreference* preference, |
| 411 | GrGpu::DrawPreference elevation) { |
| 412 | GR_STATIC_ASSERT(GrGpu::kCallerPrefersDraw_DrawPreference > GrGpu::kNoDraw_DrawPreference); |
| 413 | GR_STATIC_ASSERT(GrGpu::kGpuPrefersDraw_DrawPreference > |
| 414 | GrGpu::kCallerPrefersDraw_DrawPreference); |
| 415 | GR_STATIC_ASSERT(GrGpu::kRequireDraw_DrawPreference > |
| 416 | GrGpu::kGpuPrefersDraw_DrawPreference); |
| 417 | *preference = SkTMax(*preference, elevation); |
| 418 | } |
| 419 | |
joshualitt | 93316b9 | 2015-10-23 09:08:08 -0700 | [diff] [blame] | 420 | void handleDirtyContext() { |
| 421 | if (fResetBits) { |
| 422 | this->resetContext(); |
| 423 | } |
| 424 | } |
| 425 | |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 426 | Stats fStats; |
| 427 | SkAutoTDelete<GrPathRendering> fPathRendering; |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 428 | // Subclass must initialize this in its constructor. |
bsalomon | 4b91f76 | 2015-05-19 09:29:46 -0700 | [diff] [blame] | 429 | SkAutoTUnref<const GrCaps> fCaps; |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 430 | |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 431 | private: |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 432 | // called when the 3D context state is unknown. Subclass should emit any |
bsalomon@google.com | c8f7f47 | 2012-06-18 13:44:51 +0000 | [diff] [blame] | 433 | // assumed 3D context state and dirty any state cache. |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 434 | virtual void onResetContext(uint32_t resetBits) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 435 | |
bsalomon | cb02b38 | 2015-08-12 11:14:50 -0700 | [diff] [blame] | 436 | // Called before certain draws in order to guarantee coherent results from dst reads. |
| 437 | virtual void xferBarrier(GrRenderTarget*, GrXferBarrierType) = 0; |
| 438 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 439 | // overridden by backend-specific derived class to create objects. |
egdaniel | b0e1be2 | 2015-04-22 13:27:39 -0700 | [diff] [blame] | 440 | // Texture size and sample size will have already been validated in base class before |
| 441 | // onCreateTexture/CompressedTexture are called. |
| 442 | virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, |
| 443 | GrGpuResource::LifeCycle lifeCycle, |
bsalomon | 5236cf4 | 2015-01-14 10:42:08 -0800 | [diff] [blame] | 444 | const void* srcData, size_t rowBytes) = 0; |
egdaniel | b0e1be2 | 2015-04-22 13:27:39 -0700 | [diff] [blame] | 445 | virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
| 446 | GrGpuResource::LifeCycle lifeCycle, |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 447 | const void* srcData) = 0; |
bsalomon | 6dc6f5f | 2015-06-18 09:12:16 -0700 | [diff] [blame] | 448 | virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) = 0; |
| 449 | virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
| 450 | GrWrapOwnership) = 0; |
robertphillips@google.com | adacc70 | 2013-10-14 21:53:24 +0000 | [diff] [blame] | 451 | virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
| 452 | virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 453 | |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 454 | // overridden by backend-specific derived class to perform the clear. |
egdaniel | 51c8d40 | 2015-08-06 10:54:13 -0700 | [diff] [blame] | 455 | virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 456 | |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 457 | |
| 458 | // Overridden by backend specific classes to perform a clear of the stencil clip bits. This is |
| 459 | // ONLY used by the the clip target |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 460 | virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideClip) = 0; |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 461 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 462 | // overridden by backend-specific derived class to perform the draw call. |
bsalomon | e64eb57 | 2015-05-07 11:35:55 -0700 | [diff] [blame] | 463 | virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0; |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 464 | |
bsalomon | f067451 | 2015-07-28 13:26:15 -0700 | [diff] [blame] | 465 | virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, |
| 466 | size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, |
| 467 | ReadPixelTempDrawInfo*) = 0; |
| 468 | virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes, |
| 469 | GrPixelConfig srcConfig, DrawPreference*, |
| 470 | WritePixelTempDrawInfo*) = 0; |
| 471 | |
bsalomon | 6cb3cbe | 2015-07-30 07:34:27 -0700 | [diff] [blame] | 472 | // overridden by backend-specific derived class to perform the surface read |
| 473 | virtual bool onReadPixels(GrSurface*, |
egdaniel | 6d901da | 2015-07-30 12:02:15 -0700 | [diff] [blame] | 474 | int left, int top, |
| 475 | int width, int height, |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 476 | GrPixelConfig, |
| 477 | void* buffer, |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 478 | size_t rowBytes) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 479 | |
bsalomon | 6cb3cbe | 2015-07-30 07:34:27 -0700 | [diff] [blame] | 480 | // overridden by backend-specific derived class to perform the surface write |
| 481 | virtual bool onWritePixels(GrSurface*, |
| 482 | int left, int top, int width, int height, |
| 483 | GrPixelConfig config, const void* buffer, |
| 484 | size_t rowBytes) = 0; |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 485 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 486 | // overridden by backend-specific derived class to perform the resolve |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 487 | virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
| 488 | |
joshualitt | 1cbdcde | 2015-08-21 11:53:29 -0700 | [diff] [blame] | 489 | // overridden by backend specific derived class to perform the copy surface |
| 490 | virtual bool onCopySurface(GrSurface* dst, |
| 491 | GrSurface* src, |
| 492 | const SkIRect& srcRect, |
| 493 | const SkIPoint& dstPoint) = 0; |
| 494 | |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 495 | void resetContext() { |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 496 | this->onResetContext(fResetBits); |
| 497 | fResetBits = 0; |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 498 | ++fResetTimestamp; |
| 499 | } |
| 500 | |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 501 | ResetTimestamp fResetTimestamp; |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 502 | uint32_t fResetBits; |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 503 | // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 504 | GrContext* fContext; |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 505 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 506 | friend class GrPathRendering; |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 507 | typedef SkRefCnt INHERITED; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 508 | }; |
| 509 | |
| 510 | #endif |