25 lines
601 B
C++
25 lines
601 B
C++
/*
|
|
* Copyright 2022 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "experimental/graphite/src/GraphiteResourceKey.h"
|
|
|
|
namespace skgpu {
|
|
|
|
ResourceType GraphiteResourceKey::GenerateResourceType() {
|
|
static std::atomic<int32_t> nextType{ResourceKey::kInvalidDomain + 1};
|
|
|
|
int32_t type = nextType.fetch_add(1, std::memory_order_relaxed);
|
|
if (type > SkTo<int32_t>(UINT16_MAX)) {
|
|
SK_ABORT("Too many Graphite Resource Types");
|
|
}
|
|
|
|
return static_cast<ResourceType>(type);
|
|
}
|
|
|
|
} // namespace skgpu
|
|
|