| 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 static const GrGLenum attachments[] = { GR_GL_COLOR }; | 1323 static const GrGLenum attachments[] = { GR_GL_COLOR }; |
| 1324 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), | 1324 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), |
| 1325 attachments)); | 1325 attachments)); |
| 1326 } else { | 1326 } else { |
| 1327 static const GrGLenum attachments[] = { GR_GL_COLOR_ATTACHMENT0
}; | 1327 static const GrGLenum attachments[] = { GR_GL_COLOR_ATTACHMENT0
}; |
| 1328 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), | 1328 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), |
| 1329 attachments)); | 1329 attachments)); |
| 1330 } | 1330 } |
| 1331 break; | 1331 break; |
| 1332 case GrGLCaps::kDiscard_InvalidateFBType: { | 1332 case GrGLCaps::kDiscard_InvalidateFBType: { |
| 1333 static const GrGLenum attachments[] = { GR_GL_COLOR }; | 1333 if (0 == glRT->renderFBOID()) { |
| 1334 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(attachm
ents), | 1334 // When rendering to the default framebuffer the legal values f
or attachments |
| 1335 attachments)); | 1335 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari
ous FBO attachment |
| 1336 // types. See glDiscardFramebuffer() spec. |
| 1337 static const GrGLenum attachments[] = { GR_GL_COLOR }; |
| 1338 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(att
achments), |
| 1339 attachments)); |
| 1340 } else { |
| 1341 static const GrGLenum attachments[] = { GR_GL_COLOR_ATTACHMENT0
}; |
| 1342 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(att
achments), |
| 1343 attachments)); |
| 1344 } |
| 1336 break; | 1345 break; |
| 1337 } | 1346 } |
| 1338 } | 1347 } |
| 1339 renderTarget->flagAsResolved(); | 1348 renderTarget->flagAsResolved(); |
| 1340 } | 1349 } |
| 1341 | 1350 |
| 1342 | 1351 |
| 1343 void GrGpuGL::clearStencil() { | 1352 void GrGpuGL::clearStencil() { |
| 1344 if (NULL == this->getDrawState().getRenderTarget()) { | 1353 if (NULL == this->getDrawState().getRenderTarget()) { |
| 1345 return; | 1354 return; |
| (...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 this->setVertexArrayID(gpu, 0); | 2843 this->setVertexArrayID(gpu, 0); |
| 2835 } | 2844 } |
| 2836 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2845 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2837 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2846 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2838 fDefaultVertexArrayAttribState.resize(attrCount); | 2847 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2839 } | 2848 } |
| 2840 attribState = &fDefaultVertexArrayAttribState; | 2849 attribState = &fDefaultVertexArrayAttribState; |
| 2841 } | 2850 } |
| 2842 return attribState; | 2851 return attribState; |
| 2843 } | 2852 } |
| OLD | NEW |