mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
[util] Use transcodeString in setThreadName function
This commit is contained in:
parent
bb3c0b9707
commit
65070bd765
@ -93,13 +93,17 @@ namespace dxvk::env {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
using SetThreadDescriptionProc = HRESULT (WINAPI *) (HANDLE, PCWSTR);
|
using SetThreadDescriptionProc = HRESULT (WINAPI *) (HANDLE, PCWSTR);
|
||||||
|
|
||||||
static auto proc = reinterpret_cast<SetThreadDescriptionProc>(
|
static auto SetThreadDescription = reinterpret_cast<SetThreadDescriptionProc>(
|
||||||
::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetThreadDescription"));
|
::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetThreadDescription"));
|
||||||
|
|
||||||
if (proc != nullptr) {
|
if (SetThreadDescription) {
|
||||||
auto wideName = std::vector<WCHAR>(name.length() + 1);
|
std::array<wchar_t, 16> wideName = { };
|
||||||
str::tows(name.c_str(), wideName.data(), wideName.size());
|
|
||||||
(*proc)(::GetCurrentThread(), wideName.data());
|
str::transcodeString(
|
||||||
|
wideName.data(), wideName.size() - 1,
|
||||||
|
name.data(), name.size());
|
||||||
|
|
||||||
|
SetThreadDescription(::GetCurrentThread(), wideName.data());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::array<char, 16> posixName = {};
|
std::array<char, 16> posixName = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user