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