aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@google.com>2015-07-13 13:29:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-13 13:29:13 -0700
commit6968428f44e8cc42edee7e3238b37e3b3a46106f (patch)
tree9ea989b71529ad2c7ab1b8dab18bd46522e66dd4 /src/gpu
parent3d32d768cd8b66c49c070495c08f7933b9dd2423 (diff)
Revert of Another trivial cleanup (patchset #6 id:100001 of https://codereview.chromium.org/1229303003/)
Reason for revert: breaking things Original issue's description: > Another trivial cleanup > > TBR=bsalomon@google.com > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/52e7657cd850f95e66eb23c6d138ee45149a1039 TBR=robertphillips@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1233853004
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrPendingFragmentStage.h53
-rw-r--r--src/gpu/GrPipeline.cpp16
-rw-r--r--src/gpu/GrPipeline.h5
-rw-r--r--src/gpu/GrPipelineBuilder.h2
-rw-r--r--src/gpu/GrProcOptInfo.cpp2
-rw-r--r--src/gpu/GrProcOptInfo.h2
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.h1
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h1
8 files changed, 70 insertions, 12 deletions
diff --git a/src/gpu/GrPendingFragmentStage.h b/src/gpu/GrPendingFragmentStage.h
new file mode 100644
index 0000000000..0bf984ab7d
--- /dev/null
+++ b/src/gpu/GrPendingFragmentStage.h
@@ -0,0 +1,53 @@
+/*
+ * 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 GrPendingProcessorStage_DEFINED
+#define GrPendingProcessorStage_DEFINED
+
+#include "GrFragmentStage.h"
+#include "GrCoordTransform.h"
+#include "GrFragmentProcessor.h"
+#include "GrPendingProgramElement.h"
+
+/**
+ * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState.
+ */
+class GrPendingFragmentStage {
+public:
+ GrPendingFragmentStage(const GrFragmentStage& stage) : fProc(stage.processor()) {}
+
+ GrPendingFragmentStage(const GrPendingFragmentStage& that) { *this = that; }
+
+ GrPendingFragmentStage& operator=(const GrPendingFragmentStage& that) {
+ fProc.reset(that.fProc.get());
+ return *this;
+ }
+
+ bool operator==(const GrPendingFragmentStage& that) const {
+ return this->processor()->isEqual(*that.processor());
+ }
+
+ bool operator!=(const GrPendingFragmentStage& that) const { return !(*this == that); }
+
+ /**
+ * For a coord transform on the fragment processor, does it or the coord change matrix (if
+ * relevant) contain perspective?
+ */
+ bool isPerspectiveCoordTransform(int matrixIndex) const {
+ const GrCoordTransform& coordTransform = this->processor()->coordTransform(matrixIndex);
+ uint32_t type = coordTransform.getMatrix().getType();
+ return SkToBool(SkMatrix::kPerspective_Mask & type);
+ }
+
+ const char* name() const { return fProc->name(); }
+
+ const GrFragmentProcessor* processor() const { return fProc.get(); }
+
+protected:
+ GrPendingProgramElement<const GrFragmentProcessor> fProc;
+};
+#endif
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 2c3422a746..8c40438a27 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -87,16 +87,20 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
// Copy Stages from PipelineBuilder to Pipeline
for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(); ++i) {
- const GrFragmentProcessor* fp = pipelineBuilder.fColorStages[i].processor();
- SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp));
- usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
+ SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
+ GrPendingFragmentStage,
+ (pipelineBuilder.fColorStages[i]));
+ usesLocalCoords = usesLocalCoords ||
+ pipelineBuilder.fColorStages[i].processor()->usesLocalCoords();
}
fNumColorStages = fFragmentStages.count();
for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentStages(); ++i) {
- const GrFragmentProcessor* fp = pipelineBuilder.fCoverageStages[i].processor();
- SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp));
- usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
+ SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
+ GrPendingFragmentStage,
+ (pipelineBuilder.fCoverageStages[i]));
+ usesLocalCoords = usesLocalCoords ||
+ pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords();
}
// Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline.
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index fb90d47b55..bf8ca8a725 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -10,8 +10,7 @@
#include "GrColor.h"
#include "GrGpu.h"
-#include "GrStagedProcessor.h"
-#include "GrPendingProgramElement.h"
+#include "GrPendingFragmentStage.h"
#include "GrPrimitiveProcessor.h"
#include "GrProgramDesc.h"
#include "GrStencil.h"
@@ -23,8 +22,6 @@ class GrBatch;
class GrDeviceCoordTexture;
class GrPipelineBuilder;
-typedef GrStagedProcessor<GrPendingProgramElement> GrPendingFragmentStage;
-
/**
* Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable
* class, and contains all data needed to set the state for a gpu draw.
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index 209845461d..dd3db6e092 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -12,7 +12,7 @@
#include "GrCaps.h"
#include "GrClip.h"
#include "GrGpuResourceRef.h"
-#include "GrStagedProcessor.h"
+#include "GrFragmentStage.h"
#include "GrProcOptInfo.h"
#include "GrProcessorDataManager.h"
#include "GrRenderTarget.h"
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp
index 53f2e02451..dc499fa337 100644
--- a/src/gpu/GrProcOptInfo.cpp
+++ b/src/gpu/GrProcOptInfo.cpp
@@ -8,6 +8,8 @@
#include "GrProcOptInfo.h"
#include "GrBatch.h"
+#include "GrFragmentProcessor.h"
+#include "GrFragmentStage.h"
#include "GrGeometryProcessor.h"
void GrProcOptInfo::calcColorWithBatch(const GrBatch* batch,
diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h
index 0430916405..f518172e22 100644
--- a/src/gpu/GrProcOptInfo.h
+++ b/src/gpu/GrProcOptInfo.h
@@ -10,9 +10,9 @@
#include "GrColor.h"
#include "GrInvariantOutput.h"
-#include "GrStagedProcessor.h"
class GrBatch;
+class GrFragmentStage;
class GrFragmentProcessor;
class GrPrimitiveProcessor;
class GrProcessor;
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index d87d009469..f00a284177 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -10,6 +10,7 @@
#include "GrSingleTextureEffect.h"
+class GrFragmentStage;
class GrInvariantOutput;
/**
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index 8143230495..4b784aceea 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -16,6 +16,7 @@
#include "../GrGLUniformHandle.h"
#include "../GrGLPrimitiveProcessor.h"
#include "../GrGLXferProcessor.h"
+#include "../../GrPendingFragmentStage.h"
#include "../../GrPipeline.h"
/*