1
0
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:
Entryhazard 2019-09-22 10:11:17 +02:00 committed by Philip Rebohle
parent f37d4b58b6
commit 252d71e55e

View File

@ -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);