aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProgramElement.cpp
blob: f1f3f413434a6d69618e3c9d11114bdc256e7ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * 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 "GrGpuResourceRef.h"
#include "SkAtomics.h"

uint32_t GrProgramElement::CreateUniqueID() {
    static int32_t gUniqueID = SK_InvalidUniqueID;
    uint32_t id;
    do {
        id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
    } while (id == SK_InvalidUniqueID);
    return id;
}

void GrProgramElement::addPendingIOs() const {
    for (int i = 0; i < fGpuResources.count(); ++i) {
        fGpuResources[i]->markPendingIO();
    }
}

void GrProgramElement::removeRefs() const {
    for (int i = 0; i < fGpuResources.count(); ++i) {
        fGpuResources[i]->removeRef();
    }
}

void GrProgramElement::pendingIOComplete() const {
    for (int i = 0; i < fGpuResources.count(); ++i) {
        fGpuResources[i]->pendingIOComplete();
    }
}