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

Unified Diff: src/gpu/GrProgramElement.cpp

Issue 537773004: Add GrProgramElement base class for GrEffect with deferred exec ref. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: one more extra 'e' in pending Created 6 years, 3 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
Index: src/gpu/GrProgramElement.cpp
diff --git a/src/gpu/GrProgramElement.cpp b/src/gpu/GrProgramElement.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5517b5604c56173ec19747efb8e142b2a6b216a8
--- /dev/null
+++ b/src/gpu/GrProgramElement.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#include "GrProgramElement.h"
+#include "GrProgramResource.h"
+
+void GrProgramElement::convertRefToPendingExecution() const {
+ // This function makes it so that all the GrProgramResources own a single ref to their
+ // underlying GrGpuResource if there are any refs to the GrProgramElement and a single
robertphillips 2014/09/04 19:48:57 single pending read ?
bsalomon 2014/09/04 20:03:17 changed to read/write
+ // pending read if there are any pending executions of the GrProgramElement. The
robertphillips 2014/09/04 19:48:57 pending read ?
bsalomon 2014/09/04 20:03:17 changed to read/write
+ // GrProgramResource will give up its single ref and/or pending read in its destructor.
+ SkASSERT(fRefCnt > 0);
+ if (0 == fPendingExecutions) {
+ for (int i = 0; i < fProgramResources.count(); ++i) {
+ fProgramResources[i]->markPendingIO();
+ }
+ }
+ ++fPendingExecutions;
+ this->unref();
+ if (0 == fRefCnt) {
+ for (int i = 0; i < fProgramResources.count(); ++i) {
+ fProgramResources[i]->removeRef();
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698