mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[util] Set thread names for DXVK's own threads
Makes it easier to identify the command stream thread and the queue processing thread easier when using a wine build that supports SetThreadDescription.
This commit is contained in:
parent
432708c15f
commit
79a1703aea
@ -72,6 +72,8 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkCsThread::threadFunc() {
|
||||
env::setThreadName(L"dxvk-cs");
|
||||
|
||||
Rc<DxvkCsChunk> chunk;
|
||||
|
||||
while (!m_stopped.load()) {
|
||||
|
@ -40,8 +40,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkPipelineCompiler::runCompilerThread(uint32_t workerId) {
|
||||
Logger::debug(str::format(
|
||||
"DxvkPipelineCompiler: Worker #", workerId, " started"));
|
||||
env::setThreadName(L"dxvk-pcompiler");
|
||||
|
||||
while (!m_compilerStop.load()) {
|
||||
PipelineEntry entry;
|
||||
@ -62,9 +61,6 @@ namespace dxvk {
|
||||
if (entry.pipeline != nullptr && entry.instance != nullptr)
|
||||
entry.pipeline->compileInstance(entry.instance);
|
||||
}
|
||||
|
||||
Logger::debug(str::format(
|
||||
"DxvkPipelineCompiler: Worker #", workerId, " stopped"));
|
||||
}
|
||||
|
||||
}
|
@ -35,6 +35,8 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkSubmissionQueue::threadFunc() {
|
||||
env::setThreadName(L"dxvk-queue");
|
||||
|
||||
while (!m_stopped.load()) {
|
||||
Rc<DxvkCommandList> cmdList;
|
||||
|
||||
|
@ -50,5 +50,21 @@ namespace dxvk::env {
|
||||
|
||||
return str::fromws(dxvkTempDir);
|
||||
}
|
||||
|
||||
|
||||
void setThreadName(const wchar_t* name) {
|
||||
using SetThreadDescriptionProc = void (WINAPI *) (HANDLE, PCWSTR);
|
||||
|
||||
HMODULE module = ::GetModuleHandleW(L"kernel32.dll");
|
||||
|
||||
if (module == nullptr)
|
||||
return;
|
||||
|
||||
auto proc = reinterpret_cast<SetThreadDescriptionProc>(
|
||||
::GetProcAddress(module, "SetThreadDescription"));
|
||||
|
||||
if (proc != nullptr)
|
||||
(*proc)(::GetCurrentThread(), name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,5 +33,11 @@ namespace dxvk::env {
|
||||
* \returns Temporary directory
|
||||
*/
|
||||
std::string getTempDirectory();
|
||||
|
||||
/**
|
||||
* \brief Sets name of the calling thread
|
||||
* \param [in] name Thread name
|
||||
*/
|
||||
void setThreadName(const wchar_t* name);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user