OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 GrGpuGL::~GrGpuGL() { | 158 GrGpuGL::~GrGpuGL() { |
159 if (0 != fHWProgramID) { | 159 if (0 != fHWProgramID) { |
160 // detach the current program so there is no confusion on OpenGL's part | 160 // detach the current program so there is no confusion on OpenGL's part |
161 // that we want it to be deleted | 161 // that we want it to be deleted |
162 SkASSERT(fHWProgramID == fCurrentProgram->programID()); | 162 SkASSERT(fHWProgramID == fCurrentProgram->programID()); |
163 GL_CALL(UseProgram(0)); | 163 GL_CALL(UseProgram(0)); |
164 } | 164 } |
165 | 165 |
166 delete fProgramCache; | 166 delete fProgramCache; |
167 | |
168 // This must be called by before the GrDrawTarget destructor | |
169 this->releaseGeometry(); | |
170 } | 167 } |
171 | 168 |
172 void GrGpuGL::contextAbandoned() { | 169 void GrGpuGL::contextAbandoned() { |
173 INHERITED::contextAbandoned(); | 170 INHERITED::contextAbandoned(); |
174 fProgramCache->abandon(); | 171 fProgramCache->abandon(); |
175 fHWProgramID = 0; | 172 fHWProgramID = 0; |
176 if (this->glCaps().pathRenderingSupport()) { | 173 if (this->glCaps().pathRenderingSupport()) { |
177 this->glPathRendering()->abandonGpuResources(); | 174 this->glPathRendering()->abandonGpuResources(); |
178 } | 175 } |
179 } | 176 } |
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 this->setVertexArrayID(gpu, 0); | 2554 this->setVertexArrayID(gpu, 0); |
2558 } | 2555 } |
2559 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2556 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2560 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2557 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2561 fDefaultVertexArrayAttribState.resize(attrCount); | 2558 fDefaultVertexArrayAttribState.resize(attrCount); |
2562 } | 2559 } |
2563 attribState = &fDefaultVertexArrayAttribState; | 2560 attribState = &fDefaultVertexArrayAttribState; |
2564 } | 2561 } |
2565 return attribState; | 2562 return attribState; |
2566 } | 2563 } |
OLD | NEW |