aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/gpu.gypi4
-rw-r--r--include/gpu/GrFragmentStage.h34
-rw-r--r--include/gpu/GrPaint.h2
-rw-r--r--include/gpu/GrStagedProcessor.h43
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h1
-rw-r--r--src/gpu/GrPendingFragmentStage.h46
-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
10 files changed, 58 insertions, 79 deletions
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi
index b9cd795d11..371f06af98 100644
--- a/gyp/gpu.gypi
+++ b/gyp/gpu.gypi
@@ -22,7 +22,6 @@
'<(skia_include_path)/gpu/GrCoordTransform.h',
'<(skia_include_path)/gpu/GrDrawContext.h',
'<(skia_include_path)/gpu/GrFragmentProcessor.h',
- '<(skia_include_path)/gpu/GrFragmentStage.h',
'<(skia_include_path)/gpu/GrGpuResource.h',
'<(skia_include_path)/gpu/GrInvariantOutput.h',
'<(skia_include_path)/gpu/GrPaint.h',
@@ -35,8 +34,9 @@
'<(skia_include_path)/gpu/GrRect.h',
'<(skia_include_path)/gpu/GrRenderTarget.h',
'<(skia_include_path)/gpu/GrResourceKey.h',
- '<(skia_include_path)/gpu/GrSurface.h',
'<(skia_include_path)/gpu/GrShaderVar.h',
+ '<(skia_include_path)/gpu/GrStagedProcessor.h',
+ '<(skia_include_path)/gpu/GrSurface.h',
'<(skia_include_path)/gpu/GrTexture.h',
'<(skia_include_path)/gpu/GrTextureProvider.h',
'<(skia_include_path)/gpu/GrTextureAccess.h',
diff --git a/include/gpu/GrFragmentStage.h b/include/gpu/GrFragmentStage.h
deleted file mode 100644
index ca3be8a0f7..0000000000
--- a/include/gpu/GrFragmentStage.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrFragmentStage_DEFINED
-#define GrFragmentStage_DEFINED
-
-#include "GrFragmentProcessor.h"
-
-/**
- * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref
- */
-class GrFragmentStage {
-public:
- explicit GrFragmentStage(const GrFragmentProcessor* proc) : fProc(SkRef(proc)) {}
-
- GrFragmentStage(const GrFragmentStage& other) { fProc.reset(SkRef(other.fProc.get())); }
-
- const GrFragmentProcessor* processor() const { return fProc.get(); }
-
- bool operator==(const GrFragmentStage& that) const {
- return this->processor() == that.processor();
- }
-
- bool operator!=(const GrFragmentStage& that) const { return !(*this == that); }
-
-protected:
- SkAutoTUnref<const GrFragmentProcessor> fProc;
-};
-
-#endif
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 22951f94a2..efb3010286 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -11,7 +11,7 @@
#define GrPaint_DEFINED
#include "GrColor.h"
-#include "GrFragmentStage.h"
+#include "GrStagedProcessor.h"
#include "GrProcessorDataManager.h"
#include "GrXferProcessor.h"
#include "effects/GrPorterDuffXferProcessor.h"
diff --git a/include/gpu/GrStagedProcessor.h b/include/gpu/GrStagedProcessor.h
new file mode 100644
index 0000000000..170283102c
--- /dev/null
+++ b/include/gpu/GrStagedProcessor.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrStagedProcessorStage_DEFINED
+#define GrStagedProcessorStage_DEFINED
+
+#include "GrFragmentProcessor.h"
+#include "SkRefCnt.h"
+
+/**
+ * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref
+ * Templatized based on the ref type so backends can use the same wrapper
+ */
+template<template<typename> class T>
+class GrStagedProcessor {
+public:
+ explicit GrStagedProcessor(const GrFragmentProcessor* proc) : fProc(SkRef(proc)) {}
+
+ GrStagedProcessor(const GrStagedProcessor& other) { fProc.reset(SkRef(other.fProc.get())); }
+
+ const GrFragmentProcessor* processor() const { return fProc.get(); }
+
+ bool operator==(const GrStagedProcessor& that) const {
+ return this->processor() == that.processor();
+ }
+
+ bool operator!=(const GrStagedProcessor& that) const { return !(*this == that); }
+
+ const char* name() const { return fProc->name(); }
+
+protected:
+ GrStagedProcessor() {}
+
+ T<const GrFragmentProcessor> fProc;
+};
+
+typedef GrStagedProcessor<SkAutoTUnref> GrFragmentStage;
+
+#endif
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 9dc6b66930..cb882b2a6d 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -296,7 +296,6 @@ static inline int next_dither_toggle16(int toggle) {
#include "GrFragmentProcessor.h"
#include "gl/GrGLProcessor.h"
-class GrFragmentStage;
class GrInvariantOutput;
/*
diff --git a/src/gpu/GrPendingFragmentStage.h b/src/gpu/GrPendingFragmentStage.h
index 0bf984ab7d..dfa5688663 100644
--- a/src/gpu/GrPendingFragmentStage.h
+++ b/src/gpu/GrPendingFragmentStage.h
@@ -5,49 +5,23 @@
* found in the LICENSE file.
*/
-#ifndef GrPendingProcessorStage_DEFINED
-#define GrPendingProcessorStage_DEFINED
+#ifndef GrPendingFragmentStage_DEFINED
+#define GrPendingFragmentStage_DEFINED
-#include "GrFragmentStage.h"
-#include "GrCoordTransform.h"
-#include "GrFragmentProcessor.h"
+#include "GrStagedProcessor.h"
#include "GrPendingProgramElement.h"
/**
- * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState.
+ * This a baked variant of GrFragmentStage, as recorded in GrPipeline
*/
-class GrPendingFragmentStage {
+class GrPendingFragmentStage : public GrStagedProcessor<GrPendingProgramElement> {
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);
+ GrPendingFragmentStage(const GrFragmentStage& stage) {
+ INHERITED::fProc.reset(stage.processor());
}
- const char* name() const { return fProc->name(); }
-
- const GrFragmentProcessor* processor() const { return fProc.get(); }
-
-protected:
- GrPendingProgramElement<const GrFragmentProcessor> fProc;
+private:
+ typedef GrStagedProcessor<GrPendingProgramElement> INHERITED;
};
+
#endif
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index dd3db6e092..209845461d 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 "GrFragmentStage.h"
+#include "GrStagedProcessor.h"
#include "GrProcOptInfo.h"
#include "GrProcessorDataManager.h"
#include "GrRenderTarget.h"
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp
index dc499fa337..53f2e02451 100644
--- a/src/gpu/GrProcOptInfo.cpp
+++ b/src/gpu/GrProcOptInfo.cpp
@@ -8,8 +8,6 @@
#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 f518172e22..0430916405 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 f00a284177..d87d009469 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -10,7 +10,6 @@
#include "GrSingleTextureEffect.h"
-class GrFragmentStage;
class GrInvariantOutput;
/**