From 36ad2f29dd2438dcce6a2a338fdf1e6a9bcfe024 Mon Sep 17 00:00:00 2001 From: Locke Lin Date: Thu, 7 Mar 2024 12:07:14 -0700 Subject: [PATCH] Split too big string into three --- framework/decode/vulkan_cpp_consumer_base.cpp | 4 +++- framework/decode/vulkan_cpp_template_strings.h | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/decode/vulkan_cpp_consumer_base.cpp b/framework/decode/vulkan_cpp_consumer_base.cpp index 6a9957b133..8639e8dc8e 100644 --- a/framework/decode/vulkan_cpp_consumer_base.cpp +++ b/framework/decode/vulkan_cpp_consumer_base.cpp @@ -377,7 +377,9 @@ bool VulkanCppConsumerBase::WriteSwapchainFiles() result = util::platform::FileOpen(&source_file, source_filename.c_str(), "w"); if (result == 0) { - fputs(sSwapchainSourceCode, source_file); + fputs(sSwapchainSourceCode_part_1, source_file); + fputs(sSwapchainSourceCode_part_2, source_file); + fputs(sSwapchainSourceCode_part_3, source_file); util::platform::FileClose(source_file); } diff --git a/framework/decode/vulkan_cpp_template_strings.h b/framework/decode/vulkan_cpp_template_strings.h index da7f3d5f43..c9ea89f75b 100644 --- a/framework/decode/vulkan_cpp_template_strings.h +++ b/framework/decode/vulkan_cpp_template_strings.h @@ -857,7 +857,7 @@ VkResult toCppAcquireNextImageKHR(VkResult expected_result, VkResult toCppQueuePresentKHR(VkQueue queue, VkPresentInfoKHR* pPresentInfo); )"; -static const char* sSwapchainSourceCode = R"( +static const char* sSwapchainSourceCode_part_1 = R"( #include "global_var.h" #include "loader.h" #include "swapchain_common.h" @@ -1218,6 +1218,9 @@ VkResult toCppGetSwapchainImagesKHR(VkDevice device, continue; } +)"; + +static const char* sSwapchainSourceCode_part_2 = R"( ToCppCopyCmdData copy_cmd_data = {}; // Create one command pool per queue. @@ -1539,6 +1542,9 @@ VkResult toCppQueuePresentKHR(VkQueue queue, VkPresentInfoKHR* pPresentInfo) final_barrier_swapchain_image = final_barrier_virtual_image; final_barrier_swapchain_image.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; +)"; + +static const char* sSwapchainSourceCode_part_3 = R"( VkImageSubresourceLayers subresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 0 }; VkOffset3D offset = { 0, 0, 0 }; auto swapchain_count = pPresentInfo->swapchainCount;