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

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

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/debug/GrDebugGL.h ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.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 #include "GrDebugGL.h" 9 #include "GrDebugGL.h"
10 #include "GrTextureObj.h" 10 #include "GrTextureObj.h"
11 #include "GrBufferObj.h" 11 #include "GrBufferObj.h"
12 #include "GrRenderBufferObj.h" 12 #include "GrRenderBufferObj.h"
13 #include "GrFrameBufferObj.h" 13 #include "GrFrameBufferObj.h"
14 #include "GrShaderObj.h" 14 #include "GrShaderObj.h"
15 #include "GrProgramObj.h" 15 #include "GrProgramObj.h"
16 #include "GrTextureUnitObj.h" 16 #include "GrTextureUnitObj.h"
17 17 #include "GrVertexArrayObj.h"
18 18
19 GrDebugGL* GrDebugGL::gObj = NULL; 19 GrDebugGL* GrDebugGL::gObj = NULL;
20 int GrDebugGL::gStaticRefCount = 0; 20 int GrDebugGL::gStaticRefCount = 0;
21 GrDebugGL::Create GrDebugGL::gFactoryFunc[kObjTypeCount] = { 21 GrDebugGL::Create GrDebugGL::gFactoryFunc[kObjTypeCount] = {
22 GrTextureObj::createGrTextureObj, 22 GrTextureObj::createGrTextureObj,
23 GrBufferObj::createGrBufferObj, 23 GrBufferObj::createGrBufferObj,
24 GrRenderBufferObj::createGrRenderBufferObj, 24 GrRenderBufferObj::createGrRenderBufferObj,
25 GrFrameBufferObj::createGrFrameBufferObj, 25 GrFrameBufferObj::createGrFrameBufferObj,
26 GrShaderObj::createGrShaderObj, 26 GrShaderObj::createGrShaderObj,
27 GrProgramObj::createGrProgramObj, 27 GrProgramObj::createGrProgramObj,
28 GrTextureUnitObj::createGrTextureUnitObj, 28 GrTextureUnitObj::createGrTextureUnitObj,
29 GrVertexArrayObj::createGrVertexArrayObj,
29 }; 30 };
30 31
31 32
32 GrDebugGL::GrDebugGL() 33 GrDebugGL::GrDebugGL()
33 : fPackRowLength(0) 34 : fPackRowLength(0)
34 , fUnPackRowLength(0) 35 , fUnPackRowLength(0)
35 , fCurTextureUnit(0) 36 , fCurTextureUnit(0)
36 , fArrayBuffer(NULL) 37 , fArrayBuffer(NULL)
37 , fElementArrayBuffer(NULL) 38 , fElementArrayBuffer(NULL)
38 , fFrameBuffer(NULL) 39 , fFrameBuffer(NULL)
39 , fRenderBuffer(NULL) 40 , fRenderBuffer(NULL)
40 , fProgram(NULL) 41 , fProgram(NULL)
41 , fTexture(NULL) { 42 , fTexture(NULL)
43 , fVertexArray(NULL) {
42 44
43 for (int i = 0; i < kDefaultMaxTextureUnits; ++i) { 45 for (int i = 0; i < kDefaultMaxTextureUnits; ++i) {
44 46
45 fTextureUnits[i] = reinterpret_cast<GrTextureUnitObj *>( 47 fTextureUnits[i] = reinterpret_cast<GrTextureUnitObj *>(
46 createObj(GrDebugGL::kTextureUnit_ObjTypes)); 48 createObj(GrDebugGL::kTextureUnit_ObjTypes));
47 fTextureUnits[i]->ref(); 49 fTextureUnits[i]->ref();
48 50
49 fTextureUnits[i]->setNumber(i); 51 fTextureUnits[i]->setNumber(i);
50 } 52 }
51 } 53 }
(...skipping 11 matching lines...) Expand all
63 delete fObjects[i]; 65 delete fObjects[i];
64 } 66 }
65 fObjects.reset(); 67 fObjects.reset();
66 68
67 fArrayBuffer = NULL; 69 fArrayBuffer = NULL;
68 fElementArrayBuffer = NULL; 70 fElementArrayBuffer = NULL;
69 fFrameBuffer = NULL; 71 fFrameBuffer = NULL;
70 fRenderBuffer = NULL; 72 fRenderBuffer = NULL;
71 fProgram = NULL; 73 fProgram = NULL;
72 fTexture = NULL; 74 fTexture = NULL;
75 fVertexArray = NULL;
73 } 76 }
74 77
75 GrFakeRefObj *GrDebugGL::findObject(GrGLuint ID, GrObjTypes type) { 78 GrFakeRefObj *GrDebugGL::findObject(GrGLuint ID, GrObjTypes type) {
76 for (int i = 0; i < fObjects.count(); ++i) { 79 for (int i = 0; i < fObjects.count(); ++i) {
77 if (fObjects[i]->getID() == ID) { // && fObjects[i]->getType() == type) { 80 if (fObjects[i]->getID() == ID) { // && fObjects[i]->getType() == type) {
78 // The application shouldn't be accessing objects 81 // The application shouldn't be accessing objects
79 // that (as far as OpenGL knows) were already deleted 82 // that (as far as OpenGL knows) were already deleted
80 GrAlwaysAssert(!fObjects[i]->getDeleted()); 83 GrAlwaysAssert(!fObjects[i]->getDeleted());
81 GrAlwaysAssert(!fObjects[i]->getMarkedForDeletion()); 84 GrAlwaysAssert(!fObjects[i]->getMarkedForDeletion());
82 return fObjects[i]; 85 return fObjects[i];
(...skipping 17 matching lines...) Expand all
100 103
101 if (fArrayBuffer) { 104 if (fArrayBuffer) {
102 GrAlwaysAssert(!fArrayBuffer->getDeleted()); 105 GrAlwaysAssert(!fArrayBuffer->getDeleted());
103 fArrayBuffer->ref(); 106 fArrayBuffer->ref();
104 107
105 GrAlwaysAssert(!fArrayBuffer->getBound()); 108 GrAlwaysAssert(!fArrayBuffer->getBound());
106 fArrayBuffer->setBound(); 109 fArrayBuffer->setBound();
107 } 110 }
108 } 111 }
109 112
113 void GrDebugGL::setVertexArray(GrVertexArrayObj* vertexArray) {
114 if (NULL != vertexArray) {
115 GrAssert(!vertexArray->getDeleted());
116 }
117 SkRefCnt_SafeAssign(fVertexArray, vertexArray);
118 }
119
110 void GrDebugGL::setElementArrayBuffer(GrBufferObj *elementArrayBuffer) { 120 void GrDebugGL::setElementArrayBuffer(GrBufferObj *elementArrayBuffer) {
111 if (fElementArrayBuffer) { 121 if (fElementArrayBuffer) {
112 // automatically break the binding of the old buffer 122 // automatically break the binding of the old buffer
113 GrAlwaysAssert(fElementArrayBuffer->getBound()); 123 GrAlwaysAssert(fElementArrayBuffer->getBound());
114 fElementArrayBuffer->resetBound(); 124 fElementArrayBuffer->resetBound();
115 125
116 GrAlwaysAssert(!fElementArrayBuffer->getDeleted()); 126 GrAlwaysAssert(!fElementArrayBuffer->getDeleted());
117 fElementArrayBuffer->unref(); 127 fElementArrayBuffer->unref();
118 } 128 }
119 129
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 202 }
193 } 203 }
194 204
195 void GrDebugGL::report() const { 205 void GrDebugGL::report() const {
196 for (int i = 0; i < fObjects.count(); ++i) { 206 for (int i = 0; i < fObjects.count(); ++i) {
197 GrAlwaysAssert(0 == fObjects[i]->getRefCount()); 207 GrAlwaysAssert(0 == fObjects[i]->getRefCount());
198 GrAlwaysAssert(0 < fObjects[i]->getHighRefCount()); 208 GrAlwaysAssert(0 < fObjects[i]->getHighRefCount());
199 GrAlwaysAssert(fObjects[i]->getDeleted()); 209 GrAlwaysAssert(fObjects[i]->getDeleted());
200 } 210 }
201 } 211 }
OLDNEW
« no previous file with comments | « src/gpu/gl/debug/GrDebugGL.h ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698