/src/skia/src/gpu/graphite/GraphiteResourceKey.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2022 Google LLC |
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 "src/gpu/graphite/GraphiteResourceKey.h" |
9 | | |
10 | | namespace skgpu::graphite { |
11 | | |
12 | 0 | ResourceType GraphiteResourceKey::GenerateResourceType() { |
13 | 0 | static std::atomic<int32_t> nextType{ResourceKey::kInvalidDomain + 1}; |
14 | |
|
15 | 0 | int32_t type = nextType.fetch_add(1, std::memory_order_relaxed); |
16 | 0 | if (type > SkTo<int32_t>(UINT16_MAX)) { |
17 | 0 | SK_ABORT("Too many Graphite Resource Types"); |
18 | 0 | } |
19 | |
|
20 | 0 | return static_cast<ResourceType>(type); |
21 | 0 | } |
22 | | |
23 | | } // namespace skgpu::graphite |
24 | | |