aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProgramElement.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-11-19 08:23:49 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-19 08:23:49 -0800
commitae59b77612c42ff6b793dc33e3d115e6a5db34cc (patch)
treef3124daeb6c8a0619d60ee09e7cdd3dae47bffdb /src/gpu/GrProgramElement.cpp
parent78e276889795454891cbba48ab11927968114953 (diff)
Create GrOptDrawState before recording draw in GrInOrderDrawBuffer
Diffstat (limited to 'src/gpu/GrProgramElement.cpp')
-rw-r--r--src/gpu/GrProgramElement.cpp40
1 files changed, 9 insertions, 31 deletions
diff --git a/src/gpu/GrProgramElement.cpp b/src/gpu/GrProgramElement.cpp
index 89d53e28db..6611234e8a 100644
--- a/src/gpu/GrProgramElement.cpp
+++ b/src/gpu/GrProgramElement.cpp
@@ -17,43 +17,21 @@ uint32_t GrProgramElement::CreateUniqueID() {
return id;
}
-void GrProgramElement::convertRefToPendingExecution() const {
- // This function makes it so that all the GrGpuResourceRefs own a single ref to their
- // underlying GrGpuResource if there are any refs to the GrProgramElement and a single
- // pending read/write if there are any pending executions of the GrProgramElement. The
- // GrGpuResourceRef will give up its single ref and/or pending read/write in its destructor.
- SkASSERT(fRefCnt > 0);
- if (0 == fPendingExecutions) {
- for (int i = 0; i < fGpuResources.count(); ++i) {
- fGpuResources[i]->markPendingIO();
- }
- }
- ++fPendingExecutions;
- this->unref();
- if (0 == fRefCnt) {
- this->removeRefs();
+void GrProgramElement::addPendingIOs() const {
+ for (int i = 0; i < fGpuResources.count(); ++i) {
+ fGpuResources[i]->markPendingIO();
}
}
-void GrProgramElement::completedExecution() const {
- this->validate();
- --fPendingExecutions;
- if (0 == fPendingExecutions) {
- if (0 == fRefCnt) {
- SkDELETE(this);
- } else {
- // Now our pending executions have ocurred and we still have refs. Convert
- // ownership of our resources back to regular refs.
- for (int i = 0; i < fGpuResources.count(); ++i) {
- fGpuResources[i]->pendingIOComplete();
- }
-
- }
+void GrProgramElement::removeRefs() const {
+ for (int i = 0; i < fGpuResources.count(); ++i) {
+ fGpuResources[i]->removeRef();
}
}
-void GrProgramElement::removeRefs() const {
+void GrProgramElement::pendingIOComplete() const {
for (int i = 0; i < fGpuResources.count(); ++i) {
- fGpuResources[i]->removeRef();
+ fGpuResources[i]->pendingIOComplete();
}
}
+