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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // detach the current program so there is no confusion on OpenGL's part | 175 // detach the current program so there is no confusion on OpenGL's part |
176 // that we want it to be deleted | 176 // that we want it to be deleted |
177 SkASSERT(fHWProgramID == fCurrentProgram->programID()); | 177 SkASSERT(fHWProgramID == fCurrentProgram->programID()); |
178 GL_CALL(UseProgram(0)); | 178 GL_CALL(UseProgram(0)); |
179 } | 179 } |
180 | 180 |
181 delete fProgramCache; | 181 delete fProgramCache; |
182 | 182 |
183 // This must be called by before the GrDrawTarget destructor | 183 // This must be called by before the GrDrawTarget destructor |
184 this->releaseGeometry(); | 184 this->releaseGeometry(); |
185 // This subclass must do this before the base class destructor runs | 185 } |
186 // since we will unref the GrGLInterface. | 186 |
187 this->releaseResources(); | 187 void GrGpuGL::contextAbandonded() { |
| 188 INHERITED::contextAbandonded(); |
| 189 fProgramCache->abandon(); |
| 190 fHWProgramID = 0; |
| 191 if (this->glCaps().pathRenderingSupport()) { |
| 192 fPathRendering->abandonGpuResources(); |
| 193 } |
188 } | 194 } |
189 | 195 |
190 /////////////////////////////////////////////////////////////////////////////// | 196 /////////////////////////////////////////////////////////////////////////////// |
191 | 197 |
192 | 198 |
193 GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, | 199 GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, |
194 GrPixelConfig surfaceConfig) co
nst { | 200 GrPixelConfig surfaceConfig) co
nst { |
195 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { | 201 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { |
196 return kBGRA_8888_GrPixelConfig; | 202 return kBGRA_8888_GrPixelConfig; |
197 } else if (this->glContext().isMesa() && | 203 } else if (this->glContext().isMesa() && |
(...skipping 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2943 this->setVertexArrayID(gpu, 0); | 2949 this->setVertexArrayID(gpu, 0); |
2944 } | 2950 } |
2945 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2951 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2946 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2952 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2947 fDefaultVertexArrayAttribState.resize(attrCount); | 2953 fDefaultVertexArrayAttribState.resize(attrCount); |
2948 } | 2954 } |
2949 attribState = &fDefaultVertexArrayAttribState; | 2955 attribState = &fDefaultVertexArrayAttribState; |
2950 } | 2956 } |
2951 return attribState; | 2957 return attribState; |
2952 } | 2958 } |
OLD | NEW |