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

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 739673002: Create GrOptDrawState before recording draw in GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused function in pendingprogramelement 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrPendingFragmentStage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOptDrawState.cpp
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index 4a258c2e172bca8fa05f25e6ce0b633aa53d784d..4b20fa901c79628bd4456226af61125fec7b5fbe 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -19,8 +19,8 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
GrBlendCoeff optDstCoeff,
GrGpu* gpu,
const GrDeviceCoordTexture* dstCopy,
- GrGpu::DrawType drawType) {
- fRenderTarget.set(SkSafeRef(drawState.getRenderTarget()), kWrite_GrIOType);
+ GrGpu::DrawType drawType)
+: fRenderTarget(drawState.fRenderTarget.get()) {
fViewMatrix = drawState.getViewMatrix();
fBlendConstant = drawState.getBlendConstant();
fFlagBits = drawState.getFlagBits();
@@ -66,26 +66,21 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) ||
GrGpu::kStencilPath_DrawType ||
drawState.hasGeometryProcessor());
- if (drawState.hasGeometryProcessor()) {
- fGeometryProcessor.initAndRef(drawState.fGeometryProcessor);
- } else {
- fGeometryProcessor.reset(NULL);
- }
+ fGeometryProcessor.reset(drawState.getGeometryProcessor());
- // Copy Color Stages from DS to ODS
- if (firstColorStageIdx < drawState.numColorStages()) {
- fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx),
- drawState.numColorStages() - firstColorStageIdx);
- } else {
- fFragmentStages.reset();
- }
+ // Copy Stages from DS to ODS
+ bool explicitLocalCoords = descInfo.hasLocalCoordAttribute();
+ for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) {
+ SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
+ GrPendingFragmentStage,
+ (drawState.fColorStages[i], explicitLocalCoords));
+ }
fNumColorStages = fFragmentStages.count();
-
- // Copy Coverage Stages from DS to ODS
- if (firstCoverageStageIdx < drawState.numCoverageStages()) {
- fFragmentStages.push_back_n(drawState.numCoverageStages() - firstCoverageStageIdx,
- &drawState.getCoverageStage(firstCoverageStageIdx));
+ for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i) {
+ SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
+ GrPendingFragmentStage,
+ (drawState.fCoverageStages[i], explicitLocalCoords));
}
this->setOutputStateInfo(drawState, *gpu->caps(), &descInfo);
@@ -257,10 +252,6 @@ void GrOptDrawState::getStageStats(const GrDrawState& ds, int firstColorStageIdx
////////////////////////////////////////////////////////////////////////////////
bool GrOptDrawState::operator== (const GrOptDrawState& that) const {
- return this->isEqual(that);
-}
-
-bool GrOptDrawState::isEqual(const GrOptDrawState& that) const {
if (this->fDesc != that.fDesc) {
return false;
}
@@ -298,10 +289,11 @@ bool GrOptDrawState::isEqual(const GrOptDrawState& that) const {
return false;
}
- bool explicitLocalCoords = this->fDesc.header().fLocalCoordAttributeIndex != -1;
+ // The program desc comparison should have already assured that the stage counts match.
+ SkASSERT(this->numFragmentStages() == that.numFragmentStages());
for (int i = 0; i < this->numFragmentStages(); i++) {
- if (!GrFragmentStage::AreCompatible(this->getFragmentStage(i), that.getFragmentStage(i),
- explicitLocalCoords)) {
+
+ if (this->getFragmentStage(i) != that.getFragmentStage(i)) {
return false;
}
}
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrPendingFragmentStage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698