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

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: nvpr bug fixed Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrOptDrawState.cpp
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index d95bd3b7c42017a2526f4fd3e7fcb662bed8502e..a66a3310b0d7496d876d2aa6bbb0bda1c819efbf 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -13,15 +13,19 @@
#include "GrProcOptInfo.h"
GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
+ GrColor color,
+ uint8_t coverage,
const GrDrawTargetCaps& caps,
const ScissorState& scissorState,
const GrDeviceCoordTexture* dstCopy,
GrGpu::DrawType drawType)
: fFinalized(false) {
+ GrColor c = GrColorPackRGBA(coverage, coverage, coverage, coverage);
fDrawType = drawType;
GrBlendCoeff optSrcCoeff;
GrBlendCoeff optDstCoeff;
- GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(false, &optSrcCoeff, &optDstCoeff);
+ GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(color, c, false, &optSrcCoeff,
+ &optDstCoeff);
// When path rendering the stencil settings are not always set on the draw state
// so we must check the draw type. In cases where we will skip drawing we simply return a
@@ -73,7 +77,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
bool hasLocalCoords = drawState.hasGeometryProcessor() &&
drawState.getGeometryProcessor()->hasLocalCoords();
- const GrProcOptInfo& colorPOI = drawState.colorProcInfo();
+ const GrProcOptInfo& colorPOI = drawState.colorProcInfo(color);
int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
fDescInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed();
fColor = colorPOI.inputColorToEffectiveStage();
@@ -85,7 +89,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
// drawState's coverageProcInfo (like color above) to set this initial information.
int firstCoverageStageIdx = 0;
fDescInfo.fInputCoverageIsUsed = true;
- fCoverage = drawState.getCoverage();
+ fCoverage = coverage;
this->adjustProgramForBlendOpt(drawState, blendOpt, &firstColorStageIdx,
&firstCoverageStageIdx);
@@ -116,7 +120,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
(drawState.fCoverageStages[i], hasLocalCoords));
}
- this->setOutputStateInfo(drawState, blendOpt, caps);
+ this->setOutputStateInfo(drawState, c, blendOpt, caps);
// let the GP init the batch tracker
if (drawState.hasGeometryProcessor()) {
@@ -130,6 +134,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
}
void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds,
+ GrColor coverage,
GrDrawState::BlendOpt blendOpt,
const GrDrawTargetCaps& caps) {
// Set this default and then possibly change our mind if there is coverage.
@@ -140,7 +145,7 @@ void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds,
// separate from color.
bool keepCoverageSeparate = !(GrDrawState::kCoverageAsAlpha_BlendOpt == blendOpt ||
GrDrawState::kEmitCoverage_BlendOpt == blendOpt);
- if (keepCoverageSeparate && !ds.hasSolidCoverage()) {
+ if (keepCoverageSeparate && !ds.hasSolidCoverage(coverage)) {
if (caps.dualSourceBlendingSupport()) {
if (kZero_GrBlendCoeff == fDstBlend) {
// write the coverage value to second color
« src/gpu/GrDrawState.h ('K') | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrOvalRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698