Index: src/gpu/GrPipeline.cpp |
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp |
index 80e3cbdf6923779a1e908c1f5f6c07d4afff3f86..073349be1ed900062964098d85773e416eedd75b 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, |