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 |
11 #include "GrPipelineBuilder.h" | 11 #include "GrPipelineBuilder.h" |
12 #include "GrProgramDesc.h" | 12 #include "GrProgramDesc.h" |
13 #include "GrStencil.h" | 13 #include "GrStencil.h" |
14 #include "GrTraceMarker.h" | 14 #include "GrTraceMarker.h" |
15 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
| 16 #include "SkMipMap.h" |
16 #include "SkPath.h" | 17 #include "SkPath.h" |
17 | 18 |
18 class GrBatchTracker; | 19 class GrBatchTracker; |
19 class GrContext; | 20 class GrContext; |
20 class GrGLContext; | 21 class GrGLContext; |
21 class GrIndexBuffer; | 22 class GrIndexBuffer; |
22 class GrNonInstancedVertices; | 23 class GrNonInstancedVertices; |
23 class GrPath; | 24 class GrPath; |
24 class GrPathRange; | 25 class GrPathRange; |
25 class GrPathRenderer; | 26 class GrPathRenderer; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 * @param rowBytes the number of bytes between consecutive rows. Zero | 89 * @param rowBytes the number of bytes between consecutive rows. Zero |
89 * means rows are tightly packed. This field is ignored | 90 * means rows are tightly packed. This field is ignored |
90 * for compressed formats. | 91 * for compressed formats. |
91 * | 92 * |
92 * @return The texture object if successful, otherwise NULL. | 93 * @return The texture object if successful, otherwise NULL. |
93 */ | 94 */ |
94 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, | 95 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
95 const void* srcData, size_t rowBytes); | 96 const void* srcData, size_t rowBytes); |
96 | 97 |
97 /** | 98 /** |
| 99 * Creates a mipmapped texture object. If kRenderTarget_GrSurfaceFlag the te
xture can |
| 100 * be used as a render target by calling GrTexture::asRenderTarget(). Not al
l |
| 101 * pixel configs can be used as render targets. Support for configs as textu
res |
| 102 * or render targets can be checked using GrCaps. |
| 103 * |
| 104 * @param desc describes the texture to be created. |
| 105 * @param budgeted does this texture count against the resource cache bud
get? |
| 106 * @param srcData texel data to load texture. |
| 107 * |
| 108 * @return The texture object if successful, otherwise NULL. |
| 109 */ |
| 110 GrTexture* createMipmappedTexture(const GrSurfaceDesc& desc, bool budgeted, |
| 111 const SkMipMap& srcData); |
| 112 |
| 113 /** |
98 * Implements GrContext::wrapBackendTexture | 114 * Implements GrContext::wrapBackendTexture |
99 */ | 115 */ |
100 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership); | 116 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership); |
101 | 117 |
102 /** | 118 /** |
103 * Implements GrContext::wrapBackendTexture | 119 * Implements GrContext::wrapBackendTexture |
104 */ | 120 */ |
105 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, Gr
WrapOwnership); | 121 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, Gr
WrapOwnership); |
106 | 122 |
107 /** | 123 /** |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 417 |
402 // overridden by backend-specific derived class to create objects. | 418 // overridden by backend-specific derived class to create objects. |
403 // Texture size and sample size will have already been validated in base cla
ss before | 419 // Texture size and sample size will have already been validated in base cla
ss before |
404 // onCreateTexture/CompressedTexture are called. | 420 // onCreateTexture/CompressedTexture are called. |
405 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, | 421 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, |
406 GrGpuResource::LifeCycle lifeCycle, | 422 GrGpuResource::LifeCycle lifeCycle, |
407 const void* srcData, size_t rowBytes) = 0
; | 423 const void* srcData, size_t rowBytes) = 0
; |
408 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | 424 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
409 GrGpuResource::LifeCycle lifeCy
cle, | 425 GrGpuResource::LifeCycle lifeCy
cle, |
410 const void* srcData) = 0; | 426 const void* srcData) = 0; |
| 427 virtual GrTexture* onCreateMipmappedTexture(const GrSurfaceDesc& desc, |
| 428 GrGpuResource::LifeCycle lifeCyc
le, |
| 429 const SkMipMap& srcData) = 0; |
| 430 virtual GrTexture* onCreateCompressedMipmappedTexture(const GrSurfaceDesc& d
esc, |
| 431 GrGpuResource::LifeCyc
le lifeCycle, |
| 432 const SkMipMap& srcDat
a) = 0; |
| 433 |
411 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO
wnership) = 0; | 434 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO
wnership) = 0; |
412 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&, | 435 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&, |
413 GrWrapOwnership) = 0; | 436 GrWrapOwnership) = 0; |
414 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; | 437 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
415 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; | 438 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
416 | 439 |
417 // overridden by backend-specific derived class to perform the clear. | 440 // overridden by backend-specific derived class to perform the clear. |
418 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, | 441 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
419 bool canIgnoreRect) = 0; | 442 bool canIgnoreRect) = 0; |
420 | 443 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 GrTraceMarkerSet fActiveT
raceMarkers; | 497 GrTraceMarkerSet fActiveT
raceMarkers; |
475 GrTraceMarkerSet fStoredT
raceMarkers; | 498 GrTraceMarkerSet fStoredT
raceMarkers; |
476 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 499 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
477 GrContext* fContext
; | 500 GrContext* fContext
; |
478 | 501 |
479 friend class GrPathRendering; | 502 friend class GrPathRendering; |
480 typedef SkRefCnt INHERITED; | 503 typedef SkRefCnt INHERITED; |
481 }; | 504 }; |
482 | 505 |
483 #endif | 506 #endif |
OLD | NEW |