'<(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',
'<(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',
'<(skia_src_path)/gpu/GrPathUtils.cpp',
'<(skia_src_path)/gpu/GrPathUtils.h',
'<(skia_src_path)/gpu/GrPendingProgramElement.h',
- '<(skia_src_path)/gpu/GrPendingFragmentStage.h',
'<(skia_src_path)/gpu/GrPipeline.cpp',
'<(skia_src_path)/gpu/GrPipeline.h',
'<(skia_src_path)/gpu/GrPipelineBuilder.cpp',
+++ /dev/null
-/*
- * 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
#define GrPaint_DEFINED
#include "GrColor.h"
-#include "GrFragmentStage.h"
+#include "GrStagedProcessor.h"
#include "GrProcessorDataManager.h"
#include "GrXferProcessor.h"
#include "effects/GrPorterDuffXferProcessor.h"
--- /dev/null
+/*
+ * 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:
+ T<const GrFragmentProcessor> fProc;
+};
+
+typedef GrStagedProcessor<SkAutoTUnref> GrFragmentStage;
+
+#endif
#include "GrFragmentProcessor.h"
#include "gl/GrGLProcessor.h"
-class GrFragmentStage;
class GrInvariantOutput;
/*
+++ /dev/null
-/*
- * 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
// Copy Stages from PipelineBuilder to Pipeline
for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(); ++i) {
- SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
- GrPendingFragmentStage,
- (pipelineBuilder.fColorStages[i]));
- usesLocalCoords = usesLocalCoords ||
- pipelineBuilder.fColorStages[i].processor()->usesLocalCoords();
+ const GrFragmentProcessor* fp = pipelineBuilder.fColorStages[i].processor();
+ SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp));
+ usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
}
fNumColorStages = fFragmentStages.count();
for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentStages(); ++i) {
- SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
- GrPendingFragmentStage,
- (pipelineBuilder.fCoverageStages[i]));
- usesLocalCoords = usesLocalCoords ||
- pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords();
+ const GrFragmentProcessor* fp = pipelineBuilder.fCoverageStages[i].processor();
+ SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp));
+ usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
}
// Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline.
#include "GrColor.h"
#include "GrGpu.h"
-#include "GrPendingFragmentStage.h"
+#include "GrStagedProcessor.h"
+#include "GrPendingProgramElement.h"
#include "GrPrimitiveProcessor.h"
#include "GrProgramDesc.h"
#include "GrStencil.h"
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.
#include "GrCaps.h"
#include "GrClip.h"
#include "GrGpuResourceRef.h"
-#include "GrFragmentStage.h"
+#include "GrStagedProcessor.h"
#include "GrProcOptInfo.h"
#include "GrProcessorDataManager.h"
#include "GrRenderTarget.h"
#include "GrProcOptInfo.h"
#include "GrBatch.h"
-#include "GrFragmentProcessor.h"
-#include "GrFragmentStage.h"
#include "GrGeometryProcessor.h"
void GrProcOptInfo::calcColorWithBatch(const GrBatch* batch,
#include "GrColor.h"
#include "GrInvariantOutput.h"
+#include "GrStagedProcessor.h"
class GrBatch;
-class GrFragmentStage;
class GrFragmentProcessor;
class GrPrimitiveProcessor;
class GrProcessor;
#include "GrSingleTextureEffect.h"
-class GrFragmentStage;
class GrInvariantOutput;
/**
#include "../GrGLUniformHandle.h"
#include "../GrGLPrimitiveProcessor.h"
#include "../GrGLXferProcessor.h"
-#include "../../GrPendingFragmentStage.h"
#include "../../GrPipeline.h"
/*