diff options
| author | Yong He <yonghe@outlook.com> | 2023-10-19 03:49:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-19 18:49:42 +0800 |
| commit | d001a7b5eee4400150816e9962adaff183bfff35 (patch) | |
| tree | e6c7d25258aba6056f231886d55cbb6963859c42 /tools/gfx/vulkan/vk-device.cpp | |
| parent | 7826afcaad78cc33c976bb3db3cdc9eada4c77e8 (diff) | |
Add a tool to dump/replay compute pipeline creation from gfx. (#3275)
* Add a tool to dump/replay compute pipeline creation from gfx.
* Fix x86 build.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/vulkan/vk-device.cpp')
| -rw-r--r-- | tools/gfx/vulkan/vk-device.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp index f8bc9c3aa..fe3680eda 100644 --- a/tools/gfx/vulkan/vk-device.cpp +++ b/tools/gfx/vulkan/vk-device.cpp @@ -15,9 +15,12 @@ #include "vk-swap-chain.h" #include "vk-transient-heap.h" #include "vk-vertex-layout.h" +#include "vk-pipeline-dump-layer.h" #include "vk-helper-functions.h" +#include "source/core/slang-platform.h" + #ifdef GFX_NV_AFTERMATH # include "GFSDK_Aftermath.h" # include "GFSDK_Aftermath_Defines.h" @@ -32,8 +35,20 @@ using namespace Slang; namespace vk { +static bool shouldDumpPipeline() +{ + StringBuilder dumpPipelineSettings; + PlatformUtil::getEnvironmentVariable(toSlice("SLANG_GFX_DUMP_PIPELINE"), dumpPipelineSettings); + return dumpPipelineSettings.produceString() == "1"; +} + DeviceImpl::~DeviceImpl() { + if (shouldDumpPipeline()) + { + writePipelineDump(toSlice("gfx-vk-pipeline-dump.bin")); + } + // Check the device queue is valid else, we can't wait on it.. if (m_deviceQueue.isValid()) { @@ -782,6 +797,10 @@ Result DeviceImpl::initVulkanInstanceAndDevice( SLANG_RETURN_ON_FAIL(m_api.initDeviceProcs(m_device)); + if (shouldDumpPipeline()) + { + installPipelineDumpLayer(m_api); + } return SLANG_OK; } |
