1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[util] Implement LUID helpers for non-Windows platforms Initial commit

This commit is contained in:
Joshua Ashton 2022-07-05 15:17:37 +01:00 committed by Philip Rebohle
parent 3733590756
commit 2bd062f9d6

View File

@ -5,9 +5,20 @@
#include <mutex>
#include <vector>
#include <atomic>
namespace dxvk {
#ifndef _WIN32
static BOOL AllocateLocallyUniqueId(LUID* luid) {
static std::atomic<uint32_t> counter = { 0u };
// Unsigned bottom part is actually the first
// member of the struct.
*luid = LUID{ ++counter, 0 };
return TRUE;
}
#endif
LUID GetAdapterLUID(UINT Adapter) {
static dxvk::mutex s_mutex;
static std::vector<LUID> s_luids;
@ -18,7 +29,7 @@ namespace dxvk {
while (s_luids.size() < newLuidCount) {
LUID luid = { 0, 0 };
if (!::AllocateLocallyUniqueId(&luid))
if (!AllocateLocallyUniqueId(&luid))
Logger::err("Failed to allocate LUID");