Remove GrTGpuResourceRef specializations
This template is only used for GrBuffers now.
Change-Id: Ia9e95576b01124657e64007231fbc0a83276e13f
Reviewed-on: https://skia-review.googlesource.com/19484
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gn/gpu.gni b/gn/gpu.gni
index a0d67bc..01d0628 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -254,6 +254,7 @@
"$_src/gpu/ops/GrDiscardOp.h",
"$_src/gpu/ops/GrDrawAtlasOp.cpp",
"$_src/gpu/ops/GrDrawAtlasOp.h",
+ "$_src/gpu/ops/GrDrawOp.cpp",
"$_src/gpu/ops/GrDrawOp.h",
"$_src/gpu/ops/GrDrawPathOp.cpp",
"$_src/gpu/ops/GrDrawPathOp.h",
diff --git a/include/gpu/GrGpuResourceRef.h b/include/gpu/GrGpuResourceRef.h
index 3e17392..a56674b 100644
--- a/include/gpu/GrGpuResourceRef.h
+++ b/include/gpu/GrGpuResourceRef.h
@@ -9,8 +9,6 @@
#define GrGpuResourceRef_DEFINED
#include "GrGpuResource.h"
-#include "GrRenderTarget.h"
-#include "GrTexture.h"
#include "SkRefCnt.h"
/**
@@ -169,49 +167,6 @@
typedef GrGpuResourceRef INHERITED;
};
-// Specializations for GrTexture and GrRenderTarget because they use virtual inheritance.
-template<> class GrTGpuResourceRef<GrTexture> : public GrGpuResourceRef {
-public:
- GrTGpuResourceRef() {}
-
- GrTGpuResourceRef(GrTexture* texture, GrIOType ioType) : INHERITED(texture, ioType) { }
-
- GrTexture* get() const {
- GrSurface* surface = static_cast<GrSurface*>(this->getResource());
- if (surface) {
- return surface->asTexture();
- } else {
- return NULL;
- }
- }
-
- void set(GrTexture* texture, GrIOType ioType) { this->setResource(texture, ioType); }
-
-private:
- typedef GrGpuResourceRef INHERITED;
-};
-
-template<> class GrTGpuResourceRef<GrRenderTarget> : public GrGpuResourceRef {
-public:
- GrTGpuResourceRef() {}
-
- GrTGpuResourceRef(GrRenderTarget* rt, GrIOType ioType) : INHERITED(rt, ioType) { }
-
- GrRenderTarget* get() const {
- GrSurface* surface = static_cast<GrSurface*>(this->getResource());
- if (surface) {
- return surface->asRenderTarget();
- } else {
- return NULL;
- }
- }
-
- void set(GrRenderTarget* rt, GrIOType ioType) { this->setResource(rt, ioType); }
-
-private:
- typedef GrGpuResourceRef INHERITED;
-};
-
/**
* This is similar to GrTGpuResourceRef but can only be in the pending IO state. It never owns a
* ref.
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 9d8b2ef..134466b 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -112,6 +112,14 @@
}
}
+GrXferBarrierType GrPipeline::xferBarrierType(const GrCaps& caps) const {
+ if (fDstTextureProxy.get() &&
+ fDstTextureProxy.get()->priv().peekTexture() == fRenderTarget.get()->asTexture()) {
+ return kTexture_GrXferBarrierType;
+ }
+ return this->getXferProcessor().xferBarrierType(caps);
+}
+
GrPipeline::GrPipeline(GrRenderTarget* rt, ScissorState scissorState, SkBlendMode blendmode)
: fRenderTarget(rt)
, fScissorState()
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 3fd5189..8d2f245 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -15,6 +15,7 @@
#include "GrProcessorSet.h"
#include "GrProgramDesc.h"
#include "GrRect.h"
+#include "GrRenderTarget.h"
#include "GrScissorState.h"
#include "GrUserStencilSettings.h"
#include "GrWindowRectsState.h"
@@ -235,13 +236,7 @@
}
bool isBad() const { return SkToBool(fFlags & kIsBad_Flag); }
- GrXferBarrierType xferBarrierType(const GrCaps& caps) const {
- if (fDstTextureProxy.get() &&
- fDstTextureProxy.get()->priv().peekTexture() == fRenderTarget.get()->asTexture()) {
- return kTexture_GrXferBarrierType;
- }
- return this->getXferProcessor().xferBarrierType(caps);
- }
+ GrXferBarrierType xferBarrierType(const GrCaps& caps) const;
private:
void markAsBad() { fFlags |= kIsBad_Flag; }
diff --git a/src/gpu/glsl/GrGLSLXferProcessor.cpp b/src/gpu/glsl/GrGLSLXferProcessor.cpp
index 41a4677..5af0f05 100644
--- a/src/gpu/glsl/GrGLSLXferProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLXferProcessor.cpp
@@ -8,6 +8,7 @@
#include "glsl/GrGLSLXferProcessor.h"
#include "GrShaderCaps.h"
+#include "GrTexture.h"
#include "GrXferProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/ops/GrDrawOp.cpp b/src/gpu/ops/GrDrawOp.cpp
new file mode 100644
index 0000000..4bbb80e
--- /dev/null
+++ b/src/gpu/ops/GrDrawOp.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrDrawOp.h"
+
+#include "GrRenderTarget.h"
+
+SkString GrDrawOp::DumpPipelineInfo(const GrPipeline& pipeline) {
+ SkString string;
+ string.appendf("RT: %d\n", pipeline.getRenderTarget()->uniqueID().asUInt());
+ string.append("ColorStages:\n");
+ for (int i = 0; i < pipeline.numColorFragmentProcessors(); i++) {
+ string.appendf("\t\t%s\n\t\t%s\n",
+ pipeline.getColorFragmentProcessor(i).name(),
+ pipeline.getColorFragmentProcessor(i).dumpInfo().c_str());
+ }
+ string.append("CoverageStages:\n");
+ for (int i = 0; i < pipeline.numCoverageFragmentProcessors(); i++) {
+ string.appendf("\t\t%s\n\t\t%s\n",
+ pipeline.getCoverageFragmentProcessor(i).name(),
+ pipeline.getCoverageFragmentProcessor(i).dumpInfo().c_str());
+ }
+ string.appendf("XP: %s\n", pipeline.getXferProcessor().name());
+
+ bool scissorEnabled = pipeline.getScissorState().enabled();
+ string.appendf("Scissor: ");
+ if (scissorEnabled) {
+ string.appendf("[L: %d, T: %d, R: %d, B: %d]\n",
+ pipeline.getScissorState().rect().fLeft,
+ pipeline.getScissorState().rect().fTop,
+ pipeline.getScissorState().rect().fRight,
+ pipeline.getScissorState().rect().fBottom);
+ } else {
+ string.appendf("<disabled>\n");
+ }
+ return string;
+}
diff --git a/src/gpu/ops/GrDrawOp.h b/src/gpu/ops/GrDrawOp.h
index dbdd9d8..d7887b6 100644
--- a/src/gpu/ops/GrDrawOp.h
+++ b/src/gpu/ops/GrDrawOp.h
@@ -82,36 +82,7 @@
virtual bool xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*) = 0;
protected:
- static SkString DumpPipelineInfo(const GrPipeline& pipeline) {
- SkString string;
- string.appendf("RT: %d\n", pipeline.getRenderTarget()->uniqueID().asUInt());
- string.append("ColorStages:\n");
- for (int i = 0; i < pipeline.numColorFragmentProcessors(); i++) {
- string.appendf("\t\t%s\n\t\t%s\n",
- pipeline.getColorFragmentProcessor(i).name(),
- pipeline.getColorFragmentProcessor(i).dumpInfo().c_str());
- }
- string.append("CoverageStages:\n");
- for (int i = 0; i < pipeline.numCoverageFragmentProcessors(); i++) {
- string.appendf("\t\t%s\n\t\t%s\n",
- pipeline.getCoverageFragmentProcessor(i).name(),
- pipeline.getCoverageFragmentProcessor(i).dumpInfo().c_str());
- }
- string.appendf("XP: %s\n", pipeline.getXferProcessor().name());
-
- bool scissorEnabled = pipeline.getScissorState().enabled();
- string.appendf("Scissor: ");
- if (scissorEnabled) {
- string.appendf("[L: %d, T: %d, R: %d, B: %d]\n",
- pipeline.getScissorState().rect().fLeft,
- pipeline.getScissorState().rect().fTop,
- pipeline.getScissorState().rect().fRight,
- pipeline.getScissorState().rect().fBottom);
- } else {
- string.appendf("<disabled>\n");
- }
- return string;
- }
+ static SkString DumpPipelineInfo(const GrPipeline& pipeline);
struct QueuedUpload {
QueuedUpload(DeferredUploadFn&& upload, GrDrawOpUploadToken token)