Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: include/gpu/GrContext.h

Issue 19636002: Plumb in flag for reusing scratch textures (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef GrContext_DEFINED 10 #ifndef GrContext_DEFINED
(...skipping 28 matching lines...) Expand all
39 class GrVertexBufferAllocPool; 39 class GrVertexBufferAllocPool;
40 class GrSoftwarePathRenderer; 40 class GrSoftwarePathRenderer;
41 class SkStrokeRec; 41 class SkStrokeRec;
42 42
43 class GR_API GrContext : public GrRefCnt { 43 class GR_API GrContext : public GrRefCnt {
44 public: 44 public:
45 SK_DECLARE_INST_COUNT(GrContext) 45 SK_DECLARE_INST_COUNT(GrContext)
46 46
47 /** 47 /**
48 * Creates a GrContext for a backend context. 48 * Creates a GrContext for a backend context.
49 */ 49 */
robertphillips 2013/07/17 16:51:32 An option would be to pass in a tri-value enum (e.
50 static GrContext* Create(GrBackend, GrBackendContext); 50 static GrContext* Create(GrBackend, GrBackendContext, bool* reuseScratchText ures = NULL);
51 51
52 /** 52 /**
53 * Returns the number of GrContext instances for the current thread. 53 * Returns the number of GrContext instances for the current thread.
54 */ 54 */
55 static int GetThreadInstanceCount(); 55 static int GetThreadInstanceCount();
56 56
57 virtual ~GrContext(); 57 virtual ~GrContext();
58 58
59 /** 59 /**
60 * The GrContext normally assumes that no outsider is setting state 60 * The GrContext normally assumes that no outsider is setting state
(...skipping 17 matching lines...) Expand all
78 * The 'info' parameter will be stored and passed to the callback function. 78 * The 'info' parameter will be stored and passed to the callback function.
79 */ 79 */
80 void addCleanUp(PFCleanUpFunc cleanUp, void* info) { 80 void addCleanUp(PFCleanUpFunc cleanUp, void* info) {
81 CleanUpData* entry = fCleanUpData.push(); 81 CleanUpData* entry = fCleanUpData.push();
82 82
83 entry->fFunc = cleanUp; 83 entry->fFunc = cleanUp;
84 entry->fInfo = info; 84 entry->fInfo = info;
85 } 85 }
86 86
87 /** 87 /**
88 * Change the context's scratch texture reuse behavior. On some platforms
89 * reusing scratch textures can cause the driver to ghost the texture
90 * which, in excess, can lead to out of memory problems
91 */
robertphillips 2013/07/17 16:51:32 This would remain a bool
92 void setReuseScratchTextures(bool reuseScratchTextures) {
93 fReuseScratchTextures = reuseScratchTextures;
94 }
95
96 /**
88 * Abandons all GPU resources, assumes 3D API state is unknown. Call this 97 * Abandons all GPU resources, assumes 3D API state is unknown. Call this
89 * if you have lost the associated GPU context, and thus internal texture, 98 * if you have lost the associated GPU context, and thus internal texture,
90 * buffer, etc. references/IDs are now invalid. Should be called even when 99 * buffer, etc. references/IDs are now invalid. Should be called even when
91 * GrContext is no longer going to be used for two reasons: 100 * GrContext is no longer going to be used for two reasons:
92 * 1) ~GrContext will not try to free the objects in the 3D API. 101 * 1) ~GrContext will not try to free the objects in the 3D API.
93 * 2) If you've created GrResources that outlive the GrContext they will 102 * 2) If you've created GrResources that outlive the GrContext they will
94 * be marked as invalid (GrResource::isValid()) and won't attempt to 103 * be marked as invalid (GrResource::isValid()) and won't attempt to
95 * free their underlying resource in the 3D API. 104 * free their underlying resource in the 3D API.
96 * Content drawn since the last GrContext::flush() may be lost. 105 * Content drawn since the last GrContext::flush() may be lost.
97 */ 106 */
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; 868 GrVertexBufferAllocPool* fDrawBufferVBAllocPool;
860 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; 869 GrIndexBufferAllocPool* fDrawBufferIBAllocPool;
861 GrInOrderDrawBuffer* fDrawBuffer; 870 GrInOrderDrawBuffer* fDrawBuffer;
862 871
863 GrAARectRenderer* fAARectRenderer; 872 GrAARectRenderer* fAARectRenderer;
864 GrOvalRenderer* fOvalRenderer; 873 GrOvalRenderer* fOvalRenderer;
865 874
866 bool fDidTestPMConversions; 875 bool fDidTestPMConversions;
867 int fPMToUPMConversion; 876 int fPMToUPMConversion;
868 int fUPMToPMConversion; 877 int fUPMToPMConversion;
869 878
robertphillips 2013/07/17 16:51:32 This would remain a bool
879 bool fReuseScratchTextures;
880
870 struct CleanUpData { 881 struct CleanUpData {
871 PFCleanUpFunc fFunc; 882 PFCleanUpFunc fFunc;
872 void* fInfo; 883 void* fInfo;
873 }; 884 };
874 885
875 SkTDArray<CleanUpData> fCleanUpData; 886 SkTDArray<CleanUpData> fCleanUpData;
876 887
877 GrContext(); // init must be called after the constructor. 888 GrContext(); // init must be called after the constructor.
robertphillips 2013/07/17 16:51:32 This would also become tri-value
878 bool init(GrBackend, GrBackendContext); 889 bool init(GrBackend, GrBackendContext, bool *reuseScratchTextures);
879 890
880 void setupDrawBuffer(); 891 void setupDrawBuffer();
881 892
882 class AutoRestoreEffects; 893 class AutoRestoreEffects;
883 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the 894 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the
884 /// draw state is left unmodified. 895 /// draw state is left unmodified.
885 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects *); 896 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects *);
886 897
887 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, 898 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path,
888 const SkStrokeRec& stroke); 899 const SkStrokeRec& stroke);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 } 1013 }
1003 1014
1004 GrTexture* texture() { return fTexture; } 1015 GrTexture* texture() { return fTexture; }
1005 1016
1006 private: 1017 private:
1007 GrContext* fContext; 1018 GrContext* fContext;
1008 GrTexture* fTexture; 1019 GrTexture* fTexture;
1009 }; 1020 };
1010 1021
1011 #endif 1022 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698