From d6476468262f357c682f6c0431345c23e1d3ba7d Mon Sep 17 00:00:00 2001 From: Brad Grantham Date: Wed, 28 Aug 2024 12:26:29 -0700 Subject: [PATCH 1/5] remove CONVERT_EXPERIMENTAL_D3D12 and always support D3D12 in convert --- CMakeLists.txt | 6 ------ tools/convert/README.md | 3 --- tools/convert/main.cpp | 23 ----------------------- 3 files changed, 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59ddb67bc2..1c683ade0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,14 +167,8 @@ if(MSVC) # Add option to enable/disable launcher and interceptor. option(BUILD_LAUNCHER_AND_INTERCEPTOR "Build launcher and interceptor" OFF) - # Add option to enable/disable D3D12 gfxrecon-convert support. - option(CONVERT_EXPERIMENTAL_D3D12 "Build with convert DX12 enabled" OFF) - if(${D3D12_SUPPORT}) add_definitions(-DD3D12_SUPPORT) - if(${CONVERT_EXPERIMENTAL_D3D12}) - add_definitions(-DCONVERT_EXPERIMENTAL_D3D12) - endif() # Check Windows SDK version and print warning if there is a mismatch. set(EXPECTED_WIN_SDK_VER "10.0.20348.0") diff --git a/tools/convert/README.md b/tools/convert/README.md index 7d610105ea..bbf9a7c872 100644 --- a/tools/convert/README.md +++ b/tools/convert/README.md @@ -8,9 +8,6 @@ The text output is written by default to a .json file in the directory of the specified GFXReconstruct capture file. Use `--output` to override the default filename for the output. -Configure with the CONVERT_EXPERIMENTAL_D3D12 flag in order to enable conversion of D3D12 captures. - - ```text gfxrecon-convert - A tool to convert GFXReconstruct capture files to text. diff --git a/tools/convert/main.cpp b/tools/convert/main.cpp index 2d74c9933f..18eb7b1e8c 100644 --- a/tools/convert/main.cpp +++ b/tools/convert/main.cpp @@ -33,17 +33,13 @@ #include "generated/generated_vulkan_json_consumer.h" #include "decode/marker_json_consumer.h" #include "decode/metadata_json_consumer.h" -#if defined(CONVERT_EXPERIMENTAL_D3D12) #include "generated/generated_dx12_json_consumer.h" -#endif using gfxrecon::util::JsonFormat; using VulkanJsonConsumer = gfxrecon::decode::MetadataJsonConsumer< gfxrecon::decode::MarkerJsonConsumer>; -#if defined(CONVERT_EXPERIMENTAL_D3D12) using Dx12JsonConsumer = gfxrecon::decode::MetadataJsonConsumer>; -#endif const char kOptions[] = "-h|--help,--version,--no-debug-popup,--file-per-frame,--include-binaries,--expand-flags"; const char kArguments[] = "--output,--format"; @@ -175,19 +171,6 @@ int main(int argc, const char** argv) gfxrecon::decode::FileProcessor file_processor; -#ifndef CONVERT_EXPERIMENTAL_D3D12 - bool detected_d3d12 = false; - bool detected_vulkan = false; - gfxrecon::decode::DetectAPIs(input_filename, detected_d3d12, detected_vulkan); - - if (detected_d3d12) - { - GFXRECON_LOG_INFO("D3D12 support for gfxrecon-convert is currently experimental."); - GFXRECON_LOG_INFO("To enable it, run cmake again with switch -DCONVERT_EXPERIMENTAL_D3D12"); - goto exit; - } -#endif - if (file_per_frame && output_to_stdout) { GFXRECON_LOG_WARNING("Outputting a file per frame is not consistent with outputting to stdout."); @@ -252,8 +235,6 @@ int main(int argc, const char** argv) json_consumer.Initialize(&json_writer, vulkan_version); json_writer.StartStream(&out_stream); - // If CONVERT_EXPERIMENTAL_D3D12 was set, then add DX12 consumer/decoder -#ifdef CONVERT_EXPERIMENTAL_D3D12 Dx12JsonConsumer dx12_json_consumer; gfxrecon::decode::Dx12Decoder dx12_decoder; @@ -262,7 +243,6 @@ int main(int argc, const char** argv) auto dx12_json_flags = output_format == JsonFormat::JSON ? gfxrecon::util::kToString_Formatted : gfxrecon::util::kToString_Unformatted; dx12_json_consumer.Initialize(&json_writer); -#endif while (success) { @@ -288,10 +268,7 @@ int main(int argc, const char** argv) } } json_consumer.Destroy(); - // If CONVERT_EXPERIMENTAL_D3D12 was set, then cleanup DX12 consumer -#ifdef CONVERT_EXPERIMENTAL_D3D12 dx12_json_consumer.Destroy(); -#endif if (!output_to_stdout) { gfxrecon::util::platform::FileClose(out_file_handle); From 78b7d40c99a2c7065323f216464617a19a095b43 Mon Sep 17 00:00:00 2001 From: Brad Grantham Date: Wed, 28 Aug 2024 17:16:19 -0700 Subject: [PATCH 2/5] only compile D3D12 into convert if D3D12_SUPPORT is defined --- tools/convert/main.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/convert/main.cpp b/tools/convert/main.cpp index 18eb7b1e8c..718fdb9649 100644 --- a/tools/convert/main.cpp +++ b/tools/convert/main.cpp @@ -33,13 +33,17 @@ #include "generated/generated_vulkan_json_consumer.h" #include "decode/marker_json_consumer.h" #include "decode/metadata_json_consumer.h" +#if defined(D3D12_SUPPORT) #include "generated/generated_dx12_json_consumer.h" +#endif using gfxrecon::util::JsonFormat; using VulkanJsonConsumer = gfxrecon::decode::MetadataJsonConsumer< gfxrecon::decode::MarkerJsonConsumer>; +#if defined(D3D12_SUPPORT) using Dx12JsonConsumer = gfxrecon::decode::MetadataJsonConsumer>; +#endif const char kOptions[] = "-h|--help,--version,--no-debug-popup,--file-per-frame,--include-binaries,--expand-flags"; const char kArguments[] = "--output,--format"; @@ -171,6 +175,17 @@ int main(int argc, const char** argv) gfxrecon::decode::FileProcessor file_processor; +#ifndef D3D12_SUPPORT + bool detected_d3d12 = false; + bool detected_vulkan = false; + gfxrecon::decode::DetectAPIs(input_filename, detected_d3d12, detected_vulkan); + + if (detected_d3d12) + { + GFXRECON_LOG_INFO("Capture file contains D3D12 content but gfxrecon-convert is not compiled with D3D12 support."); + goto exit; + } +#endif if (file_per_frame && output_to_stdout) { GFXRECON_LOG_WARNING("Outputting a file per frame is not consistent with outputting to stdout."); @@ -235,6 +250,8 @@ int main(int argc, const char** argv) json_consumer.Initialize(&json_writer, vulkan_version); json_writer.StartStream(&out_stream); + // If CONVERT_EXPERIMENTAL_D3D12 was set, then add DX12 consumer/decoder +#ifdef D3D12_SUPPORT Dx12JsonConsumer dx12_json_consumer; gfxrecon::decode::Dx12Decoder dx12_decoder; @@ -243,6 +260,7 @@ int main(int argc, const char** argv) auto dx12_json_flags = output_format == JsonFormat::JSON ? gfxrecon::util::kToString_Formatted : gfxrecon::util::kToString_Unformatted; dx12_json_consumer.Initialize(&json_writer); +#endif while (success) { @@ -268,7 +286,10 @@ int main(int argc, const char** argv) } } json_consumer.Destroy(); + // If CONVERT_EXPERIMENTAL_D3D12 was set, then cleanup DX12 consumer +#ifdef D3D12_SUPPORT dx12_json_consumer.Destroy(); +#endif if (!output_to_stdout) { gfxrecon::util::platform::FileClose(out_file_handle); From 9e25092721926466440176d6b74d6cea4a0055d4 Mon Sep 17 00:00:00 2001 From: Brad Grantham Date: Wed, 28 Aug 2024 17:26:49 -0700 Subject: [PATCH 3/5] fix clang-format --- tools/convert/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/convert/main.cpp b/tools/convert/main.cpp index 718fdb9649..c4f888d1b3 100644 --- a/tools/convert/main.cpp +++ b/tools/convert/main.cpp @@ -175,14 +175,15 @@ int main(int argc, const char** argv) gfxrecon::decode::FileProcessor file_processor; -#ifndef D3D12_SUPPORT +#ifndef D3D12_SUPPORT bool detected_d3d12 = false; bool detected_vulkan = false; gfxrecon::decode::DetectAPIs(input_filename, detected_d3d12, detected_vulkan); if (detected_d3d12) { - GFXRECON_LOG_INFO("Capture file contains D3D12 content but gfxrecon-convert is not compiled with D3D12 support."); + GFXRECON_LOG_INFO( + "Capture file contains D3D12 content but gfxrecon-convert is not compiled with D3D12 support."); goto exit; } #endif From ddeece6dd0e259fa2409294502382454523ecfaf Mon Sep 17 00:00:00 2001 From: Brad Grantham Date: Thu, 29 Aug 2024 12:15:47 -0700 Subject: [PATCH 4/5] invert sense of D3D12 content detection in convert --- tools/convert/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/convert/main.cpp b/tools/convert/main.cpp index c4f888d1b3..a58a2cd982 100644 --- a/tools/convert/main.cpp +++ b/tools/convert/main.cpp @@ -180,10 +180,10 @@ int main(int argc, const char** argv) bool detected_vulkan = false; gfxrecon::decode::DetectAPIs(input_filename, detected_d3d12, detected_vulkan); - if (detected_d3d12) + if (!detected_vulkan) { GFXRECON_LOG_INFO( - "Capture file contains D3D12 content but gfxrecon-convert is not compiled with D3D12 support."); + "Capture file does not contain Vulkan content. D3D12 content may be present but gfxrecon-convert is not compiled with D3D12 support."); goto exit; } #endif From 03c323e33f07bbd1dbe72d5f0e096ce91ac6b11e Mon Sep 17 00:00:00 2001 From: Brad Grantham Date: Thu, 29 Aug 2024 12:56:09 -0700 Subject: [PATCH 5/5] fix clang-format --- tools/convert/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/convert/main.cpp b/tools/convert/main.cpp index a58a2cd982..b7528d0836 100644 --- a/tools/convert/main.cpp +++ b/tools/convert/main.cpp @@ -182,8 +182,8 @@ int main(int argc, const char** argv) if (!detected_vulkan) { - GFXRECON_LOG_INFO( - "Capture file does not contain Vulkan content. D3D12 content may be present but gfxrecon-convert is not compiled with D3D12 support."); + GFXRECON_LOG_INFO("Capture file does not contain Vulkan content. D3D12 content may be present but " + "gfxrecon-convert is not compiled with D3D12 support."); goto exit; } #endif