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

Side by Side Diff: src/gpu/GrDrawState.cpp

Issue 15199008: Disable blending when there is an effect that reads the dst and draw state blend is 1,0. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 #include "GrDrawState.h" 8 #include "GrDrawState.h"
9 #include "GrPaint.h" 9 #include "GrPaint.h"
10 10
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 *dstCoeff = kISA_GrBlendCoeff; 364 *dstCoeff = kISA_GrBlendCoeff;
365 return kCoverageAsAlpha_BlendOptFlag; 365 return kCoverageAsAlpha_BlendOptFlag;
366 } 366 }
367 } else if (dstCoeffIsOne) { 367 } else if (dstCoeffIsOne) {
368 // the dst coeff is effectively one so blend works out to: 368 // the dst coeff is effectively one so blend works out to:
369 // cS + (c)(1)D + (1-c)D = cS + D. 369 // cS + (c)(1)D + (1-c)D = cS + D.
370 *dstCoeff = kOne_GrBlendCoeff; 370 *dstCoeff = kOne_GrBlendCoeff;
371 return kCoverageAsAlpha_BlendOptFlag; 371 return kCoverageAsAlpha_BlendOptFlag;
372 } 372 }
373 } 373 }
374 if (kOne_GrBlendCoeff == *srcCoeff &&
375 kZero_GrBlendCoeff == *dstCoeff &&
376 this->willEffectReadDstColor()) {
377 // In this case the shader will fully resolve the color, coverage, and d st and we don't
378 // need blending.
379 return kDisableBlend_BlendOptFlag;
380 }
374 return kNone_BlendOpt; 381 return kNone_BlendOpt;
375 } 382 }
376 383
377 //////////////////////////////////////////////////////////////////////////////// 384 ////////////////////////////////////////////////////////////////////////////////
378 385
379 void GrDrawState::AutoViewMatrixRestore::restore() { 386 void GrDrawState::AutoViewMatrixRestore::restore() {
380 if (NULL != fDrawState) { 387 if (NULL != fDrawState) {
381 fDrawState->setViewMatrix(fViewMatrix); 388 fDrawState->setViewMatrix(fViewMatrix);
382 for (int s = 0; s < GrDrawState::kNumStages; ++s) { 389 for (int s = 0; s < GrDrawState::kNumStages; ++s) {
383 if (fRestoreMask & (1 << s)) { 390 if (fRestoreMask & (1 << s)) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 456 }
450 fRestoreMask |= (1 << s); 457 fRestoreMask |= (1 << s);
451 GrEffectStage* stage = drawState->fStages + s; 458 GrEffectStage* stage = drawState->fStages + s;
452 stage->saveCoordChange(&fSavedCoordChanges[s]); 459 stage->saveCoordChange(&fSavedCoordChanges[s]);
453 stage->localCoordChange(invVM); 460 stage->localCoordChange(invVM);
454 } 461 }
455 } 462 }
456 drawState->viewMatrix()->reset(); 463 drawState->viewMatrix()->reset();
457 return true; 464 return true;
458 } 465 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698