OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 * The 'info' parameter will be stored and passed to the callback function. | 77 * The 'info' parameter will be stored and passed to the callback function. |
78 */ | 78 */ |
79 void addCleanUp(PFCleanUpFunc cleanUp, void* info) { | 79 void addCleanUp(PFCleanUpFunc cleanUp, void* info) { |
80 CleanUpData* entry = fCleanUpData.push(); | 80 CleanUpData* entry = fCleanUpData.push(); |
81 | 81 |
82 entry->fFunc = cleanUp; | 82 entry->fFunc = cleanUp; |
83 entry->fInfo = info; | 83 entry->fInfo = info; |
84 } | 84 } |
85 | 85 |
86 /** | 86 /** |
87 * Change the context's scratch texture reuse behavior. On some platforms | |
bsalomon
2013/07/18 18:12:08
Do we need this function at all? Do we need anythi
| |
88 * reusing scratch textures can cause the driver to ghost the texture | |
89 * which, in excess, can lead to out of memory problems | |
90 */ | |
91 void setReuseScratchTextures(bool reuseScratchTextures) { | |
92 fReuseScratchTextures = reuseScratchTextures; | |
93 } | |
94 | |
95 /** | |
87 * Abandons all GPU resources, assumes 3D API state is unknown. Call this | 96 * Abandons all GPU resources, assumes 3D API state is unknown. Call this |
88 * if you have lost the associated GPU context, and thus internal texture, | 97 * if you have lost the associated GPU context, and thus internal texture, |
89 * buffer, etc. references/IDs are now invalid. Should be called even when | 98 * buffer, etc. references/IDs are now invalid. Should be called even when |
90 * GrContext is no longer going to be used for two reasons: | 99 * GrContext is no longer going to be used for two reasons: |
91 * 1) ~GrContext will not try to free the objects in the 3D API. | 100 * 1) ~GrContext will not try to free the objects in the 3D API. |
92 * 2) If you've created GrResources that outlive the GrContext they will | 101 * 2) If you've created GrResources that outlive the GrContext they will |
93 * be marked as invalid (GrResource::isValid()) and won't attempt to | 102 * be marked as invalid (GrResource::isValid()) and won't attempt to |
94 * free their underlying resource in the 3D API. | 103 * free their underlying resource in the 3D API. |
95 * Content drawn since the last GrContext::flush() may be lost. | 104 * Content drawn since the last GrContext::flush() may be lost. |
96 */ | 105 */ |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
859 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; | 868 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; |
860 GrInOrderDrawBuffer* fDrawBuffer; | 869 GrInOrderDrawBuffer* fDrawBuffer; |
861 | 870 |
862 GrAARectRenderer* fAARectRenderer; | 871 GrAARectRenderer* fAARectRenderer; |
863 GrOvalRenderer* fOvalRenderer; | 872 GrOvalRenderer* fOvalRenderer; |
864 | 873 |
865 bool fDidTestPMConversions; | 874 bool fDidTestPMConversions; |
866 int fPMToUPMConversion; | 875 int fPMToUPMConversion; |
867 int fUPMToPMConversion; | 876 int fUPMToPMConversion; |
868 | 877 |
878 bool fReuseScratchTextures; | |
bsalomon
2013/07/18 18:12:08
Do we need this or can it just look at the GrGpu's
| |
879 | |
869 struct CleanUpData { | 880 struct CleanUpData { |
870 PFCleanUpFunc fFunc; | 881 PFCleanUpFunc fFunc; |
871 void* fInfo; | 882 void* fInfo; |
872 }; | 883 }; |
873 | 884 |
874 SkTDArray<CleanUpData> fCleanUpData; | 885 SkTDArray<CleanUpData> fCleanUpData; |
875 | 886 |
876 GrContext(); // init must be called after the constructor. | 887 GrContext(); // init must be called after the constructor. |
877 bool init(GrBackend, GrBackendContext); | 888 bool init(GrBackend, GrBackendContext); |
878 | 889 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 } | 1012 } |
1002 | 1013 |
1003 GrTexture* texture() { return fTexture; } | 1014 GrTexture* texture() { return fTexture; } |
1004 | 1015 |
1005 private: | 1016 private: |
1006 GrContext* fContext; | 1017 GrContext* fContext; |
1007 GrTexture* fTexture; | 1018 GrTexture* fTexture; |
1008 }; | 1019 }; |
1009 | 1020 |
1010 #endif | 1021 #endif |
OLD | NEW |