blob: 6846d5a0118b6e0b4ecca058f136bc273d3ec146 [file] [log] [blame]
/*
* 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