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

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: Address comment 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
« no previous file with comments | « 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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698