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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class GrPathRange; | 24 class GrPathRange; |
25 class GrPathRenderer; | 25 class GrPathRenderer; |
26 class GrPathRendererChain; | 26 class GrPathRendererChain; |
27 class GrPathRendering; | 27 class GrPathRendering; |
28 class GrPipeline; | 28 class GrPipeline; |
29 class GrPrimitiveProcessor; | 29 class GrPrimitiveProcessor; |
30 class GrRenderTarget; | 30 class GrRenderTarget; |
31 class GrStencilAttachment; | 31 class GrStencilAttachment; |
32 class GrSurface; | 32 class GrSurface; |
33 class GrTexture; | 33 class GrTexture; |
| 34 class GrTransferBuffer; |
34 class GrVertexBuffer; | 35 class GrVertexBuffer; |
35 class GrVertices; | 36 class GrVertices; |
36 | 37 |
37 class GrGpu : public SkRefCnt { | 38 class GrGpu : public SkRefCnt { |
38 public: | 39 public: |
39 /** | 40 /** |
40 * Create an instance of GrGpu that matches the specified backend. If the re
quested backend is | 41 * Create an instance of GrGpu that matches the specified backend. If the re
quested backend is |
41 * not supported (at compile-time or run-time) this returns nullptr. The con
text will not be | 42 * not supported (at compile-time or run-time) this returns nullptr. The con
text will not be |
42 * fully constructed and should not be used by GrGpu until after this functi
on returns. | 43 * fully constructed and should not be used by GrGpu until after this functi
on returns. |
43 */ | 44 */ |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 * | 122 * |
122 * @param size size in bytes of the index buffer | 123 * @param size size in bytes of the index buffer |
123 * @param dynamic hints whether the data will be frequently changed | 124 * @param dynamic hints whether the data will be frequently changed |
124 * by either GrIndexBuffer::map() or | 125 * by either GrIndexBuffer::map() or |
125 * GrIndexBuffer::updateData(). | 126 * GrIndexBuffer::updateData(). |
126 * | 127 * |
127 * @return The index buffer if successful, otherwise nullptr. | 128 * @return The index buffer if successful, otherwise nullptr. |
128 */ | 129 */ |
129 GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic); | 130 GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic); |
130 | 131 |
| 132 enum TransferType { |
| 133 kCpuToGpu_TransferType, |
| 134 kGpuToCpu_TransferType |
| 135 }; |
| 136 |
| 137 /** |
| 138 * Creates a transfer buffer. |
| 139 * |
| 140 * @param size size in bytes of the index buffer |
| 141 * @param toGpu true if used to transfer from the cpu to the gpu |
| 142 * otherwise to be used to transfer from the gpu to the cpu |
| 143 * |
| 144 * @return The transfer buffer if successful, otherwise nullptr. |
| 145 */ |
| 146 GrTransferBuffer* createTransferBuffer(size_t size, TransferType type); |
| 147 |
131 /** | 148 /** |
132 * Resolves MSAA. | 149 * Resolves MSAA. |
133 */ | 150 */ |
134 void resolveRenderTarget(GrRenderTarget* target); | 151 void resolveRenderTarget(GrRenderTarget* target); |
135 | 152 |
136 /** Info struct returned by getReadPixelsInfo about performing intermediate
draws before | 153 /** Info struct returned by getReadPixelsInfo about performing intermediate
draws before |
137 reading pixels for performance or correctness. */ | 154 reading pixels for performance or correctness. */ |
138 struct ReadPixelTempDrawInfo { | 155 struct ReadPixelTempDrawInfo { |
139 /** If the GrGpu is requesting that the caller do a draw to an intermedi
ate surface then | 156 /** If the GrGpu is requesting that the caller do a draw to an intermedi
ate surface then |
140 this is descriptor for the temp surface. The draw should always be a
rect with | 157 this is descriptor for the temp surface. The draw should always be a
rect with |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 GrGpuResource::LifeCycle lifeCycle, | 462 GrGpuResource::LifeCycle lifeCycle, |
446 const void* srcData, size_t rowBytes) = 0
; | 463 const void* srcData, size_t rowBytes) = 0
; |
447 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | 464 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
448 GrGpuResource::LifeCycle lifeCy
cle, | 465 GrGpuResource::LifeCycle lifeCy
cle, |
449 const void* srcData) = 0; | 466 const void* srcData) = 0; |
450 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO
wnership) = 0; | 467 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO
wnership) = 0; |
451 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&, | 468 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&, |
452 GrWrapOwnership) = 0; | 469 GrWrapOwnership) = 0; |
453 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; | 470 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
454 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; | 471 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
| 472 virtual GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType t
ype) = 0; |
455 | 473 |
456 // overridden by backend-specific derived class to perform the clear. | 474 // overridden by backend-specific derived class to perform the clear. |
457 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) =
0; | 475 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) =
0; |
458 | 476 |
459 | 477 |
460 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is | 478 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is |
461 // ONLY used by the the clip target | 479 // ONLY used by the the clip target |
462 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i
nsideClip) = 0; | 480 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i
nsideClip) = 0; |
463 | 481 |
464 // overridden by backend-specific derived class to perform the draw call. | 482 // overridden by backend-specific derived class to perform the draw call. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 ResetTimestamp fResetTi
mestamp; | 521 ResetTimestamp fResetTi
mestamp; |
504 uint32_t fResetBi
ts; | 522 uint32_t fResetBi
ts; |
505 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 523 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
506 GrContext* fContext
; | 524 GrContext* fContext
; |
507 | 525 |
508 friend class GrPathRendering; | 526 friend class GrPathRendering; |
509 typedef SkRefCnt INHERITED; | 527 typedef SkRefCnt INHERITED; |
510 }; | 528 }; |
511 | 529 |
512 #endif | 530 #endif |
OLD | NEW |