| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrProgramElement.h" | 8 #include "GrProgramElement.h" |
| 9 #include "GrGpuResourceRef.h" | 9 #include "GrGpuResourceRef.h" |
| 10 #include "SkAtomics.h" |
| 10 | 11 |
| 11 uint32_t GrProgramElement::CreateUniqueID() { | 12 uint32_t GrProgramElement::CreateUniqueID() { |
| 12 static int32_t gUniqueID = SK_InvalidUniqueID; | 13 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 13 uint32_t id; | 14 uint32_t id; |
| 14 do { | 15 do { |
| 15 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 16 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 16 } while (id == SK_InvalidUniqueID); | 17 } while (id == SK_InvalidUniqueID); |
| 17 return id; | 18 return id; |
| 18 } | 19 } |
| 19 | 20 |
| 20 void GrProgramElement::addPendingIOs() const { | 21 void GrProgramElement::addPendingIOs() const { |
| 21 for (int i = 0; i < fGpuResources.count(); ++i) { | 22 for (int i = 0; i < fGpuResources.count(); ++i) { |
| 22 fGpuResources[i]->markPendingIO(); | 23 fGpuResources[i]->markPendingIO(); |
| 23 } | 24 } |
| 24 } | 25 } |
| 25 | 26 |
| 26 void GrProgramElement::removeRefs() const { | 27 void GrProgramElement::removeRefs() const { |
| 27 for (int i = 0; i < fGpuResources.count(); ++i) { | 28 for (int i = 0; i < fGpuResources.count(); ++i) { |
| 28 fGpuResources[i]->removeRef(); | 29 fGpuResources[i]->removeRef(); |
| 29 } | 30 } |
| 30 } | 31 } |
| 31 | 32 |
| 32 void GrProgramElement::pendingIOComplete() const { | 33 void GrProgramElement::pendingIOComplete() const { |
| 33 for (int i = 0; i < fGpuResources.count(); ++i) { | 34 for (int i = 0; i < fGpuResources.count(); ++i) { |
| 34 fGpuResources[i]->pendingIOComplete(); | 35 fGpuResources[i]->pendingIOComplete(); |
| 35 } | 36 } |
| 36 } | 37 } |
| OLD | NEW |