// // Copyright 2019 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // serial_utils: // Utilities for generating unique IDs for resources in ANGLE. //
class Serial final
{ public:
constexpr Serial() : mValue(kInvalid) {}
constexpr Serial(const Serial &other) = default;
Serial &operator=(const Serial &other) = default;
static constexpr Serial Infinite() { return Serial(std::numeric_limits<uint64_t>::max()); }
// Defines class to track the queue serial that can be load/store from multiple threads atomically. class AtomicQueueSerial final
{ public:
constexpr AtomicQueueSerial() : mValue(kInvalid) { ASSERT(mValue.is_lock_free()); }
AtomicQueueSerial &operator=(const Serial &other)
{
mValue.store(other.mValue, std::memory_order_release); return *this;
}
Serial getSerial() const { return Serial(mValue.load(std::memory_order_consume)); }
// Used as default/initial serial static constexpr Serial kZeroSerial = Serial();
template <typename SerialBaseType> class SerialFactoryBase final : angle::NonCopyable
{ public:
SerialFactoryBase() : mSerial(1) {}
Serial generate()
{
uint64_t current = mSerial++;
ASSERT(mSerial > current); // Integer overflow return Serial(current);
}
private:
SerialBaseType mSerial;
};
using SerialFactory = SerialFactoryBase<uint64_t>; using AtomicSerialFactory = SerialFactoryBase<std::atomic<uint64_t>>; using RenderPassSerialFactory = SerialFactoryBase<uint64_t>;
} // namespace rx
#endif// LIBANGLE_RENDERER_SERIAL_UTILS_H_
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.