mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[util] Get rid of explicit wchar_t parameter
We shouldn't be catering to Windows' weird string encoding mechanisms.
This commit is contained in:
parent
4f0da40afa
commit
3935d2540e
@ -133,7 +133,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkCsThread::threadFunc() {
|
||||
env::setThreadName(L"dxvk-cs");
|
||||
env::setThreadName("dxvk-cs");
|
||||
|
||||
DxvkCsChunkRef chunk;
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkSubmissionQueue::threadFunc() {
|
||||
env::setThreadName(L"dxvk-queue");
|
||||
env::setThreadName("dxvk-queue");
|
||||
|
||||
while (!m_stopped.load()) {
|
||||
Rc<DxvkCommandList> cmdList;
|
||||
|
@ -360,7 +360,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkStateCache::workerFunc() {
|
||||
env::setThreadName(L"dxvk-shader");
|
||||
env::setThreadName("dxvk-shader");
|
||||
|
||||
while (!m_stopThreads.load()) {
|
||||
WorkerItem item;
|
||||
@ -385,7 +385,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkStateCache::writerFunc() {
|
||||
env::setThreadName(L"dxvk-writer");
|
||||
env::setThreadName("dxvk-writer");
|
||||
|
||||
std::ofstream file;
|
||||
|
||||
|
@ -43,9 +43,19 @@ namespace dxvk::env {
|
||||
}
|
||||
|
||||
|
||||
void setThreadName(const wchar_t* name) {
|
||||
void setThreadName(const std::string& name) {
|
||||
using SetThreadDescriptionProc = void (WINAPI *) (HANDLE, PCWSTR);
|
||||
|
||||
int nameLen = ::MultiByteToWideChar(
|
||||
CP_ACP, 0, name.c_str(), name.length() + 1,
|
||||
nullptr, 0);
|
||||
|
||||
std::vector<WCHAR> wideName(nameLen);
|
||||
|
||||
::MultiByteToWideChar(
|
||||
CP_ACP, 0, name.c_str(), name.length() + 1,
|
||||
wideName.data(), nameLen);
|
||||
|
||||
HMODULE module = ::GetModuleHandleW(L"kernel32.dll");
|
||||
|
||||
if (module == nullptr)
|
||||
@ -55,7 +65,7 @@ namespace dxvk::env {
|
||||
::GetProcAddress(module, "SetThreadDescription"));
|
||||
|
||||
if (proc != nullptr)
|
||||
(*proc)(::GetCurrentThread(), name);
|
||||
(*proc)(::GetCurrentThread(), wideName.data());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ namespace dxvk::env {
|
||||
* \brief Sets name of the calling thread
|
||||
* \param [in] name Thread name
|
||||
*/
|
||||
void setThreadName(const wchar_t* name);
|
||||
void setThreadName(const std::string& name);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user