aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPipeline.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-10-20 13:41:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-20 13:41:16 -0700
commit45a1c34f607a970933e5cd05e1df6cd8090db1be (patch)
treef9a8e6b2aa284ab98cbe352a62195df66a4e5f34 /src/gpu/GrPipeline.cpp
parent964eebae2dc83fa0ef780f62faa90377e2198c5d (diff)
Dependencies are now added between the drawTargets in GrPipeline
This CL relies on https://codereview.chromium.org/1414773002/ (Add the machinery to GrDrawTarget to enable topological sorting) BUG=skia:4094 Review URL: https://codereview.chromium.org/1414903002
Diffstat (limited to 'src/gpu/GrPipeline.cpp')
-rw-r--r--src/gpu/GrPipeline.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 80e3cbdf69..073349be1e 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -8,6 +8,7 @@
#include "GrPipeline.h"
#include "GrCaps.h"
+#include "GrDrawTarget.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
#include "GrProcOptInfo.h"
@@ -130,6 +131,35 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
return pipeline;
}
+static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRenderTarget* rt) {
+ for (int i = 0; i < proc->numChildProcessors(); ++i) {
+ // need to recurse
+ add_dependencies_for_processor(&proc->childProcessor(i), rt);
+ }
+
+ for (int i = 0; i < proc->numTextures(); ++i) {
+ GrTexture* texture = proc->textureAccess(i).getTexture();
+ SkASSERT(rt->getLastDrawTarget());
+ rt->getLastDrawTarget()->addDependency(texture);
+ }
+}
+
+void GrPipeline::addDependenciesTo(GrRenderTarget* rt) const {
+ for (int i = 0; i < fFragmentProcessors.count(); ++i) {
+ add_dependencies_for_processor(fFragmentProcessors[i].get(), rt);
+ }
+
+ if (fXferProcessor.get()) {
+ const GrXferProcessor* xfer = fXferProcessor.get();
+
+ for (int i = 0; i < xfer->numTextures(); ++i) {
+ GrTexture* texture = xfer->textureAccess(i).getTexture();
+ SkASSERT(rt->getLastDrawTarget());
+ rt->getLastDrawTarget()->addDependency(texture);
+ }
+ }
+}
+
void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelineBuilder,
GrXferProcessor::OptFlags flags,
const GrProcOptInfo& colorPOI,