aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBufferedDrawTarget.cpp8
-rw-r--r--src/gpu/GrBufferedDrawTarget.h5
-rw-r--r--src/gpu/GrCommandBuilder.h6
-rw-r--r--src/gpu/GrDrawTarget.cpp9
-rw-r--r--src/gpu/GrDrawTarget.h5
-rw-r--r--src/gpu/GrImmediateDrawTarget.h7
-rw-r--r--src/gpu/GrInOrderCommandBuilder.cpp16
-rw-r--r--src/gpu/GrInOrderCommandBuilder.h5
-rw-r--r--src/gpu/GrReorderCommandBuilder.h8
-rw-r--r--src/gpu/GrTargetCommands.cpp6
-rw-r--r--src/gpu/GrTargetCommands.h20
-rw-r--r--src/gpu/batches/GrStencilPathBatch.h72
12 files changed, 80 insertions, 87 deletions
diff --git a/src/gpu/GrBufferedDrawTarget.cpp b/src/gpu/GrBufferedDrawTarget.cpp
index 5e5d71ecc5..dde57d36ea 100644
--- a/src/gpu/GrBufferedDrawTarget.cpp
+++ b/src/gpu/GrBufferedDrawTarget.cpp
@@ -30,14 +30,6 @@ void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch) {
fCommands->recordDrawBatch(batch, *this->caps());
}
-void GrBufferedDrawTarget::onStencilPath(const GrPipelineBuilder& pipelineBuilder,
- const GrPathProcessor* pathProc,
- const GrPath* path,
- const GrScissorState& scissorState,
- const GrStencilSettings& stencilSettings) {
- fCommands->recordStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSettings);
-}
-
void GrBufferedDrawTarget::onDrawPath(const GrPathProcessor* pathProc,
const GrPath* path,
const GrStencilSettings& stencilSettings,
diff --git a/src/gpu/GrBufferedDrawTarget.h b/src/gpu/GrBufferedDrawTarget.h
index dc409ef3f1..2dc92a504a 100644
--- a/src/gpu/GrBufferedDrawTarget.h
+++ b/src/gpu/GrBufferedDrawTarget.h
@@ -73,11 +73,6 @@ private:
void onReset() override;
void onFlush() override;
- void onStencilPath(const GrPipelineBuilder&,
- const GrPathProcessor*,
- const GrPath*,
- const GrScissorState&,
- const GrStencilSettings&) override;
void onDrawPath(const GrPathProcessor*,
const GrPath*,
const GrStencilSettings&,
diff --git a/src/gpu/GrCommandBuilder.h b/src/gpu/GrCommandBuilder.h
index ddf0ccfd80..e29677d6a2 100644
--- a/src/gpu/GrCommandBuilder.h
+++ b/src/gpu/GrCommandBuilder.h
@@ -27,11 +27,6 @@ public:
void flush(GrGpu* gpu, GrResourceProvider* rp) { fCommands.flush(gpu, rp); }
virtual Cmd* recordDrawBatch(GrBatch*, const GrCaps&) = 0;
- virtual Cmd* recordStencilPath(const GrPipelineBuilder&,
- const GrPathProcessor*,
- const GrPath*,
- const GrScissorState&,
- const GrStencilSettings&) = 0;
virtual Cmd* recordDrawPath(State*,
const GrPathProcessor*,
const GrPath*,
@@ -50,7 +45,6 @@ public:
protected:
typedef GrTargetCommands::DrawBatch DrawBatch;
- typedef GrTargetCommands::StencilPath StencilPath;
typedef GrTargetCommands::DrawPath DrawPath;
typedef GrTargetCommands::DrawPaths DrawPaths;
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 1102b18dc1..fc5599e712 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -25,6 +25,7 @@
#include "batches/GrDiscardBatch.h"
#include "batches/GrDrawBatch.h"
#include "batches/GrRectBatchFactory.h"
+#include "batches/GrStencilPathBatch.h"
#include "SkStrokeRec.h"
@@ -212,7 +213,13 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
- this->onStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSettings);
+ GrBatch* batch = GrStencilPathBatch::Create(pathProc->viewMatrix(),
+ pipelineBuilder.isHWAntialias(),
+ stencilSettings, scissorState,
+ pipelineBuilder.getRenderTarget(),
+ path);
+ this->onDrawBatch(batch);
+ batch->unref();
}
void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 54531d2885..6ab34ab75a 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -243,11 +243,6 @@ private:
virtual void onFlush() = 0;
- virtual void onStencilPath(const GrPipelineBuilder&,
- const GrPathProcessor*,
- const GrPath*,
- const GrScissorState&,
- const GrStencilSettings&) = 0;
virtual void onDrawPath(const GrPathProcessor*,
const GrPath*,
const GrStencilSettings&,
diff --git a/src/gpu/GrImmediateDrawTarget.h b/src/gpu/GrImmediateDrawTarget.h
index 440233fa9f..c70b624ed5 100644
--- a/src/gpu/GrImmediateDrawTarget.h
+++ b/src/gpu/GrImmediateDrawTarget.h
@@ -33,13 +33,6 @@ private:
void onReset() override;
void onFlush() override;
- void onStencilPath(const GrPipelineBuilder&,
- const GrPathProcessor*,
- const GrPath*,
- const GrScissorState&,
- const GrStencilSettings&) override {
- SkFAIL("Only batch implemented\n");
- }
void onDrawPath(const GrPathProcessor*,
const GrPath*,
const GrStencilSettings&,
diff --git a/src/gpu/GrInOrderCommandBuilder.cpp b/src/gpu/GrInOrderCommandBuilder.cpp
index 078adad35c..9c0d1a9164 100644
--- a/src/gpu/GrInOrderCommandBuilder.cpp
+++ b/src/gpu/GrInOrderCommandBuilder.cpp
@@ -42,22 +42,6 @@ GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(GrBatch* batch,
}
GrTargetCommands::Cmd*
-GrInOrderCommandBuilder::recordStencilPath(const GrPipelineBuilder& pipelineBuilder,
- const GrPathProcessor* pathProc,
- const GrPath* path,
- const GrScissorState& scissorState,
- const GrStencilSettings& stencilSettings) {
- StencilPath* sp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), StencilPath,
- (path, pipelineBuilder.getRenderTarget()));
-
- sp->fScissor = scissorState;
- sp->fUseHWAA = pipelineBuilder.isHWAntialias();
- sp->fViewMatrix = pathProc->viewMatrix();
- sp->fStencil = stencilSettings;
- return sp;
-}
-
-GrTargetCommands::Cmd*
GrInOrderCommandBuilder::recordDrawPath(State* state,
const GrPathProcessor* pathProc,
const GrPath* path,
diff --git a/src/gpu/GrInOrderCommandBuilder.h b/src/gpu/GrInOrderCommandBuilder.h
index 4d031202cb..9768218608 100644
--- a/src/gpu/GrInOrderCommandBuilder.h
+++ b/src/gpu/GrInOrderCommandBuilder.h
@@ -18,11 +18,6 @@ public:
GrInOrderCommandBuilder() : INHERITED() { }
Cmd* recordDrawBatch(GrBatch*, const GrCaps&) override;
- Cmd* recordStencilPath(const GrPipelineBuilder&,
- const GrPathProcessor*,
- const GrPath*,
- const GrScissorState&,
- const GrStencilSettings&) override;
Cmd* recordDrawPath(State*,
const GrPathProcessor*,
const GrPath*,
diff --git a/src/gpu/GrReorderCommandBuilder.h b/src/gpu/GrReorderCommandBuilder.h
index 1dd33a05c5..dbb5c80604 100644
--- a/src/gpu/GrReorderCommandBuilder.h
+++ b/src/gpu/GrReorderCommandBuilder.h
@@ -18,14 +18,6 @@ public:
GrReorderCommandBuilder() : INHERITED() {}
Cmd* recordDrawBatch(GrBatch*, const GrCaps&) override;
- Cmd* recordStencilPath(const GrPipelineBuilder&,
- const GrPathProcessor*,
- const GrPath*,
- const GrScissorState&,
- const GrStencilSettings&) override {
- SkFAIL("Unsupported\n");
- return NULL;
- }
Cmd* recordDrawPath(State*,
const GrPathProcessor*,
diff --git a/src/gpu/GrTargetCommands.cpp b/src/gpu/GrTargetCommands.cpp
index 4a64175a19..f2e696426f 100644
--- a/src/gpu/GrTargetCommands.cpp
+++ b/src/gpu/GrTargetCommands.cpp
@@ -43,12 +43,6 @@ void GrTargetCommands::flush(GrGpu* gpu, GrResourceProvider* resourceProvider) {
fLastFlushToken = flushState.lastFlushedToken();
}
-void GrTargetCommands::StencilPath::execute(GrBatchFlushState* state) {
- GrPathRendering::StencilPathArgs args(fUseHWAA, fRenderTarget.get(), &fViewMatrix, &fScissor,
- &fStencil);
- state->gpu()->pathRendering()->stencilPath(args, this->path());
-}
-
void GrTargetCommands::DrawPath::execute(GrBatchFlushState* state) {
if (!fState->fCompiled) {
state->gpu()->buildProgramDesc(&fState->fDesc, *fState->fPrimitiveProcessor,
diff --git a/src/gpu/GrTargetCommands.h b/src/gpu/GrTargetCommands.h
index 96452e125b..9b52837dd4 100644
--- a/src/gpu/GrTargetCommands.h
+++ b/src/gpu/GrTargetCommands.h
@@ -30,7 +30,6 @@ public:
class Cmd : ::SkNoncopyable {
public:
enum CmdType {
- kStencilPath_CmdType = 1,
kDrawPath_CmdType = 2,
kDrawPaths_CmdType = 3,
kDrawBatch_CmdType = 4,
@@ -118,25 +117,6 @@ private:
// TODO remove this when State is just a pipeline
friend SkNVRefCnt<StateForPathDraw>;
- struct StencilPath : public Cmd {
- StencilPath(const GrPath* path, GrRenderTarget* rt)
- : Cmd(kStencilPath_CmdType)
- , fRenderTarget(rt)
- , fPath(path) {}
-
- const GrPath* path() const { return fPath.get(); }
-
- void execute(GrBatchFlushState*) override;
-
- SkMatrix fViewMatrix;
- bool fUseHWAA;
- GrStencilSettings fStencil;
- GrScissorState fScissor;
- private:
- GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
- GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
- };
-
struct DrawPath : public Cmd {
DrawPath(StateForPathDraw* state, const GrPath* path)
: Cmd(kDrawPath_CmdType)
diff --git a/src/gpu/batches/GrStencilPathBatch.h b/src/gpu/batches/GrStencilPathBatch.h
new file mode 100644
index 0000000000..908dd1f593
--- /dev/null
+++ b/src/gpu/batches/GrStencilPathBatch.h
@@ -0,0 +1,72 @@
+/*
+ * 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 GrStencilPathBatch_DEFINED
+#define GrStencilPathBatch_DEFINED
+
+#include "GrBatch.h"
+#include "GrBatchFlushState.h"
+#include "GrGpu.h"
+#include "GrPath.h"
+#include "GrPathRendering.h"
+#include "GrRenderTarget.h"
+
+class GrStencilPathBatch final : public GrBatch {
+public:
+ static GrBatch* Create(const SkMatrix& viewMatrix,
+ bool useHWAA,
+ const GrStencilSettings& stencil,
+ const GrScissorState& scissor,
+ GrRenderTarget* renderTarget,
+ const GrPath* path) {
+ return SkNEW_ARGS(GrStencilPathBatch, (viewMatrix, useHWAA, stencil, scissor, renderTarget,
+ path));
+ }
+
+ const char* name() const override { return "StencilPath"; }
+
+ uint32_t renderTargetUniqueID() const { return fRenderTarget.get()->getUniqueID(); }
+
+ SkString dumpInfo() const override {
+ SkString string;
+ string.printf("PATH: 0x%p, AA:%d", fPath.get(), fUseHWAA);
+ return string;
+ }
+
+private:
+ GrStencilPathBatch(const SkMatrix& viewMatrix,
+ bool useHWAA,
+ const GrStencilSettings& stencil,
+ const GrScissorState& scissor,
+ GrRenderTarget* renderTarget,
+ const GrPath* path)
+ : fViewMatrix(viewMatrix)
+ , fUseHWAA(useHWAA)
+ , fStencil(stencil)
+ , fScissor(scissor)
+ , fRenderTarget(renderTarget)
+ , fPath(path) {}
+
+ bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return false; }
+
+ void onPrepare(GrBatchFlushState*) override {}
+
+ void onDraw(GrBatchFlushState* state) override {
+ GrPathRendering::StencilPathArgs args(fUseHWAA, fRenderTarget.get(), &fViewMatrix,
+ &fScissor, &fStencil);
+ state->gpu()->pathRendering()->stencilPath(args, fPath.get());
+ }
+
+ SkMatrix fViewMatrix;
+ bool fUseHWAA;
+ GrStencilSettings fStencil;
+ GrScissorState fScissor;
+ GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
+ GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
+};
+
+#endif