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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
10 #include "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 fProgramCache = SkNEW_ARGS(ProgramCache, (this)); | 148 fProgramCache = SkNEW_ARGS(ProgramCache, (this)); |
149 | 149 |
150 SkASSERT(this->glCaps().maxVertexAttributes() >= GrGeometryProcessor::kMaxVe
rtexAttribs); | 150 SkASSERT(this->glCaps().maxVertexAttributes() >= GrGeometryProcessor::kMaxVe
rtexAttribs); |
151 | 151 |
152 fLastSuccessfulStencilFmtIdx = 0; | 152 fLastSuccessfulStencilFmtIdx = 0; |
153 fHWProgramID = 0; | 153 fHWProgramID = 0; |
154 fTempSrcFBOID = 0; | 154 fTempSrcFBOID = 0; |
155 fTempDstFBOID = 0; | 155 fTempDstFBOID = 0; |
156 fStencilClearFBOID = 0; | 156 fStencilClearFBOID = 0; |
157 | 157 |
158 if (this->glCaps().pathRenderingSupport()) { | 158 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { |
159 fPathRendering.reset(new GrGLPathRendering(this)); | 159 fPathRendering.reset(new GrGLPathRendering(this)); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 GrGLGpu::~GrGLGpu() { | 163 GrGLGpu::~GrGLGpu() { |
164 if (0 != fHWProgramID) { | 164 if (0 != fHWProgramID) { |
165 // detach the current program so there is no confusion on OpenGL's part | 165 // detach the current program so there is no confusion on OpenGL's part |
166 // that we want it to be deleted | 166 // that we want it to be deleted |
167 SkASSERT(fHWProgramID == fCurrentProgram->programID()); | 167 SkASSERT(fHWProgramID == fCurrentProgram->programID()); |
168 GL_CALL(UseProgram(0)); | 168 GL_CALL(UseProgram(0)); |
(...skipping 12 matching lines...) Expand all Loading... |
181 delete fProgramCache; | 181 delete fProgramCache; |
182 } | 182 } |
183 | 183 |
184 void GrGLGpu::contextAbandoned() { | 184 void GrGLGpu::contextAbandoned() { |
185 INHERITED::contextAbandoned(); | 185 INHERITED::contextAbandoned(); |
186 fProgramCache->abandon(); | 186 fProgramCache->abandon(); |
187 fHWProgramID = 0; | 187 fHWProgramID = 0; |
188 fTempSrcFBOID = 0; | 188 fTempSrcFBOID = 0; |
189 fTempDstFBOID = 0; | 189 fTempDstFBOID = 0; |
190 fStencilClearFBOID = 0; | 190 fStencilClearFBOID = 0; |
191 if (this->glCaps().pathRenderingSupport()) { | 191 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { |
192 this->glPathRendering()->abandonGpuResources(); | 192 this->glPathRendering()->abandonGpuResources(); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 /////////////////////////////////////////////////////////////////////////////// | 196 /////////////////////////////////////////////////////////////////////////////// |
197 GrPixelConfig GrGLGpu::preferredReadPixelsConfig(GrPixelConfig readConfig, | 197 GrPixelConfig GrGLGpu::preferredReadPixelsConfig(GrPixelConfig readConfig, |
198 GrPixelConfig surfaceConfig) co
nst { | 198 GrPixelConfig surfaceConfig) co
nst { |
199 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { | 199 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { |
200 return kBGRA_8888_GrPixelConfig; | 200 return kBGRA_8888_GrPixelConfig; |
201 } else if (this->glContext().isMesa() && | 201 } else if (this->glContext().isMesa() && |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // Vertex | 328 // Vertex |
329 if (resetBits & kVertex_GrGLBackendState) { | 329 if (resetBits & kVertex_GrGLBackendState) { |
330 fHWGeometryState.invalidate(); | 330 fHWGeometryState.invalidate(); |
331 } | 331 } |
332 | 332 |
333 if (resetBits & kRenderTarget_GrGLBackendState) { | 333 if (resetBits & kRenderTarget_GrGLBackendState) { |
334 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 334 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
335 } | 335 } |
336 | 336 |
337 if (resetBits & kPathRendering_GrGLBackendState) { | 337 if (resetBits & kPathRendering_GrGLBackendState) { |
338 if (this->caps()->pathRenderingSupport()) { | 338 if (this->caps()->shaderCaps()->pathRenderingSupport()) { |
339 this->glPathRendering()->resetContext(); | 339 this->glPathRendering()->resetContext(); |
340 } | 340 } |
341 } | 341 } |
342 | 342 |
343 // we assume these values | 343 // we assume these values |
344 if (resetBits & kPixelStore_GrGLBackendState) { | 344 if (resetBits & kPixelStore_GrGLBackendState) { |
345 if (this->glCaps().unpackRowLengthSupport()) { | 345 if (this->glCaps().unpackRowLengthSupport()) { |
346 GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); | 346 GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); |
347 } | 347 } |
348 if (this->glCaps().packRowLengthSupport()) { | 348 if (this->glCaps().packRowLengthSupport()) { |
(...skipping 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 this->setVertexArrayID(gpu, 0); | 2775 this->setVertexArrayID(gpu, 0); |
2776 } | 2776 } |
2777 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2777 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2778 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2778 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2779 fDefaultVertexArrayAttribState.resize(attrCount); | 2779 fDefaultVertexArrayAttribState.resize(attrCount); |
2780 } | 2780 } |
2781 attribState = &fDefaultVertexArrayAttribState; | 2781 attribState = &fDefaultVertexArrayAttribState; |
2782 } | 2782 } |
2783 return attribState; | 2783 return attribState; |
2784 } | 2784 } |
OLD | NEW |