Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: src/gpu/gl/GrGpuGL.cpp

Issue 680413005: Don't allow renderTarget==NULL to GrContext::clear() and friends. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/gpu/GrContext.cpp ('K') | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 g = GrColorUnpackG(color) * scaleRGB; 1399 g = GrColorUnpackG(color) * scaleRGB;
1400 b = GrColorUnpackB(color) * scaleRGB; 1400 b = GrColorUnpackB(color) * scaleRGB;
1401 1401
1402 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); 1402 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE));
1403 fHWWriteToColor = kYes_TriState; 1403 fHWWriteToColor = kYes_TriState;
1404 GL_CALL(ClearColor(r, g, b, a)); 1404 GL_CALL(ClearColor(r, g, b, a));
1405 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT)); 1405 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT));
1406 } 1406 }
1407 1407
1408 void GrGpuGL::discard(GrRenderTarget* renderTarget) { 1408 void GrGpuGL::discard(GrRenderTarget* renderTarget) {
1409 SkASSERT(renderTarget);
1409 if (!this->caps()->discardRenderTargetSupport()) { 1410 if (!this->caps()->discardRenderTargetSupport()) {
1410 return; 1411 return;
1411 } 1412 }
1412 if (NULL == renderTarget) {
1413 renderTarget = this->drawState()->getRenderTarget();
1414 if (NULL == renderTarget) {
1415 return;
1416 }
1417 }
1418 1413
1419 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); 1414 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget);
1420 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { 1415 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) {
1421 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; 1416 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
1422 fGPUStats.incRenderTargetBinds(); 1417 fGPUStats.incRenderTargetBinds();
1423 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); 1418 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID()));
1424 } 1419 }
1425 switch (this->glCaps().invalidateFBType()) { 1420 switch (this->glCaps().invalidateFBType()) {
1426 case GrGLCaps::kNone_InvalidateFBType: 1421 case GrGLCaps::kNone_InvalidateFBType:
1427 SkFAIL("Should never get here."); 1422 SkFAIL("Should never get here.");
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 this->setVertexArrayID(gpu, 0); 2567 this->setVertexArrayID(gpu, 0);
2573 } 2568 }
2574 int attrCount = gpu->glCaps().maxVertexAttributes(); 2569 int attrCount = gpu->glCaps().maxVertexAttributes();
2575 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2570 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2576 fDefaultVertexArrayAttribState.resize(attrCount); 2571 fDefaultVertexArrayAttribState.resize(attrCount);
2577 } 2572 }
2578 attribState = &fDefaultVertexArrayAttribState; 2573 attribState = &fDefaultVertexArrayAttribState;
2579 } 2574 }
2580 return attribState; 2575 return attribState;
2581 } 2576 }
OLDNEW
« src/gpu/GrContext.cpp ('K') | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698