aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProcOptInfo.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-27 13:09:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-27 17:45:29 +0000
commitc0b642ca48d58416409e555549434066f09692b7 (patch)
tree42de3fb562c64c5bd22f9f7622ba8ae699ad3e08 /src/gpu/GrProcOptInfo.h
parent88f9c1eff96a12cfa42db5c238ed42623762d90c (diff)
Split GrPipelineInput into separate color and coverage types, the latter of which is just an enum.
Assign names that indicate that they aren't just for the input phase since I plan to use them at the boundary between FPs and XPs as well. Renamed GrProcOptInfo to GrColorFragmentProcessorAnalysis. This is now only used on the color side and the new name seems clearer to me. Change GrMeshDrawOp::getFragmentProcessorAnalysisInputs to use the new color/coverage types directly rather than a class that has been reduced to simply bundling them together. Change-Id: If93bae74c9d590486eecdf63f302418c96deab65 Reviewed-on: https://skia-review.googlesource.com/10161 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrProcOptInfo.h')
-rw-r--r--src/gpu/GrProcOptInfo.h103
1 files changed, 0 insertions, 103 deletions
diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h
deleted file mode 100644
index 549fb7a60b..0000000000
--- a/src/gpu/GrProcOptInfo.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrProcOptInfo_DEFINED
-#define GrProcOptInfo_DEFINED
-
-#include "GrColor.h"
-#include "GrPipelineInput.h"
-
-class GrDrawOp;
-class GrFragmentProcessor;
-class GrPrimitiveProcessor;
-
-/**
- * GrProcOptInfo gathers invariant data from a set of processor stages.It is used to recognize
- * optimizations related to eliminating stages and vertex attributes that aren't necessary for a
- * draw.
- */
-class GrProcOptInfo {
-public:
- GrProcOptInfo() = default;
-
- GrProcOptInfo(const GrPipelineInput& input) : GrProcOptInfo() {
- fAllProcessorsCompatibleWithCoverageAsAlpha = !input.isLCDCoverage();
- fIsOpaque = input.isOpaque();
- GrColor color;
- if (input.isConstant(&color)) {
- fLastKnownOutputColor = GrColor4f::FromGrColor(color);
- fProcessorsVisitedWithKnownOutput = 0;
- }
- }
-
- void reset(const GrPipelineInput& input) { *this = GrProcOptInfo(input); }
-
- /**
- * Runs through a series of processors and updates calculated values. This can be called
- * repeatedly for cases when the sequence of processors is not in a contiguous array.
- */
- void analyzeProcessors(const GrFragmentProcessor* const* processors, int cnt);
-
- bool isOpaque() const { return fIsOpaque; }
-
- /**
- * Are all the fragment processors compatible with conflating coverage with color prior to the
- * the first fragment processor. This result does not consider processors that should be
- * eliminated as indicated by initialProcessorsToEliminate().
- */
- bool allProcessorsCompatibleWithCoverageAsAlpha() const {
- return fAllProcessorsCompatibleWithCoverageAsAlpha;
- }
-
- /**
- * Do any of the fragment processors require local coords. This result does not consider
- * processors that should be eliminated as indicated by initialProcessorsToEliminate().
- */
- bool usesLocalCoords() const { return fUsesLocalCoords; }
-
- /**
- * If we detected that the result after the first N processors is a known color then we
- * eliminate those N processors and replace the GrDrawOp's color input to the GrPipeline with
- * the known output of the Nth processor, so that the Nth+1 fragment processor (or the XP if
- * there are only N processors) sees its expected input. If this returns 0 then there are no
- * processors to eliminate.
- */
- int initialProcessorsToEliminate(GrColor* newPipelineInputColor) const {
- if (fProcessorsVisitedWithKnownOutput > 0) {
- *newPipelineInputColor = fLastKnownOutputColor.toGrColor();
- }
- return SkTMax(0, fProcessorsVisitedWithKnownOutput);
- }
-
- int initialProcessorsToEliminate(GrColor4f* newPipelineInputColor) const {
- if (fProcessorsVisitedWithKnownOutput > 0) {
- *newPipelineInputColor = fLastKnownOutputColor;
- }
- return SkTMax(0, fProcessorsVisitedWithKnownOutput);
- }
-
- bool hasKnownOutputColor(GrColor* knownOutputColor = nullptr) const {
- if (fProcessorsVisitedWithKnownOutput != fTotalProcessorsVisited) {
- return false;
- }
- if (knownOutputColor) {
- *knownOutputColor = fLastKnownOutputColor.toGrColor();
- }
- return true;
- }
-
-private:
- int fTotalProcessorsVisited = 0;
- // negative one means even the color is unknown before adding the first processor.
- int fProcessorsVisitedWithKnownOutput = -1;
- bool fIsOpaque = false;
- bool fAllProcessorsCompatibleWithCoverageAsAlpha = true;
- bool fUsesLocalCoords = false;
- GrColor4f fLastKnownOutputColor;
-};
-
-#endif