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

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup 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/GrInvariantOutput.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('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 79eef0c02499153e642c084e62ea706db0ebcacb..7d8b06c129cbb570d45d8622dd4483fcd3a5f47c 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -11,6 +11,7 @@
#include "GrDrawState.h"
#include "GrDrawTargetCaps.h"
#include "GrGpu.h"
+#include "GrInvariantOutput.h"
GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
BlendOptFlags blendOptFlags,
@@ -223,37 +224,38 @@ void GrOptDrawState::computeEffectiveColorStages(const GrDrawState& ds,
int* firstColorStageIdx,
uint8_t* fixedFunctionVAToRemove) {
// Set up color and flags for ConstantColorComponent checks
- GrProcessor::InvariantOutput inout;
- inout.fIsSingleComponent = false;
+ GrColor color;
+ GrColorComponentFlags flags;
if (!descInfo->hasColorVertexAttribute()) {
- inout.fColor = ds.getColor();
- inout.fValidFlags = kRGBA_GrColorComponentFlags;
+ color = ds.getColor();
+ flags = kRGBA_GrColorComponentFlags;
} else {
if (ds.vertexColorsAreOpaque()) {
- inout.fColor = 0xFF << GrColor_SHIFT_A;
- inout.fValidFlags = kA_GrColorComponentFlag;
+ color = 0xFF << GrColor_SHIFT_A;
+ flags = kA_GrColorComponentFlag;
} else {
- inout.fValidFlags = 0;
+ flags = static_cast<GrColorComponentFlags>(0);
// not strictly necessary but we get false alarms from tools about uninit.
- inout.fColor = 0;
+ color = 0;
}
}
+ GrInvariantOutput inout(color, flags, false);
for (int i = 0; i < ds.numColorStages(); ++i) {
const GrFragmentProcessor* fp = ds.getColorStage(i).getProcessor();
fp->computeInvariantOutput(&inout);
- if (!inout.fWillUseInputColor) {
+ if (!inout.willUseInputColor()) {
*firstColorStageIdx = i;
descInfo->fInputColorIsUsed = false;
}
- if (kRGBA_GrColorComponentFlags == inout.fValidFlags) {
+ if (kRGBA_GrColorComponentFlags == inout.validFlags()) {
*firstColorStageIdx = i + 1;
- fColor = inout.fColor;
+ fColor = inout.color();
descInfo->fInputColorIsUsed = true;
*fixedFunctionVAToRemove |= 0x1 << kColor_GrVertexAttribBinding;
// Since we are clearing all previous color stages we are in a state where we have found
// zero stages that don't multiply the inputColor.
- inout.fNonMulStageFound = false;
+ inout.resetNonMulStageFound();
}
}
}
@@ -268,7 +270,7 @@ void GrOptDrawState::computeEffectiveCoverageStages(const GrDrawState& ds,
// Don't do any optimizations on coverage stages. It should not be the case where we do not use
// input coverage in an effect
#ifdef OptCoverageStages
- GrProcessor::InvariantOutput inout;
+ GrInvariantOutput inout;
for (int i = 0; i < ds.numCoverageStages(); ++i) {
const GrFragmentProcessor* fp = ds.getCoverageStage(i).getProcessor();
fp->computeInvariantOutput(&inout);
« no previous file with comments | « src/gpu/GrInvariantOutput.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698