Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: src/gpu/GrPipeline.cpp

Issue 1414903002: Dependencies are now added between the drawTargets in GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@mdb-adddeps
Patch Set: Fix leak on abandon issue Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | src/gpu/GrRenderTarget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | src/gpu/GrRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698