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

Side by Side Diff: src/gpu/gl/GrGLContext.h

Issue 12843026: Make GrDrawTarget::Caps ref counted and GrGLCaps derive from it. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 8
9 #ifndef GrGLContext_DEFINED 9 #ifndef GrGLContext_DEFINED
10 #define GrGLContext_DEFINED 10 #define GrGLContext_DEFINED
11 11
12 #include "gl/GrGLExtensions.h" 12 #include "gl/GrGLExtensions.h"
13 #include "gl/GrGLInterface.h" 13 #include "gl/GrGLInterface.h"
14 #include "GrGLCaps.h" 14 #include "GrGLCaps.h"
15 #include "GrGLSL.h" 15 #include "GrGLSL.h"
16 #include "GrGLUtil.h" 16 #include "GrGLUtil.h"
17 17
18 #include "SkString.h" 18 #include "SkString.h"
19 19
20 /** 20 /**
21 * Encapsulates information about an OpenGL context including the OpenGL 21 * Encapsulates information about an OpenGL context including the OpenGL
22 * version, the GrGLBinding type of the context, and GLSL version. 22 * version, the GrGLBinding type of the context, and GLSL version.
23 */ 23 */
24 class GrGLContextInfo { 24 class GrGLContextInfo {
25 public: 25 public:
26 /** 26 /**
27 * Default constructor 27 * Default constructor
28 */ 28 */
29 GrGLContextInfo() { this->reset(); } 29 GrGLContextInfo() {
30 fGLCaps.reset(SkNEW(GrGLCaps));
31 this->reset();
32 }
30 33
31 /** 34 /**
32 * Copies a GrGLContextInfo 35 * Copies a GrGLContextInfo
33 */ 36 */
34 GrGLContextInfo& operator= (const GrGLContextInfo& ctxInfo); 37 GrGLContextInfo& operator= (const GrGLContextInfo& ctxInfo);
35 38
36 /** 39 /**
37 * Initializes a GrGLContextInfo from a GrGLInterface and the currently 40 * Initializes a GrGLContextInfo from a GrGLInterface and the currently
38 * bound OpenGL context accessible by the GrGLInterface. 41 * bound OpenGL context accessible by the GrGLInterface.
39 */ 42 */
40 bool initialize(const GrGLInterface* interface); 43 bool initialize(const GrGLInterface* interface);
41 bool isInitialized() const; 44 bool isInitialized() const;
42 45
43 GrGLBinding binding() const { return fBindingInUse; } 46 GrGLBinding binding() const { return fBindingInUse; }
44 GrGLVersion version() const { return fGLVersion; } 47 GrGLVersion version() const { return fGLVersion; }
45 GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; } 48 GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; }
46 GrGLVendor vendor() const { return fVendor; } 49 GrGLVendor vendor() const { return fVendor; }
47 const GrGLCaps& caps() const { return fGLCaps; } 50 const GrGLCaps* caps() const { return fGLCaps.get(); }
48 GrGLCaps& caps() { return fGLCaps; } 51 GrGLCaps* caps() { return fGLCaps; }
49 52
50 /** 53 /**
51 * Checks for extension support using a cached copy of the GL_EXTENSIONS 54 * Checks for extension support using a cached copy of the GL_EXTENSIONS
52 * string. 55 * string.
53 */ 56 */
54 bool hasExtension(const char* ext) const { 57 bool hasExtension(const char* ext) const {
55 if (!this->isInitialized()) { 58 if (!this->isInitialized()) {
56 return false; 59 return false;
57 } 60 }
58 return fExtensions.has(ext); 61 return fExtensions.has(ext);
59 } 62 }
60 63
61 /** 64 /**
62 * Reset the information 65 * Reset the information
63 */ 66 */
64 void reset(); 67 void reset();
65 68
66 private: 69 private:
67 70
68 GrGLBinding fBindingInUse; 71 GrGLBinding fBindingInUse;
69 GrGLVersion fGLVersion; 72 GrGLVersion fGLVersion;
70 GrGLSLGeneration fGLSLGeneration; 73 GrGLSLGeneration fGLSLGeneration;
71 GrGLVendor fVendor; 74 GrGLVendor fVendor;
72 GrGLExtensions fExtensions; 75 GrGLExtensions fExtensions;
73 GrGLCaps fGLCaps; 76 SkAutoTUnref<GrGLCaps> fGLCaps;
74 }; 77 };
75 78
76 /** 79 /**
77 * Encapsulates the GrGLInterface used to make GL calls plus information 80 * Encapsulates the GrGLInterface used to make GL calls plus information
78 * about the context (via GrGLContextInfo). 81 * about the context (via GrGLContextInfo).
79 */ 82 */
80 class GrGLContext { 83 class GrGLContext {
81 public: 84 public:
82 /** 85 /**
83 * Default constructor 86 * Default constructor
(...skipping 30 matching lines...) Expand all
114 GrGLContextInfo& info() { return fInfo; } 117 GrGLContextInfo& info() { return fInfo; }
115 118
116 private: 119 private:
117 void reset(); 120 void reset();
118 121
119 const GrGLInterface* fInterface; 122 const GrGLInterface* fInterface;
120 GrGLContextInfo fInfo; 123 GrGLContextInfo fInfo;
121 }; 124 };
122 125
123 #endif 126 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLContext.cpp » ('j') | src/gpu/gl/GrGLContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698