From 0ad7a08c4937a98baf5c0740d65a43d36a8399f1 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 8 Aug 2022 18:58:22 +0200 Subject: [PATCH] [dxvk] Get rid of some old debug code for compute pipelines --- src/dxvk/dxvk_compute.cpp | 52 +++++++++++++++++++++++---------------- src/dxvk/dxvk_compute.h | 6 ++++- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/dxvk/dxvk_compute.cpp b/src/dxvk/dxvk_compute.cpp index 448408dc..0006ce14 100644 --- a/src/dxvk/dxvk_compute.cpp +++ b/src/dxvk/dxvk_compute.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include "../util/util_time.h" @@ -101,11 +103,6 @@ namespace dxvk { const DxvkComputePipelineStateInfo& state) const { auto vk = m_device->vkd(); - if (Logger::logLevel() <= LogLevel::Debug) { - Logger::debug("Compiling compute pipeline..."); - Logger::debug(str::format(" cs : ", m_shaders.cs->debugName())); - } - DxvkPipelineSpecConstantState scState(m_shaders.cs->getSpecConstantMask(), state.sc); DxvkShaderStageInfo stageInfo(m_device); @@ -117,26 +114,16 @@ namespace dxvk { info.stage = *stageInfo.getStageInfos(); info.layout = m_bindings->getPipelineLayout(false); info.basePipelineIndex = -1; - - // Time pipeline compilation for debugging purposes - dxvk::high_resolution_clock::time_point t0, t1; - if (Logger::logLevel() <= LogLevel::Debug) - t0 = dxvk::high_resolution_clock::now(); - VkPipeline pipeline = VK_NULL_HANDLE; - if (vk->vkCreateComputePipelines(vk->device(), - VK_NULL_HANDLE, 1, &info, nullptr, &pipeline) != VK_SUCCESS) { - Logger::err("DxvkComputePipeline: Failed to compile pipeline"); - Logger::err(str::format(" cs : ", m_shaders.cs->debugName())); + VkResult vr = vk->vkCreateComputePipelines(vk->device(), + VK_NULL_HANDLE, 1, &info, nullptr, &pipeline); + + if (vr != VK_SUCCESS) { + Logger::err(str::format("DxvkComputePipeline: Failed to compile pipeline: ", vr)); + this->logPipelineState(LogLevel::Error, state); return VK_NULL_HANDLE; } - - if (Logger::logLevel() <= LogLevel::Debug) { - t1 = dxvk::high_resolution_clock::now(); - auto td = std::chrono::duration_cast(t1 - t0); - Logger::debug(str::format("DxvkComputePipeline: Finished in ", td.count(), " ms")); - } return pipeline; } @@ -159,4 +146,27 @@ namespace dxvk { m_stateCache->addComputePipeline(key, state); } + + void DxvkComputePipeline::logPipelineState( + LogLevel level, + const DxvkComputePipelineStateInfo& state) const { + std::stringstream sstr; + sstr << " cs : " << m_shaders.cs->debugName() << std::endl; + + bool hasSpecConstants = false; + + for (uint32_t i = 0; i < MaxNumSpecConstants; i++) { + if (state.sc.specConstants[i]) { + if (!hasSpecConstants) { + sstr << "Specialization constants:" << std::endl; + hasSpecConstants = true; + } + + sstr << " " << i << ": 0x" << std::hex << std::setw(8) << std::setfill('0') << state.sc.specConstants[i] << std::dec << std::endl; + } + } + + Logger::log(level, sstr.str()); + } + } diff --git a/src/dxvk/dxvk_compute.h b/src/dxvk/dxvk_compute.h index 560e59ab..141a1133 100644 --- a/src/dxvk/dxvk_compute.h +++ b/src/dxvk/dxvk_compute.h @@ -151,7 +151,11 @@ namespace dxvk { void writePipelineStateToCache( const DxvkComputePipelineStateInfo& state) const; - + + void logPipelineState( + LogLevel level, + const DxvkComputePipelineStateInfo& state) const; + }; } \ No newline at end of file