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