| 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 // detach the current program so there is no confusion on OpenGL's part | 157 // detach the current program so there is no confusion on OpenGL's part |
| 158 // that we want it to be deleted | 158 // that we want it to be deleted |
| 159 SkASSERT(fHWProgramID == fCurrentProgram->programID()); | 159 SkASSERT(fHWProgramID == fCurrentProgram->programID()); |
| 160 GL_CALL(UseProgram(0)); | 160 GL_CALL(UseProgram(0)); |
| 161 } | 161 } |
| 162 | 162 |
| 163 delete fProgramCache; | 163 delete fProgramCache; |
| 164 | 164 |
| 165 // This must be called by before the GrDrawTarget destructor | 165 // This must be called by before the GrDrawTarget destructor |
| 166 this->releaseGeometry(); | 166 this->releaseGeometry(); |
| 167 // This subclass must do this before the base class destructor runs | 167 } |
| 168 // since we will unref the GrGLInterface. | 168 |
| 169 this->releaseResources(); | 169 void GrGpuGL::contextAbandonded() { |
| 170 INHERITED::contextAbandonded(); |
| 171 fProgramCache->abandon(); |
| 172 fHWProgramID = 0; |
| 173 if (this->glCaps().pathRenderingSupport()) { |
| 174 this->glPathRendering()->abandonGpuResources(); |
| 175 } |
| 170 } | 176 } |
| 171 | 177 |
| 172 /////////////////////////////////////////////////////////////////////////////// | 178 /////////////////////////////////////////////////////////////////////////////// |
| 173 | 179 |
| 174 | 180 |
| 175 GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, | 181 GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, |
| 176 GrPixelConfig surfaceConfig) co
nst { | 182 GrPixelConfig surfaceConfig) co
nst { |
| 177 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { | 183 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { |
| 178 return kBGRA_8888_GrPixelConfig; | 184 return kBGRA_8888_GrPixelConfig; |
| 179 } else if (this->glContext().isMesa() && | 185 } else if (this->glContext().isMesa() && |
| (...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2605 this->setVertexArrayID(gpu, 0); | 2611 this->setVertexArrayID(gpu, 0); |
| 2606 } | 2612 } |
| 2607 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2613 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2608 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2614 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2609 fDefaultVertexArrayAttribState.resize(attrCount); | 2615 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2610 } | 2616 } |
| 2611 attribState = &fDefaultVertexArrayAttribState; | 2617 attribState = &fDefaultVertexArrayAttribState; |
| 2612 } | 2618 } |
| 2613 return attribState; | 2619 return attribState; |
| 2614 } | 2620 } |
| OLD | NEW |