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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 g = GrColorUnpackG(color) * scaleRGB; | 1394 g = GrColorUnpackG(color) * scaleRGB; |
1395 b = GrColorUnpackB(color) * scaleRGB; | 1395 b = GrColorUnpackB(color) * scaleRGB; |
1396 | 1396 |
1397 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); | 1397 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); |
1398 fHWWriteToColor = kYes_TriState; | 1398 fHWWriteToColor = kYes_TriState; |
1399 GL_CALL(ClearColor(r, g, b, a)); | 1399 GL_CALL(ClearColor(r, g, b, a)); |
1400 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT)); | 1400 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT)); |
1401 } | 1401 } |
1402 | 1402 |
1403 void GrGpuGL::discard(GrRenderTarget* renderTarget) { | 1403 void GrGpuGL::discard(GrRenderTarget* renderTarget) { |
| 1404 SkASSERT(renderTarget); |
1404 if (!this->caps()->discardRenderTargetSupport()) { | 1405 if (!this->caps()->discardRenderTargetSupport()) { |
1405 return; | 1406 return; |
1406 } | 1407 } |
1407 if (NULL == renderTarget) { | |
1408 renderTarget = this->drawState()->getRenderTarget(); | |
1409 if (NULL == renderTarget) { | |
1410 return; | |
1411 } | |
1412 } | |
1413 | 1408 |
1414 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); | 1409 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); |
1415 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { | 1410 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { |
1416 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 1411 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
1417 fGPUStats.incRenderTargetBinds(); | 1412 fGPUStats.incRenderTargetBinds(); |
1418 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); | 1413 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); |
1419 } | 1414 } |
1420 switch (this->glCaps().invalidateFBType()) { | 1415 switch (this->glCaps().invalidateFBType()) { |
1421 case GrGLCaps::kNone_InvalidateFBType: | 1416 case GrGLCaps::kNone_InvalidateFBType: |
1422 SkFAIL("Should never get here."); | 1417 SkFAIL("Should never get here."); |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 this->setVertexArrayID(gpu, 0); | 2561 this->setVertexArrayID(gpu, 0); |
2567 } | 2562 } |
2568 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2563 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2569 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2564 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2570 fDefaultVertexArrayAttribState.resize(attrCount); | 2565 fDefaultVertexArrayAttribState.resize(attrCount); |
2571 } | 2566 } |
2572 attribState = &fDefaultVertexArrayAttribState; | 2567 attribState = &fDefaultVertexArrayAttribState; |
2573 } | 2568 } |
2574 return attribState; | 2569 return attribState; |
2575 } | 2570 } |
OLD | NEW |