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

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: initialize values 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/GrProcOptInfo.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrProcOptInfo.cpp
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c3ca100b61cbe7d1771945787b05573871de0d00
--- /dev/null
+++ b/src/gpu/GrProcOptInfo.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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();
+ fInOut.resetWillUseInputColor();
+ processor->computeInvariantOutput(&fInOut);
+ #ifdef SK_DEBUG
+ fInOut.validate();
+ #endif
+ if (!fInOut.willUseInputColor()) {
+ fFirstEffectStageIndex = i;
+ fInputColorIsUsed = false;
+ fReadsDst = false; // Reset this since we don't care if previous stages read dst
+ }
+ if (processor->willReadDstColor()) {
+ fReadsDst = true;
+ }
+ 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();
+ fReadsDst = false; // Reset this since we don't care if previous stages read dst
+ }
+ }
+}
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698