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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 GrGpu(GrContext* context); | 38 GrGpu(GrContext* context); |
39 ~GrGpu() override; | 39 ~GrGpu() override; |
40 | 40 |
41 GrContext* getContext() { return fContext; } | 41 GrContext* getContext() { return fContext; } |
42 const GrContext* getContext() const { return fContext; } | 42 const GrContext* getContext() const { return fContext; } |
43 | 43 |
44 /** | 44 /** |
45 * Gets the capabilities of the draw target. | 45 * Gets the capabilities of the draw target. |
46 */ | 46 */ |
47 const GrDrawTargetCaps* caps() const { return fCaps.get(); } | 47 const GrCaps* caps() const { return fCaps.get(); } |
48 | 48 |
49 GrPathRendering* pathRendering() { return fPathRendering.get(); } | 49 GrPathRendering* pathRendering() { return fPathRendering.get(); } |
50 | 50 |
51 // Called by GrContext when the underlying backend context has been destroye
d. | 51 // Called by GrContext when the underlying backend context has been destroye
d. |
52 // GrGpu should use this to ensure that no backend API calls will be made fr
om | 52 // GrGpu should use this to ensure that no backend API calls will be made fr
om |
53 // here onward, including in its destructor. Subclasses should call | 53 // here onward, including in its destructor. Subclasses should call |
54 // INHERITED::contextAbandoned() if they override this. | 54 // INHERITED::contextAbandoned() if they override this. |
55 virtual void contextAbandoned(); | 55 virtual void contextAbandoned(); |
56 | 56 |
57 /** | 57 /** |
58 * The GrGpu object normally assumes that no outsider is setting state | 58 * The GrGpu object normally assumes that no outsider is setting state |
59 * within the underlying 3D API's context/device/whatever. This call informs | 59 * within the underlying 3D API's context/device/whatever. This call informs |
60 * the GrGpu that the state was modified and it shouldn't make assumptions | 60 * the GrGpu that the state was modified and it shouldn't make assumptions |
61 * about the state. | 61 * about the state. |
62 */ | 62 */ |
63 void markContextDirty(uint32_t state = kAll_GrBackendState) { fResetBits |=
state; } | 63 void markContextDirty(uint32_t state = kAll_GrBackendState) { fResetBits |=
state; } |
64 | 64 |
65 /** | 65 /** |
66 * Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can | 66 * Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can |
67 * be used as a render target by calling GrTexture::asRenderTarget(). Not al
l | 67 * be used as a render target by calling GrTexture::asRenderTarget(). Not al
l |
68 * pixel configs can be used as render targets. Support for configs as textu
res | 68 * pixel configs can be used as render targets. Support for configs as textu
res |
69 * or render targets can be checked using GrDrawTargetCaps. | 69 * or render targets can be checked using GrCaps. |
70 * | 70 * |
71 * @param desc describes the texture to be created. | 71 * @param desc describes the texture to be created. |
72 * @param budgeted does this texture count against the resource cache bud
get? | 72 * @param budgeted does this texture count against the resource cache bud
get? |
73 * @param srcData texel data to load texture. Begins with full-size | 73 * @param srcData texel data to load texture. Begins with full-size |
74 * palette data for paletted textures. For compressed | 74 * palette data for paletted textures. For compressed |
75 * formats it contains the compressed pixel data. Otherwi
se, | 75 * formats it contains the compressed pixel data. Otherwi
se, |
76 * it contains width*height texels. If NULL texture data | 76 * it contains width*height texels. If NULL texture data |
77 * is uninitialized. | 77 * is uninitialized. |
78 * @param rowBytes the number of bytes between consecutive rows. Zero | 78 * @param rowBytes the number of bytes between consecutive rows. Zero |
79 * means rows are tightly packed. This field is ignored | 79 * means rows are tightly packed. This field is ignored |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 unsigned int clipBit, | 396 unsigned int clipBit, |
397 unsigned int userBits, | 397 unsigned int userBits, |
398 unsigned int* ref, | 398 unsigned int* ref, |
399 unsigned int* mask); | 399 unsigned int* mask); |
400 | 400 |
401 const GrTraceMarkerSet& getActiveTraceMarkers() const { return fActiveTraceM
arkers; } | 401 const GrTraceMarkerSet& getActiveTraceMarkers() const { return fActiveTraceM
arkers; } |
402 | 402 |
403 Stats fStats; | 403 Stats fStats; |
404 SkAutoTDelete<GrPathRendering> fPathRendering; | 404 SkAutoTDelete<GrPathRendering> fPathRendering; |
405 // Subclass must initialize this in its constructor. | 405 // Subclass must initialize this in its constructor. |
406 SkAutoTUnref<const GrDrawTargetCaps> fCaps; | 406 SkAutoTUnref<const GrCaps> fCaps; |
407 | 407 |
408 private: | 408 private: |
409 // called when the 3D context state is unknown. Subclass should emit any | 409 // called when the 3D context state is unknown. Subclass should emit any |
410 // assumed 3D context state and dirty any state cache. | 410 // assumed 3D context state and dirty any state cache. |
411 virtual void onResetContext(uint32_t resetBits) = 0; | 411 virtual void onResetContext(uint32_t resetBits) = 0; |
412 | 412 |
413 // overridden by backend-specific derived class to create objects. | 413 // overridden by backend-specific derived class to create objects. |
414 // Texture size and sample size will have already been validated in base cla
ss before | 414 // Texture size and sample size will have already been validated in base cla
ss before |
415 // onCreateTexture/CompressedTexture are called. | 415 // onCreateTexture/CompressedTexture are called. |
416 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, | 416 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 int fGpuTrac
eMarkerCount; | 495 int fGpuTrac
eMarkerCount; |
496 GrTraceMarkerSet fActiveT
raceMarkers; | 496 GrTraceMarkerSet fActiveT
raceMarkers; |
497 GrTraceMarkerSet fStoredT
raceMarkers; | 497 GrTraceMarkerSet fStoredT
raceMarkers; |
498 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 498 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
499 GrContext* fContext
; | 499 GrContext* fContext
; |
500 | 500 |
501 typedef SkRefCnt INHERITED; | 501 typedef SkRefCnt INHERITED; |
502 }; | 502 }; |
503 | 503 |
504 #endif | 504 #endif |
OLD | NEW |