mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +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) {
|
void setThreadName(const std::string& name) {
|
||||||
using SetThreadDescriptionProc = HRESULT (WINAPI *) (HANDLE, PCWSTR);
|
using SetThreadDescriptionProc = HRESULT (WINAPI *) (HANDLE, PCWSTR);
|
||||||
|
|
||||||
HMODULE module = ::GetModuleHandleW(L"kernel32.dll");
|
static auto proc = reinterpret_cast<SetThreadDescriptionProc>(
|
||||||
|
::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetThreadDescription"));
|
||||||
if (module == nullptr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto proc = reinterpret_cast<SetThreadDescriptionProc>(
|
|
||||||
::GetProcAddress(module, "SetThreadDescription"));
|
|
||||||
|
|
||||||
if (proc != nullptr) {
|
if (proc != nullptr) {
|
||||||
auto wideName = str::tows(name);
|
auto wideName = str::tows(name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user