1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-13 19:29:14 +01:00

[dxvk] Only time pipeline compile times if requested

Avoids some unnecessary calls to high_resolution_clock::now().
This commit is contained in:
Philip Rebohle 2019-09-21 13:09:38 +02:00
parent 6ecb74d2c0
commit e926ceb9cc
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 20 additions and 8 deletions

View File

@ -124,7 +124,10 @@ namespace dxvk {
info.basePipelineIndex = -1;
// Time pipeline compilation for debugging purposes
auto t0 = std::chrono::high_resolution_clock::now();
std::chrono::high_resolution_clock::time_point t0, t1;
if (Logger::logLevel() <= LogLevel::Debug)
t0 = std::chrono::high_resolution_clock::now();
VkPipeline pipeline = VK_NULL_HANDLE;
if (m_vkd->vkCreateComputePipelines(m_vkd->device(),
@ -134,9 +137,12 @@ namespace dxvk {
return VK_NULL_HANDLE;
}
auto t1 = std::chrono::high_resolution_clock::now();
auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
Logger::debug(str::format("DxvkComputePipeline: Finished in ", td.count(), " ms"));
if (Logger::logLevel() <= LogLevel::Debug) {
t1 = std::chrono::high_resolution_clock::now();
auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
Logger::debug(str::format("DxvkComputePipeline: Finished in ", td.count(), " ms"));
}
return pipeline;
}

View File

@ -439,7 +439,10 @@ namespace dxvk {
info.pTessellationState = nullptr;
// Time pipeline compilation for debugging purposes
auto t0 = std::chrono::high_resolution_clock::now();
std::chrono::high_resolution_clock::time_point t0, t1;
if (Logger::logLevel() <= LogLevel::Debug)
t0 = std::chrono::high_resolution_clock::now();
VkPipeline pipeline = VK_NULL_HANDLE;
if (m_vkd->vkCreateGraphicsPipelines(m_vkd->device(),
@ -449,9 +452,12 @@ namespace dxvk {
return VK_NULL_HANDLE;
}
auto t1 = std::chrono::high_resolution_clock::now();
auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
Logger::debug(str::format("DxvkGraphicsPipeline: Finished in ", td.count(), " ms"));
if (Logger::logLevel() <= LogLevel::Debug) {
t1 = std::chrono::high_resolution_clock::now();
auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
Logger::debug(str::format("DxvkGraphicsPipeline: Finished in ", td.count(), " ms"));
}
return pipeline;
}