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 } | 185 // This subclass must do this before the base class destructor runs |
186 | 186 // since we will unref the GrGLInterface. |
187 void GrGpuGL::contextAbandonded() { | 187 this->releaseResources(); |
188 INHERITED::contextAbandonded(); | |
189 fProgramCache->abandon(); | |
190 fHWProgramID = 0; | |
191 if (this->glCaps().pathRenderingSupport()) { | |
192 fPathRendering->abandonGpuResources(); | |
193 } | |
194 } | 188 } |
195 | 189 |
196 /////////////////////////////////////////////////////////////////////////////// | 190 /////////////////////////////////////////////////////////////////////////////// |
197 | 191 |
198 | 192 |
199 GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, | 193 GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig, |
200 GrPixelConfig surfaceConfig) co
nst { | 194 GrPixelConfig surfaceConfig) co
nst { |
201 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { | 195 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { |
202 return kBGRA_8888_GrPixelConfig; | 196 return kBGRA_8888_GrPixelConfig; |
203 } else if (this->glContext().isMesa() && | 197 } else if (this->glContext().isMesa() && |
(...skipping 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 this->setVertexArrayID(gpu, 0); | 2943 this->setVertexArrayID(gpu, 0); |
2950 } | 2944 } |
2951 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2945 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2952 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2946 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2953 fDefaultVertexArrayAttribState.resize(attrCount); | 2947 fDefaultVertexArrayAttribState.resize(attrCount); |
2954 } | 2948 } |
2955 attribState = &fDefaultVertexArrayAttribState; | 2949 attribState = &fDefaultVertexArrayAttribState; |
2956 } | 2950 } |
2957 return attribState; | 2951 return attribState; |
2958 } | 2952 } |
OLD | NEW |