mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 11:52:12 +01:00
Retrieve the function pointer once (#1198)
This commit is contained in:
parent
f37d4b58b6
commit
252d71e55e
@ -36,13 +36,8 @@ namespace dxvk::env {
|
||||
void setThreadName(const std::string& name) {
|
||||
using SetThreadDescriptionProc = HRESULT (WINAPI *) (HANDLE, PCWSTR);
|
||||
|
||||
HMODULE module = ::GetModuleHandleW(L"kernel32.dll");
|
||||
|
||||
if (module == nullptr)
|
||||
return;
|
||||
|
||||
auto proc = reinterpret_cast<SetThreadDescriptionProc>(
|
||||
::GetProcAddress(module, "SetThreadDescription"));
|
||||
static auto proc = reinterpret_cast<SetThreadDescriptionProc>(
|
||||
::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetThreadDescription"));
|
||||
|
||||
if (proc != nullptr) {
|
||||
auto wideName = str::tows(name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user