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

Unified Diff: src/gpu/GrProcOptInfo.cpp

Issue 719203002: Add GrProcOptInfo class to track various output information for color and coverage stages. (Closed) Base URL: https://skia.googlesource.com/skia.git@moveIO
Patch Set: Delete old code 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
Index: src/gpu/GrProcOptInfo.cpp
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2f84fc3cde157b3724d85cce4952869e1e533490
--- /dev/null
+++ b/src/gpu/GrProcOptInfo.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrProcOptInfo.h"
+
+#include "GrGeometryProcessor.h"
+#include "GrProcessorStage.h"
+
+void GrProcOptInfo::calcWithInitialValues(const GrFragmentStage* stages,
+ int stageCount,
+ GrColor startColor,
+ GrColorComponentFlags flags,
+ bool areCoverageStages,
+ const GrGeometryProcessor* gp) {
+ fInout.reset(startColor, flags, areCoverageStages);
+ fFirstEffectStageIndex = 0;
+ fInputColorIsUsed = true;
+ fInputColor = startColor;
+ fRemoveVertexAttrib = false;
+ fReadsDst = false;
+
+ if (areCoverageStages && gp) {
+ gp->computeInvariantOutput(&fInout);
+ }
+
+ for (int i = 0; i < stageCount; ++i) {
+ const GrFragmentProcessor* processor = stages[i].getProcessor();
+ if (processor->willReadDstColor()) {
+ fReadsDst = true;
+ }
+ fInout.resetWillUseInputColor();
+ processor->computeInvariantOutput(&fInout);
+ #ifdef SK_DEBUG
+ fInout.validate();
+ #endif
+ if (!fInout.willUseInputColor()) {
+ fFirstEffectStageIndex = i;
+ fInputColorIsUsed = false;
+ }
+ if (kRGBA_GrColorComponentFlags == fInout.validFlags()) {
+ fFirstEffectStageIndex = i + 1;
+ fInputColor = fInout.color();
+ fInputColorIsUsed = true;
+ fRemoveVertexAttrib = true;
+ // 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.
+ fInout.resetNonMulStageFound();
+ }
+ }
+}
« src/gpu/GrProcOptInfo.h ('K') | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698