epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 10 | #ifndef GrGpu_DEFINED |
| 11 | #define GrGpu_DEFINED |
| 12 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 13 | #include "GrDrawTarget.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 14 | #include "GrRect.h" |
| 15 | #include "GrRefCnt.h" |
robertphillips@google.com | 1e945b7 | 2012-04-16 18:03:03 +0000 | [diff] [blame] | 16 | #include "GrClipMaskManager.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 17 | |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 18 | #include "SkPath.h" |
| 19 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 20 | class GrContext; |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 21 | class GrIndexBufferAllocPool; |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 22 | class GrPath; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 23 | class GrPathRenderer; |
| 24 | class GrPathRendererChain; |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 25 | class GrResource; |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 26 | class GrStencilBuffer; |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 27 | class GrVertexBufferAllocPool; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 28 | |
| 29 | class GrGpu : public GrDrawTarget { |
| 30 | |
| 31 | public: |
bsalomon@google.com | 18c9c19 | 2011-09-22 21:01:31 +0000 | [diff] [blame] | 32 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 33 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 34 | * Additional blend coefficients for dual source blending, not exposed |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 35 | * through GrPaint/GrContext. |
| 36 | */ |
| 37 | enum ExtendedBlendCoeffs { |
| 38 | // source 2 refers to second output color when |
| 39 | // using dual source blending. |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 40 | kS2C_GrBlendCoeff = kPublicGrBlendCoeffCount, |
| 41 | kIS2C_GrBlendCoeff, |
| 42 | kS2A_GrBlendCoeff, |
| 43 | kIS2A_GrBlendCoeff, |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 44 | |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 45 | kTotalGrBlendCoeffCount |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 49 | * 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] | 50 | * not supported (at compile-time or run-time) this returns NULL. The context will not be |
| 51 | * 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] | 52 | */ |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 53 | static GrGpu* Create(GrBackend, GrBackendContext, GrContext* context); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 54 | |
| 55 | //////////////////////////////////////////////////////////////////////////// |
| 56 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 57 | GrGpu(GrContext* context); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 58 | virtual ~GrGpu(); |
| 59 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 60 | GrContext* getContext() { return this->INHERITED::getContext(); } |
| 61 | const GrContext* getContext() const { return this->INHERITED::getContext(); } |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 62 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 63 | /** |
| 64 | * The GrGpu object normally assumes that no outsider is setting state |
| 65 | * 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] | 66 | * the GrGpu that the state was modified and it shouldn't make assumptions |
| 67 | * about the state. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 68 | */ |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 69 | void markContextDirty() { fContextIsDirty = true; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 70 | |
| 71 | void unimpl(const char[]); |
| 72 | |
| 73 | /** |
bsalomon@google.com | 0748f21 | 2011-02-01 22:56:16 +0000 | [diff] [blame] | 74 | * Creates a texture object. If desc width or height is not a power of |
| 75 | * two but underlying API requires a power of two texture then srcData |
| 76 | * will be embedded in a power of two texture. The extra width and height |
| 77 | * is filled as though srcData were rendered clamped into the texture. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 78 | * |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 79 | * If kRenderTarget_TextureFlag is specified the GrRenderTarget is |
bsalomon@google.com | 1da0746 | 2011-03-10 14:51:57 +0000 | [diff] [blame] | 80 | * accessible via GrTexture::asRenderTarget(). The texture will hold a ref |
bsalomon@google.com | 686bcb8 | 2013-04-09 15:04:12 +0000 | [diff] [blame] | 81 | * on the render target until the texture is destroyed. |
bsalomon@google.com | 1da0746 | 2011-03-10 14:51:57 +0000 | [diff] [blame] | 82 | * |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 83 | * @param desc describes the texture to be created. |
| 84 | * @param srcData texel data to load texture. Begins with full-size |
| 85 | * palette data for paletted textures. Contains width* |
| 86 | * height texels. If NULL texture data is uninitialized. |
| 87 | * |
| 88 | * @return The texture object if successful, otherwise NULL. |
| 89 | */ |
bsalomon@google.com | fea37b5 | 2011-04-25 15:51:06 +0000 | [diff] [blame] | 90 | GrTexture* createTexture(const GrTextureDesc& desc, |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 91 | const void* srcData, size_t rowBytes); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 92 | |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 93 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 94 | * Implements GrContext::wrapBackendTexture |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 95 | */ |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 96 | GrTexture* wrapBackendTexture(const GrBackendTextureDesc&); |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 97 | |
| 98 | /** |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 99 | * Implements GrContext::wrapBackendTexture |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 100 | */ |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 101 | GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&); |
bsalomon@google.com | e269f21 | 2011-11-07 13:29:52 +0000 | [diff] [blame] | 102 | |
| 103 | /** |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 104 | * Creates a vertex buffer. |
| 105 | * |
| 106 | * @param size size in bytes of the vertex buffer |
| 107 | * @param dynamic hints whether the data will be frequently changed |
| 108 | * by either GrVertexBuffer::lock or |
| 109 | * GrVertexBuffer::updateData. |
| 110 | * |
| 111 | * @return The vertex buffer if successful, otherwise NULL. |
| 112 | */ |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 113 | GrVertexBuffer* createVertexBuffer(uint32_t size, bool dynamic); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * Creates an index buffer. |
| 117 | * |
| 118 | * @param size size in bytes of the index buffer |
| 119 | * @param dynamic hints whether the data will be frequently changed |
| 120 | * by either GrIndexBuffer::lock or |
| 121 | * GrIndexBuffer::updateData. |
| 122 | * |
| 123 | * @return The index buffer if successful, otherwise NULL. |
| 124 | */ |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 125 | GrIndexBuffer* createIndexBuffer(uint32_t size, bool dynamic); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 126 | |
| 127 | /** |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 128 | * Creates a path object that can be stenciled using stencilPath(). It is |
| 129 | * only legal to call this if the caps report support for path stenciling. |
| 130 | */ |
| 131 | GrPath* createPath(const SkPath& path); |
| 132 | |
| 133 | /** |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 134 | * Returns an index buffer that can be used to render quads. |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 135 | * Six indices per quad: 0, 1, 2, 0, 2, 3, etc. |
| 136 | * The max number of quads can be queried using GrIndexBuffer::maxQuads(). |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 137 | * Draw with kTriangles_GrPrimitiveType |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 138 | * @ return the quad index buffer |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 139 | */ |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 140 | const GrIndexBuffer* getQuadIndexBuffer() const; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 141 | |
| 142 | /** |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 143 | * Resolves MSAA. |
| 144 | */ |
| 145 | void resolveRenderTarget(GrRenderTarget* target); |
| 146 | |
| 147 | /** |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 148 | * Ensures that the current render target is actually set in the |
| 149 | * underlying 3D API. Used when client wants to use 3D API to directly |
| 150 | * render to the RT. |
| 151 | */ |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 152 | void forceRenderTargetFlush(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 153 | |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 154 | /** |
commit-bot@chromium.org | 5d1d79a | 2013-05-24 18:52:52 +0000 | [diff] [blame^] | 155 | * Gets a preferred 8888 config to use for writing/reading pixel data to/from a surface with |
| 156 | * config surfaceConfig. The returned config must have at least as many bits per channel as the |
| 157 | * readConfig or writeConfig param. |
bsalomon@google.com | 0a97be2 | 2011-11-08 19:20:57 +0000 | [diff] [blame] | 158 | */ |
commit-bot@chromium.org | 5d1d79a | 2013-05-24 18:52:52 +0000 | [diff] [blame^] | 159 | virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, |
| 160 | GrPixelConfig surfaceConfig) const { |
| 161 | return readConfig; |
| 162 | } |
| 163 | virtual GrPixelConfig preferredWritePixelsConfig(GrPixelConfig writeConfig, |
| 164 | GrPixelConfig surfaceConfig) const { |
| 165 | return writeConfig; |
| 166 | } |
bsalomon@google.com | 0a97be2 | 2011-11-08 19:20:57 +0000 | [diff] [blame] | 167 | |
| 168 | /** |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 169 | * Called before uploading writing pixels to a GrTexture when the src pixel config doesn't |
| 170 | * match the texture's config. |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 171 | */ |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 172 | virtual bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const = 0; |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 173 | |
| 174 | /** |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 175 | * OpenGL's readPixels returns the result bottom-to-top while the skia |
| 176 | * API is top-to-bottom. Thus we have to do a y-axis flip. The obvious |
| 177 | * solution is to have the subclass do the flip using either the CPU or GPU. |
| 178 | * However, the caller (GrContext) may have transformations to apply and can |
| 179 | * simply fold in the y-flip for free. On the other hand, the subclass may |
| 180 | * 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] | 181 | * 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] | 182 | * concurrently. |
| 183 | * |
| 184 | * This function returns true if a y-flip is required to put the pixels in |
| 185 | * top-to-bottom order and the subclass cannot do it for free. |
| 186 | * |
| 187 | * See read pixels for the params |
| 188 | * @return true if calling readPixels with the same set of params will |
| 189 | * produce bottom-to-top data |
| 190 | */ |
| 191 | virtual bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, |
| 192 | int left, int top, |
| 193 | int width, int height, |
| 194 | GrPixelConfig config, |
bsalomon@google.com | 56d11e0 | 2011-11-30 19:59:08 +0000 | [diff] [blame] | 195 | size_t rowBytes) const = 0; |
| 196 | /** |
| 197 | * This should return true if reading a NxM rectangle of pixels from a |
| 198 | * render target is faster if the target has dimensons N and M and the read |
| 199 | * rectangle has its top-left at 0,0. |
| 200 | */ |
| 201 | virtual bool fullReadPixelsIsFasterThanPartial() const { return false; }; |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 202 | |
| 203 | /** |
bsalomon@google.com | a04e8e8 | 2012-08-27 12:53:13 +0000 | [diff] [blame] | 204 | * Reads a rectangle of pixels from a render target. |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 205 | * |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 206 | * @param renderTarget the render target to read from. NULL means the |
| 207 | * current render target. |
| 208 | * @param left left edge of the rectangle to read (inclusive) |
| 209 | * @param top top edge of the rectangle to read (inclusive) |
| 210 | * @param width width of rectangle to read in pixels. |
| 211 | * @param height height of rectangle to read in pixels. |
| 212 | * @param config the pixel config of the destination buffer |
| 213 | * @param buffer memory to read the rectangle into. |
bsalomon@google.com | c698097 | 2011-11-02 19:57:21 +0000 | [diff] [blame] | 214 | * @param rowBytes the number of bytes between consecutive rows. Zero |
| 215 | * means rows are tightly packed. |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 216 | * @param invertY buffer should be populated bottom-to-top as opposed |
| 217 | * to top-to-bottom (skia's usual order) |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 218 | * |
| 219 | * @return true if the read succeeded, false if not. The read can fail |
| 220 | * because of a unsupported pixel config or because no render |
| 221 | * target is currently set. |
| 222 | */ |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 223 | bool readPixels(GrRenderTarget* renderTarget, |
| 224 | int left, int top, int width, int height, |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 225 | GrPixelConfig config, void* buffer, size_t rowBytes); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 226 | |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 227 | /** |
| 228 | * Updates the pixels in a rectangle of a texture. |
bsalomon@google.com | a85449d | 2011-11-19 02:36:05 +0000 | [diff] [blame] | 229 | * |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 230 | * @param left left edge of the rectangle to write (inclusive) |
| 231 | * @param top top edge of the rectangle to write (inclusive) |
| 232 | * @param width width of rectangle to write in pixels. |
| 233 | * @param height height of rectangle to write in pixels. |
| 234 | * @param config the pixel config of the source buffer |
| 235 | * @param buffer memory to read pixels from |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 236 | * @param rowBytes number of bytes between consecutive rows. Zero |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 237 | * means rows are tightly packed. |
| 238 | */ |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 239 | bool writeTexturePixels(GrTexture* texture, |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 240 | int left, int top, int width, int height, |
| 241 | GrPixelConfig config, const void* buffer, |
| 242 | size_t rowBytes); |
| 243 | |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 244 | /** |
| 245 | * Called to tell Gpu object that all GrResources have been lost and should |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 246 | * be abandoned. Overrides must call INHERITED::abandonResources(). |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 247 | */ |
junov@google.com | 53a5584 | 2011-06-08 22:55:10 +0000 | [diff] [blame] | 248 | virtual void abandonResources(); |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 249 | |
| 250 | /** |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 251 | * Called to tell Gpu object to release all GrResources. Overrides must call |
| 252 | * INHERITED::releaseResources(). |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 253 | */ |
| 254 | void releaseResources(); |
| 255 | |
| 256 | /** |
| 257 | * Add resource to list of resources. Should only be called by GrResource. |
| 258 | * @param resource the resource to add. |
| 259 | */ |
| 260 | void insertResource(GrResource* resource); |
| 261 | |
| 262 | /** |
| 263 | * Remove resource from list of resources. Should only be called by |
| 264 | * GrResource. |
| 265 | * @param resource the resource to remove. |
| 266 | */ |
| 267 | void removeResource(GrResource* resource); |
| 268 | |
bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 269 | // GrDrawTarget overrides |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 270 | virtual void clear(const GrIRect* rect, |
robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 271 | GrColor color, |
| 272 | GrRenderTarget* renderTarget = NULL) SK_OVERRIDE; |
bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 273 | |
robertphillips@google.com | ff17584 | 2012-05-14 19:31:39 +0000 | [diff] [blame] | 274 | virtual void purgeResources() SK_OVERRIDE { |
| 275 | // The clip mask manager can rebuild all its clip masks so just |
| 276 | // get rid of them all. |
| 277 | fClipMaskManager.releaseResources(); |
| 278 | } |
| 279 | |
bsalomon@google.com | 80d09b9 | 2011-11-05 21:21:13 +0000 | [diff] [blame] | 280 | // After the client interacts directly with the 3D context state the GrGpu |
| 281 | // must resync its internal state and assumptions about 3D context state. |
| 282 | // Each time this occurs the GrGpu bumps a timestamp. |
| 283 | // state of the 3D context |
| 284 | // At 10 resets / frame and 60fps a 64bit timestamp will overflow in about |
| 285 | // a billion years. |
| 286 | typedef uint64_t ResetTimestamp; |
| 287 | |
| 288 | // This timestamp is always older than the current timestamp |
| 289 | static const ResetTimestamp kExpiredTimestamp = 0; |
| 290 | // Returns a timestamp based on the number of times the context was reset. |
| 291 | // This timestamp can be used to lazily detect when cached 3D context state |
| 292 | // is dirty. |
| 293 | ResetTimestamp getResetTimestamp() const { |
| 294 | return fResetTimestamp; |
| 295 | } |
| 296 | |
robertphillips@google.com | 99a5ac0 | 2012-04-10 19:26:38 +0000 | [diff] [blame] | 297 | /** |
| 298 | * Can the provided configuration act as a color render target? |
| 299 | */ |
| 300 | bool isConfigRenderable(GrPixelConfig config) const { |
bsalomon@google.com | b8eb2e8 | 2013-03-28 13:46:42 +0000 | [diff] [blame] | 301 | GrAssert(kGrPixelConfigCnt > config); |
robertphillips@google.com | 99a5ac0 | 2012-04-10 19:26:38 +0000 | [diff] [blame] | 302 | return fConfigRenderSupport[config]; |
| 303 | } |
| 304 | |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 305 | /** |
| 306 | * These methods are called by the clip manager's setupClipping function |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 307 | * which (called as part of GrGpu's implementation of onDraw and |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 308 | * onStencilPath member functions.) The GrGpu subclass should flush the |
| 309 | * stencil state to the 3D API in its implementation of flushGraphicsState. |
| 310 | */ |
| 311 | void enableScissor(const GrIRect& rect) { |
| 312 | fScissorState.fEnabled = true; |
| 313 | fScissorState.fRect = rect; |
| 314 | } |
| 315 | void disableScissor() { fScissorState.fEnabled = false; } |
| 316 | |
| 317 | /** |
| 318 | * Like the scissor methods above this is called by setupClipping and |
| 319 | * should be flushed by the GrGpu subclass in flushGraphicsState. These |
| 320 | * stencil settings should be used in place of those on the GrDrawState. |
| 321 | * They have been adjusted to account for any interactions between the |
| 322 | * GrDrawState's stencil settings and stencil clipping. |
| 323 | */ |
| 324 | void setStencilSettings(const GrStencilSettings& settings) { |
| 325 | fStencilSettings = settings; |
| 326 | } |
| 327 | void disableStencil() { fStencilSettings.setDisabled(); } |
robertphillips@google.com | 730ebe5 | 2012-04-16 16:33:13 +0000 | [diff] [blame] | 328 | |
| 329 | // GrGpu subclass sets clip bit in the stencil buffer. The subclass is |
| 330 | // free to clear the remaining bits to zero if masked clears are more |
| 331 | // expensive than clearing all bits. |
| 332 | virtual void clearStencilClip(const GrIRect& rect, bool insideClip) = 0; |
| 333 | |
bsalomon@google.com | 8f9cbd6 | 2011-12-09 15:55:34 +0000 | [diff] [blame] | 334 | enum PrivateDrawStateStateBits { |
| 335 | kFirstBit = (GrDrawState::kLastPublicStateBit << 1), |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 336 | |
| 337 | kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify |
| 338 | // stencil bits used for |
| 339 | // clipping. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 340 | }; |
| 341 | |
robertphillips@google.com | 730ebe5 | 2012-04-16 16:33:13 +0000 | [diff] [blame] | 342 | protected: |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 343 | enum DrawType { |
| 344 | kDrawPoints_DrawType, |
| 345 | kDrawLines_DrawType, |
| 346 | kDrawTriangles_DrawType, |
| 347 | kStencilPath_DrawType, |
| 348 | }; |
| 349 | |
| 350 | DrawType PrimTypeToDrawType(GrPrimitiveType type) { |
| 351 | switch (type) { |
| 352 | case kTriangles_GrPrimitiveType: |
| 353 | case kTriangleStrip_GrPrimitiveType: |
| 354 | case kTriangleFan_GrPrimitiveType: |
| 355 | return kDrawTriangles_DrawType; |
| 356 | case kPoints_GrPrimitiveType: |
| 357 | return kDrawPoints_DrawType; |
| 358 | case kLines_GrPrimitiveType: |
| 359 | case kLineStrip_GrPrimitiveType: |
| 360 | return kDrawLines_DrawType; |
| 361 | default: |
| 362 | GrCrash("Unexpected primitive type"); |
| 363 | return kDrawTriangles_DrawType; |
| 364 | } |
| 365 | } |
| 366 | |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 367 | // prepares clip flushes gpu state before a draw |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 368 | bool setupClipAndFlushState(DrawType, const GrDeviceCoordTexture* dstCopy); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 369 | |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 370 | // Functions used to map clip-respecting stencil tests into normal |
| 371 | // stencil funcs supported by GPUs. |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 372 | static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 373 | GrStencilFunc func); |
| 374 | static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 375 | bool clipInStencil, |
| 376 | unsigned int clipBit, |
| 377 | unsigned int userBits, |
| 378 | unsigned int* ref, |
| 379 | unsigned int* mask); |
| 380 | |
robertphillips@google.com | 730ebe5 | 2012-04-16 16:33:13 +0000 | [diff] [blame] | 381 | GrClipMaskManager fClipMaskManager; |
| 382 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 383 | struct GeometryPoolState { |
| 384 | const GrVertexBuffer* fPoolVertexBuffer; |
| 385 | int fPoolStartVertex; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 386 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 387 | const GrIndexBuffer* fPoolIndexBuffer; |
| 388 | int fPoolStartIndex; |
| 389 | }; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 390 | const GeometryPoolState& getGeomPoolState() { |
| 391 | return fGeomPoolStateStack.back(); |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 392 | } |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 393 | |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 394 | // The state of the scissor is controlled by the clip manager |
| 395 | struct ScissorState { |
| 396 | bool fEnabled; |
| 397 | GrIRect fRect; |
| 398 | } fScissorState; |
| 399 | |
| 400 | // The final stencil settings to use as determined by the clip manager. |
| 401 | GrStencilSettings fStencilSettings; |
| 402 | |
robertphillips@google.com | 99a5ac0 | 2012-04-10 19:26:38 +0000 | [diff] [blame] | 403 | // Derived classes need access to this so they can fill it out in their |
| 404 | // constructors |
bsalomon@google.com | b8eb2e8 | 2013-03-28 13:46:42 +0000 | [diff] [blame] | 405 | bool fConfigRenderSupport[kGrPixelConfigCnt]; |
robertphillips@google.com | 99a5ac0 | 2012-04-10 19:26:38 +0000 | [diff] [blame] | 406 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 407 | // Helpers for setting up geometry state |
| 408 | void finalizeReservedVertices(); |
| 409 | void finalizeReservedIndices(); |
| 410 | |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 411 | private: |
| 412 | // GrDrawTarget overrides |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 413 | virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertices) SK_OVERRIDE; |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 414 | virtual bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE; |
| 415 | virtual void releaseReservedVertexSpace() SK_OVERRIDE; |
| 416 | virtual void releaseReservedIndexSpace() SK_OVERRIDE; |
| 417 | virtual void onSetVertexSourceToArray(const void* vertexArray, int vertexCount) SK_OVERRIDE; |
| 418 | virtual void onSetIndexSourceToArray(const void* indexArray, int indexCount) SK_OVERRIDE; |
| 419 | virtual void releaseVertexArray() SK_OVERRIDE; |
| 420 | virtual void releaseIndexArray() SK_OVERRIDE; |
| 421 | virtual void geometrySourceWillPush() SK_OVERRIDE; |
| 422 | virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) SK_OVERRIDE; |
| 423 | |
| 424 | |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 425 | // 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] | 426 | // assumed 3D context state and dirty any state cache. |
bsalomon@google.com | 1bf1c21 | 2011-11-05 12:18:58 +0000 | [diff] [blame] | 427 | virtual void onResetContext() = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 428 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 429 | // overridden by backend-specific derived class to create objects. |
bsalomon@google.com | fea37b5 | 2011-04-25 15:51:06 +0000 | [diff] [blame] | 430 | virtual GrTexture* onCreateTexture(const GrTextureDesc& desc, |
bsalomon@google.com | bcdbbe6 | 2011-04-12 15:40:00 +0000 | [diff] [blame] | 431 | const void* srcData, |
| 432 | size_t rowBytes) = 0; |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 433 | virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; |
| 434 | virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) = 0; |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 435 | virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) = 0; |
| 436 | virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 437 | virtual GrPath* onCreatePath(const SkPath& path) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 438 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 439 | // overridden by backend-specific derived class to perform the clear and |
bsalomon@google.com | 6aa25c3 | 2011-04-27 19:55:29 +0000 | [diff] [blame] | 440 | // clearRect. NULL rect means clear whole target. |
| 441 | virtual void onClear(const GrIRect* rect, GrColor color) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 442 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 443 | // overridden by backend-specific derived class to perform the draw call. |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 444 | virtual void onGpuDraw(const DrawInfo&) = 0; |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 445 | // when GrDrawTarget::stencilPath is called the draw state's current stencil |
| 446 | // settings are ignored. Instead the GrGpu decides the stencil rules |
| 447 | // necessary to stencil the path. These are still subject to filtering by |
| 448 | // the clip mask manager. |
| 449 | virtual void setStencilPathSettings(const GrPath&, |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 450 | SkPath::FillType, |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 451 | GrStencilSettings* settings) = 0; |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 452 | // overridden by backend-specific derived class to perform the path stenciling. |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 453 | virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 454 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 455 | // overridden by backend-specific derived class to perform flush |
bsalomon@google.com | bcdbbe6 | 2011-04-12 15:40:00 +0000 | [diff] [blame] | 456 | virtual void onForceRenderTargetFlush() = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 457 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 458 | // overridden by backend-specific derived class to perform the read pixels. |
bsalomon@google.com | 5877ffd | 2011-04-11 17:58:48 +0000 | [diff] [blame] | 459 | virtual bool onReadPixels(GrRenderTarget* target, |
| 460 | int left, int top, int width, int height, |
bsalomon@google.com | c436499 | 2011-11-07 15:54:49 +0000 | [diff] [blame] | 461 | GrPixelConfig, |
| 462 | void* buffer, |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 463 | size_t rowBytes) = 0; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 464 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 465 | // overridden by backend-specific derived class to perform the texture update |
bsalomon@google.com | 9c68058 | 2013-02-06 18:17:50 +0000 | [diff] [blame] | 466 | virtual bool onWriteTexturePixels(GrTexture* texture, |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 467 | int left, int top, int width, int height, |
| 468 | GrPixelConfig config, const void* buffer, |
| 469 | size_t rowBytes) = 0; |
| 470 | |
bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 471 | // overridden by backend-specific derived class to perform the resolve |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 472 | virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
| 473 | |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 474 | // width and height may be larger than rt (if underlying API allows it). |
| 475 | // Should attach the SB to the RT. Returns false if compatible sb could |
| 476 | // not be created. |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 477 | virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, int height) = 0; |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 478 | |
| 479 | // attaches an existing SB to an existing RT. |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 480 | virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTarget*) = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 481 | |
| 482 | // The GrGpu typically records the clients requested state and then flushes |
| 483 | // deltas from previous state at draw time. This function does the |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 484 | // backend-specific flush of the state. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 485 | // returns false if current state is unsupported. |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 486 | virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCopy) = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 487 | |
bsalomon@google.com | edc177d | 2011-08-05 15:46:40 +0000 | [diff] [blame] | 488 | // clears the entire stencil buffer to 0 |
| 489 | virtual void clearStencil() = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 490 | |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 491 | // Given a rt, find or create a stencil buffer and attach it |
| 492 | bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 493 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 494 | // GrDrawTarget overrides |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 495 | virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
sugoi@google.com | 5f74cf8 | 2012-12-17 21:16:45 +0000 | [diff] [blame] | 496 | virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 497 | SkPath::FillType) SK_OVERRIDE; |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 498 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 499 | // readies the pools to provide vertex/index data. |
| 500 | void prepareVertexPool(); |
| 501 | void prepareIndexPool(); |
| 502 | |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 503 | void resetContext() { |
bsalomon@google.com | c8f7f47 | 2012-06-18 13:44:51 +0000 | [diff] [blame] | 504 | // We call this because the client may have messed with the |
| 505 | // stencil buffer. Perhaps we should detect whether it is a |
| 506 | // internally created stencil buffer and if so skip the invalidate. |
| 507 | fClipMaskManager.invalidateStencilMask(); |
bsalomon@google.com | b635d39 | 2011-11-05 12:47:43 +0000 | [diff] [blame] | 508 | this->onResetContext(); |
| 509 | ++fResetTimestamp; |
| 510 | } |
| 511 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 512 | void handleDirtyContext() { |
| 513 | if (fContextIsDirty) { |
| 514 | this->resetContext(); |
| 515 | fContextIsDirty = false; |
| 516 | } |
| 517 | } |
| 518 | |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 519 | enum { |
| 520 | kPreallocGeomPoolStateStackCnt = 4, |
| 521 | }; |
| 522 | typedef SkTInternalLList<GrResource> ResourceList; |
| 523 | SkSTArray<kPreallocGeomPoolStateStackCnt, GeometryPoolState, true> fGeomPoolStateStack; |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 524 | ResetTimestamp fResetTimestamp; |
| 525 | GrVertexBufferAllocPool* fVertexPool; |
| 526 | GrIndexBufferAllocPool* fIndexPool; |
| 527 | // counts number of uses of vertex/index pool in the geometry stack |
| 528 | int fVertexPoolUseCnt; |
| 529 | int fIndexPoolUseCnt; |
bsalomon@google.com | 6438695 | 2013-02-08 21:22:44 +0000 | [diff] [blame] | 530 | // these are mutable so they can be created on-demand |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 531 | mutable GrIndexBuffer* fQuadIndexBuffer; |
| 532 | bool fContextIsDirty; |
skia.committer@gmail.com | 66a4a4c | 2013-05-11 07:01:34 +0000 | [diff] [blame] | 533 | // Used to abandon/release all resources created by this GrGpu. TODO: Move this |
bsalomon@google.com | 76202b8 | 2013-05-10 19:08:22 +0000 | [diff] [blame] | 534 | // functionality to GrResourceCache. |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 535 | ResourceList fResourceList; |
| 536 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 537 | typedef GrDrawTarget INHERITED; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 538 | }; |
| 539 | |
| 540 | #endif |