1
0
Files
BasaltMeter/BasaltPresenter/Shared/basalt/guid.hpp

51 lines
1.6 KiB
C++
Raw Normal View History

2026-01-08 19:23:19 +08:00
#pragma once
#include <cinttypes>
#include <compare>
namespace basalt::shared::guid {
struct Guid {
std::uint32_t d1, d2;
constexpr Guid(std::uint32_t gd1 = 0, std::uint32_t gd2 = 0) : d1(gd1), d2(gd2) {}
Guid(const Guid& rhs) : d1(rhs.d1), d2(rhs.d2) {}
Guid(Guid&& rhs) noexcept : d1(rhs.d1), d2(rhs.d2) {}
Guid& operator=(const Guid& rhs) {
this->d1 = rhs.d1;
this->d2 = rhs.d2;
return *this;
}
Guid& operator=(Guid&& rhs) noexcept {
this->d1 = rhs.d1;
this->d2 = rhs.d2;
return *this;
}
auto operator<=>(const Guid& rhs) const {
if (auto cmp = this->d1 <=> rhs.d1; cmp != 0) return cmp;
return this->d2 <=> rhs.d2;
}
bool operator==(const Guid& rhs) const { return ((this->d1 == rhs.d1) && (this->d2 == rhs.d2)); }
};
constexpr Guid DIRECTX8_ENGINE{0x0, 0x1};
constexpr Guid DIRECTX9_ENGINE{0x0, 0x2};
constexpr Guid DIRECTX11_ENGINE{0x0, 0x3};
constexpr Guid DIRECTX12_ENGINE{0x0, 0x4};
constexpr Guid OPENGL_ENGINE{0x0, 0x5};
constexpr Guid VULKAN_ENGINE{0x0, 0x6};
constexpr Guid CUDA_DELIVER{0x1, 0x1};
constexpr Guid ROCM_DELIVER{0x1, 0x2};
constexpr Guid PIPE_DELIVER{0x1, 0x3};
constexpr Guid TCP_DELIVER{0x1, 0x4};
constexpr Guid MMAP_DELIVER{0x1, 0x5};
constexpr Guid TINYOBJLOADER_OBJECT_LOADER{0x2, 0x1};
constexpr Guid CGLTF_OBJECT_LOADER{0x2, 0x2};
constexpr Guid ASSIMP_OBJECT_LOADER{0x2, 0x3};
constexpr Guid HOMEBREW_ANIME_LOADER{0x3, 0x1};
}