blob: 6611234e8a990f2f6011a094de54143509198917 [file] [log] [blame]
bsalomon95740982014-09-04 13:12:37 -07001/*
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
bsalomon95740982014-09-04 13:12:37 -07008#include "GrProgramElement.h"
bsalomonf96ba022014-09-17 08:05:40 -07009#include "GrGpuResourceRef.h"
bsalomon95740982014-09-04 13:12:37 -070010
bsalomon52e9d632014-09-05 12:23:12 -070011uint32_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
bsalomonae59b772014-11-19 08:23:49 -080020void GrProgramElement::addPendingIOs() const {
21 for (int i = 0; i < fGpuResources.count(); ++i) {
22 fGpuResources[i]->markPendingIO();
bsalomonac8d6192014-09-04 14:13:44 -070023 }
24}
bsalomond0128772014-10-03 05:31:41 -070025
26void GrProgramElement::removeRefs() const {
27 for (int i = 0; i < fGpuResources.count(); ++i) {
28 fGpuResources[i]->removeRef();
29 }
30}
bsalomonae59b772014-11-19 08:23:49 -080031
32void GrProgramElement::pendingIOComplete() const {
33 for (int i = 0; i < fGpuResources.count(); ++i) {
34 fGpuResources[i]->pendingIOComplete();
35 }
36}
37