mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +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
|
||||
using SetThreadDescriptionProc = HRESULT (WINAPI *) (HANDLE, PCWSTR);
|
||||
|
||||
static auto proc = reinterpret_cast<SetThreadDescriptionProc>(
|
||||
static auto SetThreadDescription = reinterpret_cast<SetThreadDescriptionProc>(
|
||||
::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetThreadDescription"));
|
||||
|
||||
if (proc != nullptr) {
|
||||
auto wideName = std::vector<WCHAR>(name.length() + 1);
|
||||
str::tows(name.c_str(), wideName.data(), wideName.size());
|
||||
(*proc)(::GetCurrentThread(), wideName.data());
|
||||
if (SetThreadDescription) {
|
||||
std::array<wchar_t, 16> wideName = { };
|
||||
|
||||
str::transcodeString(
|
||||
wideName.data(), wideName.size() - 1,
|
||||
name.data(), name.size());
|
||||
|
||||
SetThreadDescription(::GetCurrentThread(), wideName.data());
|
||||
}
|
||||
#else
|
||||
std::array<char, 16> posixName = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user