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 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 11 | #include "GrDrawTarget.h" |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 12 | #include "GrPathRendering.h" |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 13 | #include "GrProgramDesc.h" |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 14 | #include "SkPath.h" |
| 15 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 16 | class GrContext; |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 17 | class GrIndexBufferAllocPool; |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 18 | class GrPath; |
cdalton | b85a0aa | 2014-07-21 15:32:44 -0700 | [diff] [blame] | 19 | class GrPathRange; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 20 | class GrPathRenderer; |
| 21 | class GrPathRendererChain; |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 22 | class GrStencilBuffer; |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 23 | class GrVertexBufferAllocPool; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 24 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 25 | class GrGpu : public SkRefCnt { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 26 | public: |
bsalomon@google.com | 18c9c19 | 2011-09-22 21:01:31 +0000 | [diff] [blame] | 27 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 28 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 29 | * Additional blend coefficients for dual source blending, not exposed |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 30 | * through GrPaint/GrContext. |
| 31 | */ |
| 32 | enum ExtendedBlendCoeffs { |
| 33 | // source 2 refers to second output color when |
| 34 | // using dual source blending. |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 35 | kS2C_GrBlendCoeff = kPublicGrBlendCoeffCount, |
| 36 | kIS2C_GrBlendCoeff, |
| 37 | kS2A_GrBlendCoeff, |
| 38 | kIS2A_GrBlendCoeff, |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 39 | |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 40 | kTotalGrBlendCoeffCount |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 44 | * Create an instance of GrGpu that matches the specified backend. If the requested backend is |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 45 | * not supported (at compile-time or run-time) this returns NULL. The context will not be |
| 46 | * 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] | 47 | */ |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 48 | static GrGpu* Create(GrBackend, GrBackendContext, GrContext* context); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 49 | |
| 50 | //////////////////////////////////////////////////////////////////////////// |
| 51 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 52 | GrGpu(GrContext* context); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 53 | virtual ~GrGpu(); |
| 54 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 55 | GrContext* getContext() { return fContext; } |
| 56 | const GrContext* getContext() const { return fContext; } |
| 57 | |
| 58 | /** |
| 59 | * Gets the capabilities of the draw target. |
| 60 | */ |
| 61 | const GrDrawTargetCaps* caps() const { return fCaps.get(); } |
| 62 | |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 63 | GrPathRendering* pathRendering() { |
| 64 | return fPathRendering.get(); |
| 65 | } |
| 66 | |
bsalomon | c8dc1f7 | 2014-08-21 13:02:13 -0700 | [diff] [blame] | 67 | // Called by GrContext when the underlying backend context has been destroyed. |
| 68 | // GrGpu should use this to ensure that no backend API calls will be made from |
| 69 | // here onward, including in its destructor. Subclasses should call |
robertphillips | e337130 | 2014-09-17 06:01:06 -0700 | [diff] [blame] | 70 | // INHERITED::contextAbandoned() if they override this. |
| 71 | virtual void contextAbandoned(); |
bsalomon | c8dc1f7 | 2014-08-21 13:02:13 -0700 | [diff] [blame] | 72 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 73 | /** |
| 74 | * The GrGpu object normally assumes that no outsider is setting state |
| 75 | * 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] | 76 | * the GrGpu that the state was modified and it shouldn't make assumptions |
| 77 | * about the state. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 78 | */ |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 79 | void markContextDirty(uint32_t state = kAll_GrBackendState) { |
| 80 | fResetBits |= state; |
| 81 | } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 82 | |
| 83 | void unimpl(const char[]); |
| 84 | |
| 85 | /** |
bsalomon@google.com | 0748f21 | 2011-02-01 22:56:16 +0000 | [diff] [blame] | 86 | * Creates a texture object. If desc width or height is not a power of |
| 87 | * two but underlying API requires a power of two texture then srcData |
| 88 | * will be embedded in a power of two texture. The extra width and height |
| 89 | * is filled as though srcData were rendered clamped into the texture. |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 90 | * The exception is when using compressed data formats. In this case, the |
| 91 | * desc width and height must be a multiple of the compressed format block |
| 92 | * size otherwise this function returns NULL. Similarly, if the underlying |
| 93 | * API requires a power of two texture and the source width and height are not |
| 94 | * a power of two, then this function returns NULL. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 95 | * |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 96 | * If kRenderTarget_TextureFlag is specified the GrRenderTarget is |
bsalomon@google.com | 1da0746 | 2011-03-10 14:51:57 +0000 | [diff] [blame] | 97 | * accessible via GrTexture::asRenderTarget(). The texture will hold a ref |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 98 | * on the render target until the texture is destroyed. Compressed textures |
| 99 | * cannot have the kRenderTarget_TextureFlag set. |
bsalomon@google.com | 1da0746 | 2011-03-10 14:51:57 +0000 | [diff] [blame] | 100 | * |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 101 | * @param desc describes the texture to be created. |
| 102 | * @param srcData texel data to load texture. Begins with full-size |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 103 | * palette data for paletted textures. For compressed |
| 104 | * formats it contains the compressed pixel data. Otherwise, |
| 105 | * it contains width*height texels. If NULL texture data |
| 106 | * is uninitialized. |
| 107 | * @param rowBytes the number of bytes between consecutive rows. Zero |
| 108 | * means rows are tightly packed. This field is ignored |
| 109 | * for compressed formats. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 110 | * |
| 111 | * @return The texture object if successful, otherwise NULL. |
| 112 | */ |
bsalomon | f2703d8 | 2014-10-28 14:33:06 -0700 | [diff] [blame] | 113 | GrTexture* createTexture(const GrSurfaceDesc& desc, |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 114 | const void* srcData, size_t rowBytes); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 115 | |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 116 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 117 | * Implements GrContext::wrapBackendTexture |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 118 | */ |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 119 | GrTexture* wrapBackendTexture(const GrBackendTextureDesc&); |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 120 | |
| 121 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 122 | * Implements GrContext::wrapBackendTexture |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 123 | */ |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 124 | GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&); |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 125 | |
| 126 | /** |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 127 | * Creates a vertex buffer. |
| 128 | * |
| 129 | * @param size size in bytes of the vertex buffer |
| 130 | * @param dynamic hints whether the data will be frequently changed |
commit-bot@chromium.org | 8341eb7 | 2014-05-07 20:51:05 +0000 | [diff] [blame] | 131 | * by either GrVertexBuffer::map() or |
| 132 | * GrVertexBuffer::updateData(). |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 133 | * |
| 134 | * @return The vertex buffer if successful, otherwise NULL. |
| 135 | */ |
robertphillips@google.com | adacc70 | 2013-10-14 21:53:24 +0000 | [diff] [blame] | 136 | GrVertexBuffer* createVertexBuffer(size_t size, bool dynamic); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 137 | |
| 138 | /** |
| 139 | * Creates an index buffer. |
| 140 | * |
| 141 | * @param size size in bytes of the index buffer |
| 142 | * @param dynamic hints whether the data will be frequently changed |
commit-bot@chromium.org | 8341eb7 | 2014-05-07 20:51:05 +0000 | [diff] [blame] | 143 | * by either GrIndexBuffer::map() or |
| 144 | * GrIndexBuffer::updateData(). |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 145 | * |
| 146 | * @return The index buffer if successful, otherwise NULL. |
| 147 | */ |
robertphillips@google.com | adacc70 | 2013-10-14 21:53:24 +0000 | [diff] [blame] | 148 | GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 149 | |
| 150 | /** |
joshualitt | 5ead6da | 2014-10-22 16:00:29 -0700 | [diff] [blame] | 151 | * Creates an index buffer for instance drawing with a specific pattern. |
| 152 | * |
| 153 | * @param pattern the pattern to repeat |
| 154 | * @param patternSize size in bytes of the pattern |
| 155 | * @param reps number of times to repeat the pattern |
| 156 | * @param vertCount number of vertices the pattern references |
| 157 | * @param dynamic hints whether the data will be frequently changed |
| 158 | * by either GrIndexBuffer::map() or |
| 159 | * GrIndexBuffer::updateData(). |
| 160 | * |
| 161 | * @return The index buffer if successful, otherwise NULL. |
| 162 | */ |
| 163 | GrIndexBuffer* createInstancedIndexBuffer(const uint16_t* pattern, |
| 164 | int patternSize, |
| 165 | int reps, |
| 166 | int vertCount, |
| 167 | bool isDynamic = false); |
| 168 | |
| 169 | /** |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 170 | * Returns an index buffer that can be used to render quads. |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 171 | * Six indices per quad: 0, 1, 2, 0, 2, 3, etc. |
| 172 | * The max number of quads can be queried using GrIndexBuffer::maxQuads(). |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 173 | * Draw with kTriangles_GrPrimitiveType |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 174 | * @ return the quad index buffer |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 175 | */ |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 176 | const GrIndexBuffer* getQuadIndexBuffer() const; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 177 | |
| 178 | /** |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 179 | * Resolves MSAA. |
| 180 | */ |
| 181 | void resolveRenderTarget(GrRenderTarget* target); |
| 182 | |
| 183 | /** |
commit-bot@chromium.org | 5d1d79a | 2013-05-24 18:52:52 +0000 | [diff] [blame] | 184 | * Gets a preferred 8888 config to use for writing/reading pixel data to/from a surface with |
| 185 | * config surfaceConfig. The returned config must have at least as many bits per channel as the |
| 186 | * readConfig or writeConfig param. |
bsalomon@google.com | 0a97be2 | 2011-11-08 19:20:57 +0000 | [diff] [blame] | 187 | */ |
commit-bot@chromium.org | 5d1d79a | 2013-05-24 18:52:52 +0000 | [diff] [blame] | 188 | virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, |
| 189 | GrPixelConfig surfaceConfig) const { |
| 190 | return readConfig; |
| 191 | } |
| 192 | virtual GrPixelConfig preferredWritePixelsConfig(GrPixelConfig writeConfig, |
| 193 | GrPixelConfig surfaceConfig) const { |
| 194 | return writeConfig; |
| 195 | } |
bsalomon@google.com | 0a97be2 | 2011-11-08 19:20:57 +0000 | [diff] [blame] | 196 | |
| 197 | /** |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 198 | * Called before uploading writing pixels to a GrTexture when the src pixel config doesn't |
| 199 | * match the texture's config. |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 200 | */ |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 201 | virtual bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const = 0; |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 202 | |
| 203 | /** |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 204 | * OpenGL's readPixels returns the result bottom-to-top while the skia |
| 205 | * API is top-to-bottom. Thus we have to do a y-axis flip. The obvious |
| 206 | * solution is to have the subclass do the flip using either the CPU or GPU. |
| 207 | * However, the caller (GrContext) may have transformations to apply and can |
| 208 | * simply fold in the y-flip for free. On the other hand, the subclass may |
| 209 | * be able to do it for free itself. For example, the subclass may have to |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 210 | * do memcpys to handle rowBytes that aren't tight. It could do the y-flip |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 211 | * concurrently. |
| 212 | * |
| 213 | * This function returns true if a y-flip is required to put the pixels in |
| 214 | * top-to-bottom order and the subclass cannot do it for free. |
| 215 | * |
| 216 | * See read pixels for the params |
| 217 | * @return true if calling readPixels with the same set of params will |
| 218 | * produce bottom-to-top data |
| 219 | */ |
| 220 | virtual bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, |
| 221 | int left, int top, |
| 222 | int width, int height, |
| 223 | GrPixelConfig config, |
bsalomon@google.com | 56d11e0 | 2011-11-30 19:59:08 +0000 | [diff] [blame] | 224 | size_t rowBytes) const = 0; |
| 225 | /** |
| 226 | * This should return true if reading a NxM rectangle of pixels from a |
| 227 | * render target is faster if the target has dimensons N and M and the read |
| 228 | * rectangle has its top-left at 0,0. |
| 229 | */ |
| 230 | virtual bool fullReadPixelsIsFasterThanPartial() const { return false; }; |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 231 | |
| 232 | /** |
bsalomon@google.com | a04e8e8 | 2012-08-27 12:53:13 +0000 | [diff] [blame] | 233 | * Reads a rectangle of pixels from a render target. |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 234 | * |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 235 | * @param renderTarget the render target to read from. NULL means the |
| 236 | * current render target. |
| 237 | * @param left left edge of the rectangle to read (inclusive) |
| 238 | * @param top top edge of the rectangle to read (inclusive) |
| 239 | * @param width width of rectangle to read in pixels. |
| 240 | * @param height height of rectangle to read in pixels. |
| 241 | * @param config the pixel config of the destination buffer |
| 242 | * @param buffer memory to read the rectangle into. |
bsalomon@google.com | c698097 | 2011-11-02 19:57:21 +0000 | [diff] [blame] | 243 | * @param rowBytes the number of bytes between consecutive rows. Zero |
| 244 | * means rows are tightly packed. |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 245 | * @param invertY buffer should be populated bottom-to-top as opposed |
| 246 | * to top-to-bottom (skia's usual order) |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 247 | * |
| 248 | * @return true if the read succeeded, false if not. The read can fail |
| 249 | * because of a unsupported pixel config or because no render |
| 250 | * target is currently set. |
| 251 | */ |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 252 | bool readPixels(GrRenderTarget* renderTarget, |
| 253 | int left, int top, int width, int height, |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 254 | GrPixelConfig config, void* buffer, size_t rowBytes); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 255 | |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 256 | /** |
| 257 | * Updates the pixels in a rectangle of a texture. |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 258 | * |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 259 | * @param left left edge of the rectangle to write (inclusive) |
| 260 | * @param top top edge of the rectangle to write (inclusive) |
| 261 | * @param width width of rectangle to write in pixels. |
| 262 | * @param height height of rectangle to write in pixels. |
| 263 | * @param config the pixel config of the source buffer |
| 264 | * @param buffer memory to read pixels from |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 265 | * @param rowBytes number of bytes between consecutive rows. Zero |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 266 | * means rows are tightly packed. |
| 267 | */ |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 268 | bool writeTexturePixels(GrTexture* texture, |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 269 | int left, int top, int width, int height, |
| 270 | GrPixelConfig config, const void* buffer, |
| 271 | size_t rowBytes); |
| 272 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 273 | /** |
| 274 | * Clear the passed in render target. Ignores the draw state and clip. Clears the whole thing if |
| 275 | * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the entire render target |
| 276 | * can be optionally cleared. |
| 277 | */ |
| 278 | void clear(const SkIRect* rect, |
| 279 | GrColor color, |
| 280 | bool canIgnoreRect, |
| 281 | GrRenderTarget* renderTarget); |
| 282 | |
| 283 | |
| 284 | void clearStencilClip(const SkIRect& rect, |
| 285 | bool insideClip, |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 286 | GrRenderTarget* renderTarget); |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 287 | |
| 288 | /** |
| 289 | * Discards the contents render target. NULL indicates that the current render target should |
| 290 | * be discarded. |
| 291 | **/ |
| 292 | virtual void discard(GrRenderTarget* = NULL) = 0; |
| 293 | |
| 294 | /** |
| 295 | * This is can be called before allocating a texture to be a dst for copySurface. It will |
| 296 | * populate the origin, config, and flags fields of the desc such that copySurface is more |
| 297 | * likely to succeed and be efficient. |
| 298 | */ |
| 299 | virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc); |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 300 | |
bsalomon@google.com | 80d09b9 | 2011-11-05 21:21:13 +0000 | [diff] [blame] | 301 | // After the client interacts directly with the 3D context state the GrGpu |
| 302 | // must resync its internal state and assumptions about 3D context state. |
| 303 | // Each time this occurs the GrGpu bumps a timestamp. |
| 304 | // state of the 3D context |
| 305 | // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about |
| 306 | // a billion years. |
| 307 | typedef uint64_t ResetTimestamp; |
| 308 | |
| 309 | // This timestamp is always older than the current timestamp |
| 310 | static const ResetTimestamp kExpiredTimestamp = 0; |
| 311 | // Returns a timestamp based on the number of times the context was reset. |
| 312 | // This timestamp can be used to lazily detect when cached 3D context state |
| 313 | // is dirty. |
| 314 | ResetTimestamp getResetTimestamp() const { |
| 315 | return fResetTimestamp; |
| 316 | } |
| 317 | |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 318 | enum DrawType { |
| 319 | kDrawPoints_DrawType, |
| 320 | kDrawLines_DrawType, |
| 321 | kDrawTriangles_DrawType, |
| 322 | kStencilPath_DrawType, |
commit-bot@chromium.org | 32184d8 | 2013-10-09 15:14:18 +0000 | [diff] [blame] | 323 | kDrawPath_DrawType, |
commit-bot@chromium.org | 9b62aa1 | 2014-03-25 11:59:40 +0000 | [diff] [blame] | 324 | kDrawPaths_DrawType, |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 325 | }; |
| 326 | |
kkinnunen | ec56e45 | 2014-08-25 22:21:16 -0700 | [diff] [blame] | 327 | static bool IsPathRenderingDrawType(DrawType type) { |
| 328 | return kDrawPath_DrawType == type || kDrawPaths_DrawType == type; |
| 329 | } |
| 330 | |
robertphillips | 754f4e9 | 2014-09-18 13:52:08 -0700 | [diff] [blame] | 331 | GrContext::GPUStats* gpuStats() { return &fGPUStats; } |
| 332 | |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 333 | virtual void buildProgramDesc(const GrOptDrawState&, |
| 334 | const GrProgramDesc::DescInfo&, |
| 335 | GrGpu::DrawType, |
| 336 | const GrDeviceCoordTexture* dstCopy, |
| 337 | GrProgramDesc*) = 0; |
| 338 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 339 | /** |
| 340 | * Called at start and end of gpu trace marking |
| 341 | * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call these at the start |
| 342 | * and end of a code block respectively |
| 343 | */ |
| 344 | void addGpuTraceMarker(const GrGpuTraceMarker* marker); |
| 345 | void removeGpuTraceMarker(const GrGpuTraceMarker* marker); |
| 346 | |
| 347 | /** |
| 348 | * Takes the current active set of markers and stores them for later use. Any current marker |
| 349 | * in the active set is removed from the active set and the targets remove function is called. |
| 350 | * These functions do not work as a stack so you cannot call save a second time before calling |
| 351 | * restore. Also, it is assumed that when restore is called the current active set of markers |
| 352 | * is empty. When the stored markers are added back into the active set, the targets add marker |
| 353 | * is called. |
| 354 | */ |
| 355 | void saveActiveTraceMarkers(); |
| 356 | void restoreActiveTraceMarkers(); |
| 357 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 358 | // Called to determine whether an onCopySurface call would succeed or not. This is useful for |
| 359 | // proxy subclasses to test whether the copy would succeed without executing it yet. Derived |
| 360 | // classes must keep this consistent with their implementation of onCopySurface(). The inputs |
| 361 | // are the same as onCopySurface(), i.e. srcRect and dstPoint are clipped to be inside the src |
| 362 | // and dst bounds. |
| 363 | virtual bool canCopySurface(GrSurface* dst, |
| 364 | GrSurface* src, |
| 365 | const SkIRect& srcRect, |
| 366 | const SkIPoint& dstPoint) = 0; |
| 367 | |
| 368 | // This method is called by copySurface The srcRect is guaranteed to be entirely within the |
| 369 | // src bounds. Likewise, the dst rect implied by dstPoint and srcRect's width and height falls |
| 370 | // entirely within the dst. The default implementation will draw a rect from the src to the |
| 371 | // dst if the src is a texture and the dst is a render target and fail otherwise. |
| 372 | virtual bool copySurface(GrSurface* dst, |
| 373 | GrSurface* src, |
| 374 | const SkIRect& srcRect, |
| 375 | const SkIPoint& dstPoint) = 0; |
| 376 | |
| 377 | /** |
| 378 | * Sets source of vertex data for the next draw. Data does not have to be |
| 379 | * in the buffer until drawIndexed, drawNonIndexed, or drawIndexedInstances. |
| 380 | * |
| 381 | * @param buffer vertex buffer containing vertex data. Must be |
| 382 | * unlocked before draw call. Vertex size is queried |
| 383 | * from current GrDrawState. |
| 384 | */ |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 385 | void setVertexSourceToBuffer(const GrVertexBuffer* buffer, size_t vertexStride); |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 386 | |
| 387 | /** |
| 388 | * Sets source of index data for the next indexed draw. Data does not have |
| 389 | * to be in the buffer until drawIndexed. |
| 390 | * |
| 391 | * @param buffer index buffer containing indices. Must be unlocked |
| 392 | * before indexed draw call. |
| 393 | */ |
| 394 | void setIndexSourceToBuffer(const GrIndexBuffer* buffer); |
| 395 | |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 396 | virtual void draw(const GrOptDrawState&, |
| 397 | const GrDrawTarget::DrawInfo&, |
joshualitt | 4b68ec0 | 2014-11-07 14:11:45 -0800 | [diff] [blame] | 398 | const GrClipMaskManager::ScissorState&); |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 399 | virtual void stencilPath(const GrOptDrawState&, |
| 400 | const GrPath*, |
joshualitt | 4b68ec0 | 2014-11-07 14:11:45 -0800 | [diff] [blame] | 401 | const GrClipMaskManager::ScissorState&, |
| 402 | const GrStencilSettings&); |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 403 | virtual void drawPath(const GrOptDrawState&, |
| 404 | const GrPath*, |
joshualitt | 4b68ec0 | 2014-11-07 14:11:45 -0800 | [diff] [blame] | 405 | const GrClipMaskManager::ScissorState&, |
| 406 | const GrStencilSettings&, |
| 407 | const GrDeviceCoordTexture* dstCopy); |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 408 | virtual void drawPaths(const GrOptDrawState&, |
| 409 | const GrPathRange*, |
joshualitt | 4b68ec0 | 2014-11-07 14:11:45 -0800 | [diff] [blame] | 410 | const uint32_t indices[], |
| 411 | int count, |
| 412 | const float transforms[], |
| 413 | GrDrawTarget::PathTransformType, |
| 414 | const GrClipMaskManager::ScissorState&, |
| 415 | const GrStencilSettings&, |
| 416 | const GrDeviceCoordTexture*); |
| 417 | |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 418 | static DrawType PrimTypeToDrawType(GrPrimitiveType type) { |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 419 | switch (type) { |
| 420 | case kTriangles_GrPrimitiveType: |
| 421 | case kTriangleStrip_GrPrimitiveType: |
| 422 | case kTriangleFan_GrPrimitiveType: |
| 423 | return kDrawTriangles_DrawType; |
| 424 | case kPoints_GrPrimitiveType: |
| 425 | return kDrawPoints_DrawType; |
| 426 | case kLines_GrPrimitiveType: |
| 427 | case kLineStrip_GrPrimitiveType: |
| 428 | return kDrawLines_DrawType; |
| 429 | default: |
commit-bot@chromium.org | 88cb22b | 2014-04-30 14:17:00 +0000 | [diff] [blame] | 430 | SkFAIL("Unexpected primitive type"); |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 431 | return kDrawTriangles_DrawType; |
| 432 | } |
| 433 | } |
| 434 | |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 435 | protected: |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 436 | // Functions used to map clip-respecting stencil tests into normal |
| 437 | // stencil funcs supported by GPUs. |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 438 | static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 439 | GrStencilFunc func); |
| 440 | static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 441 | bool clipInStencil, |
| 442 | unsigned int clipBit, |
| 443 | unsigned int userBits, |
| 444 | unsigned int* ref, |
| 445 | unsigned int* mask); |
| 446 | |
joshualitt | f4e5e33 | 2014-11-07 12:58:46 -0800 | [diff] [blame] | 447 | struct GeometrySrcState { |
| 448 | GeometrySrcState() : fVertexBuffer(NULL), fIndexBuffer(NULL), fVertexSize(0) {} |
| 449 | const GrVertexBuffer* fVertexBuffer; |
| 450 | const GrIndexBuffer* fIndexBuffer; |
| 451 | size_t fVertexSize; |
| 452 | }; |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 453 | |
| 454 | // accessors for derived classes |
joshualitt | f4e5e33 | 2014-11-07 12:58:46 -0800 | [diff] [blame] | 455 | const GeometrySrcState& getGeomSrc() const { return fGeoSrcState; } |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 456 | |
| 457 | // it is preferable to call this rather than getGeomSrc()->fVertexSize because of the assert. |
| 458 | size_t getVertexSize() const { |
| 459 | // the vertex layout is only valid if a vertex source has been specified. |
joshualitt | f4e5e33 | 2014-11-07 12:58:46 -0800 | [diff] [blame] | 460 | SkASSERT(this->getGeomSrc().fVertexBuffer); |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 461 | return this->getGeomSrc().fVertexSize; |
| 462 | } |
| 463 | |
| 464 | const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers; } |
| 465 | |
robertphillips | 754f4e9 | 2014-09-18 13:52:08 -0700 | [diff] [blame] | 466 | GrContext::GPUStats fGPUStats; |
| 467 | |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 468 | SkAutoTDelete<GrPathRendering> fPathRendering; |
| 469 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 470 | // Subclass must initialize this in its constructor. |
| 471 | SkAutoTUnref<const GrDrawTargetCaps> fCaps; |
| 472 | |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 473 | private: |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 474 | // 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] | 475 | // assumed 3D context state and dirty any state cache. |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 476 | virtual void onResetContext(uint32_t resetBits) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 477 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 478 | // overridden by backend-specific derived class to create objects. |
bsalomon | f2703d8 | 2014-10-28 14:33:06 -0700 | [diff] [blame] | 479 | virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, |
bsalomon@google.com | bcdbbe6 | 2011-04-12 15:40:00 +0000 | [diff] [blame] | 480 | const void* srcData, |
| 481 | size_t rowBytes) = 0; |
bsalomon | f2703d8 | 2014-10-28 14:33:06 -0700 | [diff] [blame] | 482 | virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 483 | const void* srcData) = 0; |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 484 | virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; |
| 485 | virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) = 0; |
robertphillips@google.com | adacc70 | 2013-10-14 21:53:24 +0000 | [diff] [blame] | 486 | virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
| 487 | virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 488 | |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 489 | // overridden by backend-specific derived class to perform the clear. |
joshualitt | 4b68ec0 | 2014-11-07 14:11:45 -0800 | [diff] [blame] | 490 | virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
| 491 | bool canIgnoreRect) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 492 | |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 493 | |
| 494 | // Overridden by backend specific classes to perform a clear of the stencil clip bits. This is |
| 495 | // ONLY used by the the clip target |
| 496 | virtual void onClearStencilClip(GrRenderTarget*, |
| 497 | const SkIRect& rect, |
| 498 | bool insideClip) = 0; |
| 499 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 500 | // overridden by backend-specific derived class to perform the draw call. |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 501 | virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) = 0; |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 502 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 503 | // overridden by backend-specific derived class to perform the read pixels. |
bsalomon@google.com | 5877ffd | 2011-04-11 17:58:48 +0000 | [diff] [blame] | 504 | virtual bool onReadPixels(GrRenderTarget* target, |
| 505 | int left, int top, int width, int height, |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 506 | GrPixelConfig, |
| 507 | void* buffer, |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 508 | size_t rowBytes) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 509 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 510 | // overridden by backend-specific derived class to perform the texture update |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 511 | virtual bool onWriteTexturePixels(GrTexture* texture, |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 512 | int left, int top, int width, int height, |
| 513 | GrPixelConfig config, const void* buffer, |
| 514 | size_t rowBytes) = 0; |
| 515 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 516 | // overridden by backend-specific derived class to perform the resolve |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 517 | virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
| 518 | |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 519 | // width and height may be larger than rt (if underlying API allows it). |
| 520 | // Should attach the SB to the RT. Returns false if compatible sb could |
| 521 | // not be created. |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 522 | virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, int height) = 0; |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 523 | |
| 524 | // attaches an existing SB to an existing RT. |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 525 | virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTarget*) = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 526 | |
| 527 | // The GrGpu typically records the clients requested state and then flushes |
| 528 | // deltas from previous state at draw time. This function does the |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 529 | // backend-specific flush of the state. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 530 | // returns false if current state is unsupported. |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame^] | 531 | virtual bool flushGraphicsState(const GrOptDrawState&, |
| 532 | DrawType, |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 533 | const GrClipMaskManager::ScissorState&, |
joshualitt | 77b1307 | 2014-10-27 14:51:01 -0700 | [diff] [blame] | 534 | const GrDeviceCoordTexture* dstCopy) = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 535 | |
bsalomon | b0bd4f6 | 2014-09-03 07:19:50 -0700 | [diff] [blame] | 536 | // clears target's entire stencil buffer to 0 |
| 537 | virtual void clearStencil(GrRenderTarget* target) = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 538 | |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 539 | // Given a rt, find or create a stencil buffer and attach it |
| 540 | bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 541 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 542 | virtual void didAddGpuTraceMarker() = 0; |
| 543 | virtual void didRemoveGpuTraceMarker() = 0; |
| 544 | |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 545 | void resetContext() { |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 546 | this->onResetContext(fResetBits); |
| 547 | fResetBits = 0; |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 548 | ++fResetTimestamp; |
| 549 | } |
| 550 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 551 | void handleDirtyContext() { |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 552 | if (fResetBits) { |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 553 | this->resetContext(); |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 554 | } |
| 555 | } |
| 556 | |
joshualitt | f4e5e33 | 2014-11-07 12:58:46 -0800 | [diff] [blame] | 557 | GeometrySrcState fGeoSrcState; |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 558 | ResetTimestamp fResetTimestamp; |
bsalomon@google.com | 0a208a1 | 2013-06-28 18:57:35 +0000 | [diff] [blame] | 559 | uint32_t fResetBits; |
bsalomon@google.com | 6438695 | 2013-02-08 21:22:44 +0000 | [diff] [blame] | 560 | // these are mutable so they can be created on-demand |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 561 | mutable GrIndexBuffer* fQuadIndexBuffer; |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 562 | // To keep track that we always have at least as many debug marker adds as removes |
| 563 | int fGpuTraceMarkerCount; |
| 564 | GrTraceMarkerSet fActiveTraceMarkers; |
| 565 | GrTraceMarkerSet fStoredTraceMarkers; |
| 566 | // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 567 | GrContext* fContext; |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 568 | |
joshualitt | 3322fa4 | 2014-11-07 08:48:51 -0800 | [diff] [blame] | 569 | typedef SkRefCnt INHERITED; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 570 | }; |
| 571 | |
| 572 | #endif |