OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGLGpu_DEFINED | 8 #ifndef GrGLGpu_DEFINED |
9 #define GrGLGpu_DEFINED | 9 #define GrGLGpu_DEFINED |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; | 150 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; |
151 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; | 151 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; |
152 GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType type) ove
rride; | 152 GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType type) ove
rride; |
153 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; | 153 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; |
154 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 154 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
155 GrWrapOwnership) override; | 155 GrWrapOwnership) override; |
156 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a | 156 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a |
157 // compatible stencil format, or negative if there is no compatible stencil
format. | 157 // compatible stencil format, or negative if there is no compatible stencil
format. |
158 int getCompatibleStencilIndex(GrPixelConfig config); | 158 int getCompatibleStencilIndex(GrPixelConfig config); |
159 | 159 |
| 160 // If |desc.fTextureStorageAllocator| exists, use that to create the |
| 161 // texture. Otherwise, create the texture directly. |
| 162 // Returns whether the texture is successfully created. On success, the |
| 163 // result is stored in |info|. |
| 164 // The texture is populated with |srcData|, if it exists. |
| 165 // The texture parameters are cached in |initialTexParams|. |
| 166 bool createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info, |
| 167 bool renderTarget, const void* srcData, |
| 168 GrGLTexture::TexParams* initialTexParams, size_t rowB
ytes); |
| 169 bool createTextureExternalAllocatorImpl(const GrSurfaceDesc& desc, GrGLTextu
reInfo* info, |
| 170 const void* srcData, size_t rowBytes
); |
| 171 |
160 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; | 172 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; |
161 | 173 |
162 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; | 174 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; |
163 | 175 |
164 bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&, | 176 bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&, |
165 GrTextureProducer::CopyParams*) const overri
de; | 177 GrTextureProducer::CopyParams*) const overri
de; |
166 | 178 |
167 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from the | 179 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from the |
168 // render target. | 180 // render target. |
169 bool readPixelsSupported(GrRenderTarget* target, GrPixelConfig readConfig); | 181 bool readPixelsSupported(GrRenderTarget* target, GrPixelConfig readConfig); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 void flushStencil(const GrStencilSettings&); | 317 void flushStencil(const GrStencilSettings&); |
306 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); | 318 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); |
307 | 319 |
308 // helper for onCreateTexture and writeTexturePixels | 320 // helper for onCreateTexture and writeTexturePixels |
309 enum UploadType { | 321 enum UploadType { |
310 kNewTexture_UploadType, // we are creating a new texture | 322 kNewTexture_UploadType, // we are creating a new texture |
311 kWrite_UploadType, // we are using TexSubImage2D to copy data to
an existing texture | 323 kWrite_UploadType, // we are using TexSubImage2D to copy data to
an existing texture |
312 kTransfer_UploadType, // we are using a transfer buffer to copy dat
a | 324 kTransfer_UploadType, // we are using a transfer buffer to copy dat
a |
313 }; | 325 }; |
314 bool uploadTexData(const GrSurfaceDesc& desc, | 326 bool uploadTexData(const GrSurfaceDesc& desc, |
315 GrGLenum target, | 327 GrGLTextureInfo* info, |
316 UploadType uploadType, | 328 UploadType uploadType, |
317 int left, int top, int width, int height, | 329 int left, int top, int width, int height, |
318 GrPixelConfig dataConfig, | 330 GrPixelConfig dataConfig, |
319 const void* data, | 331 const void* data, |
320 size_t rowBytes); | 332 size_t rowBytes); |
321 | 333 |
322 // helper for onCreateCompressedTexture. If width and height are | 334 // helper for onCreateCompressedTexture. If width and height are |
323 // set to -1, then this function will use desc.fWidth and desc.fHeight | 335 // set to -1, then this function will use desc.fWidth and desc.fHeight |
324 // for the size of the data. The isNewTexture flag should be set to true | 336 // for the size of the data. The isNewTexture flag should be set to true |
325 // whenever a new texture needs to be created. Otherwise, we assume that | 337 // whenever a new texture needs to be created. Otherwise, we assume that |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 SkFAIL("Unexpected texture target type."); | 575 SkFAIL("Unexpected texture target type."); |
564 return 0; | 576 return 0; |
565 } | 577 } |
566 } | 578 } |
567 | 579 |
568 typedef GrGpu INHERITED; | 580 typedef GrGpu INHERITED; |
569 friend class GrGLPathRendering; // For accessing setTextureUnit. | 581 friend class GrGLPathRendering; // For accessing setTextureUnit. |
570 }; | 582 }; |
571 | 583 |
572 #endif | 584 #endif |
OLD | NEW |