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

Side by Side Diff: src/gpu/gl/debug/GrDebugGL.h

Issue 12379025: Add support to GrGLInterface for vertex array objects (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
« no previous file with comments | « src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp ('k') | src/gpu/gl/debug/GrDebugGL.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 2012 Google Inc. 3 * Copyright 2012 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 #ifndef GrDebugGL_DEFINED 9 #ifndef GrDebugGL_DEFINED
10 #define GrDebugGL_DEFINED 10 #define GrDebugGL_DEFINED
11 11
12 #include "SkTArray.h" 12 #include "SkTArray.h"
13 #include "gl/GrGLInterface.h" 13 #include "gl/GrGLInterface.h"
14 14
15 class GrBufferObj;
15 class GrFakeRefObj; 16 class GrFakeRefObj;
17 class GrFrameBufferObj;
18 class GrProgramObj;
19 class GrRenderBufferObj;
20 class GrTextureObj;
16 class GrTextureUnitObj; 21 class GrTextureUnitObj;
17 class GrBufferObj; 22 class GrVertexArrayObj;
18 class GrTextureObj;
19 class GrFrameBufferObj;
20 class GrRenderBufferObj;
21 class GrProgramObj;
22 23
23 //////////////////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////////////////
24 // This is the main debugging object. It is a singleton and keeps track of 25 // This is the main debugging object. It is a singleton and keeps track of
25 // all the other debug objects. 26 // all the other debug objects.
26 class GrDebugGL { 27 class GrDebugGL {
27 public: 28 public:
28 enum GrObjTypes { 29 enum GrObjTypes {
29 kTexture_ObjTypes = 0, 30 kTexture_ObjTypes = 0,
30 kBuffer_ObjTypes, 31 kBuffer_ObjTypes,
31 kRenderBuffer_ObjTypes, 32 kRenderBuffer_ObjTypes,
32 kFrameBuffer_ObjTypes, 33 kFrameBuffer_ObjTypes,
33 kShader_ObjTypes, 34 kShader_ObjTypes,
34 kProgram_ObjTypes, 35 kProgram_ObjTypes,
35 kTextureUnit_ObjTypes, 36 kTextureUnit_ObjTypes,
37 kVertexArray_ObjTypes,
36 kObjTypeCount 38 kObjTypeCount
37 }; 39 };
38 40
39 GrFakeRefObj *createObj(GrObjTypes type) { 41 GrFakeRefObj *createObj(GrObjTypes type) {
40 GrFakeRefObj *temp = (*gFactoryFunc[type])(); 42 GrFakeRefObj *temp = (*gFactoryFunc[type])();
41 43
42 fObjects.push_back(temp); 44 fObjects.push_back(temp);
43 45
44 return temp; 46 return temp;
45 } 47 }
(...skipping 10 matching lines...) Expand all
56 58
57 return fTextureUnits[iUnit]; 59 return fTextureUnits[iUnit];
58 } 60 }
59 61
60 void setArrayBuffer(GrBufferObj *arrayBuffer); 62 void setArrayBuffer(GrBufferObj *arrayBuffer);
61 GrBufferObj *getArrayBuffer() { return fArrayBuffer; } 63 GrBufferObj *getArrayBuffer() { return fArrayBuffer; }
62 64
63 void setElementArrayBuffer(GrBufferObj *elementArrayBuffer); 65 void setElementArrayBuffer(GrBufferObj *elementArrayBuffer);
64 GrBufferObj *getElementArrayBuffer() { return fEl ementArrayBuffer; } 66 GrBufferObj *getElementArrayBuffer() { return fEl ementArrayBuffer; }
65 67
68 void setVertexArray(GrVertexArrayObj* vertexArray);
69 GrVertexArrayObj* getVertexArray() { return fVertexArray; }
70
66 void setTexture(GrTextureObj *texture); 71 void setTexture(GrTextureObj *texture);
67 72
68 void setFrameBuffer(GrFrameBufferObj *frameBuffer); 73 void setFrameBuffer(GrFrameBufferObj *frameBuffer);
69 GrFrameBufferObj *getFrameBuffer() { return fFrameBuffer; } 74 GrFrameBufferObj *getFrameBuffer() { return fFrameBuffer; }
70 75
71 void setRenderBuffer(GrRenderBufferObj *renderBuffer); 76 void setRenderBuffer(GrRenderBufferObj *renderBuffer);
72 GrRenderBufferObj *getRenderBuffer() { return fRenderBuffer ; } 77 GrRenderBufferObj *getRenderBuffer() { return fRenderBuffer ; }
73 78
74 void useProgram(GrProgramObj *program); 79 void useProgram(GrProgramObj *program);
75 80
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 protected: 117 protected:
113 118
114 private: 119 private:
115 // the OpenGLES 2.0 spec says this must be >= 2 120 // the OpenGLES 2.0 spec says this must be >= 2
116 static const GrGLint kDefaultMaxTextureUnits = 8; 121 static const GrGLint kDefaultMaxTextureUnits = 8;
117 122
118 GrGLint fPackRowLength; 123 GrGLint fPackRowLength;
119 GrGLint fUnPackRowLength; 124 GrGLint fUnPackRowLength;
120 GrGLuint fMaxTextureUnits; 125 GrGLuint fMaxTextureUnits;
121 GrGLuint fCurTextureUnit; 126 GrGLuint fCurTextureUnit;
122 GrBufferObj * fArrayBuffer; 127 GrBufferObj* fArrayBuffer;
123 GrBufferObj * fElementArrayBuffer; 128 GrBufferObj* fElementArrayBuffer;
124 GrFrameBufferObj *fFrameBuffer; 129 GrFrameBufferObj* fFrameBuffer;
125 GrRenderBufferObj *fRenderBuffer; 130 GrRenderBufferObj* fRenderBuffer;
126 GrProgramObj * fProgram; 131 GrProgramObj* fProgram;
127 GrTextureObj * fTexture; 132 GrTextureObj* fTexture;
128 GrTextureUnitObj *fTextureUnits[kDefaultMaxTextureUnits]; 133 GrTextureUnitObj *fTextureUnits[kDefaultMaxTextureUnits];
134 GrVertexArrayObj *fVertexArray;
129 135
130 typedef GrFakeRefObj *(*Create)(); 136 typedef GrFakeRefObj *(*Create)();
131 137
132 static Create gFactoryFunc[kObjTypeCount]; 138 static Create gFactoryFunc[kObjTypeCount];
133 139
134 static GrDebugGL* gObj; 140 static GrDebugGL* gObj;
135 static int gStaticRefCount; 141 static int gStaticRefCount;
136 142
137 // global store of all objects 143 // global store of all objects
138 SkTArray<GrFakeRefObj *> fObjects; 144 SkTArray<GrFakeRefObj *> fObjects;
139 145
140 GrDebugGL(); 146 GrDebugGL();
141 ~GrDebugGL(); 147 ~GrDebugGL();
142 }; 148 };
143 149
144 //////////////////////////////////////////////////////////////////////////////// 150 ////////////////////////////////////////////////////////////////////////////////
145 // Helper macro to make creating an object (where you need to get back a derived 151 // Helper macro to make creating an object (where you need to get back a derived
146 // type) easier 152 // type) easier
147 #define GR_CREATE(className, classEnum) \ 153 #define GR_CREATE(className, classEnum) \
148 reinterpret_cast<className *>(GrDebugGL::getInstance()->createObj(classEnum) ) 154 reinterpret_cast<className *>(GrDebugGL::getInstance()->createObj(classEnum) )
149 155
150 //////////////////////////////////////////////////////////////////////////////// 156 ////////////////////////////////////////////////////////////////////////////////
151 // Helper macro to make finding objects less painful 157 // Helper macro to make finding objects less painful
152 #define GR_FIND(id, className, classEnum) \ 158 #define GR_FIND(id, className, classEnum) \
153 reinterpret_cast<className *>(GrDebugGL::getInstance()->findObject(id, class Enum)) 159 reinterpret_cast<className *>(GrDebugGL::getInstance()->findObject(id, class Enum))
154 160
155 #endif // GrDebugGL_DEFINED 161 #endif // GrDebugGL_DEFINED
OLDNEW
« no previous file with comments | « src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp ('k') | src/gpu/gl/debug/GrDebugGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698