Skip to content

Commit

Permalink
Split too big string into three
Browse files Browse the repository at this point in the history
  • Loading branch information
locke-lunarg committed Mar 7, 2024
1 parent ccfaaf3 commit 36ad2f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion framework/decode/vulkan_cpp_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 7 additions & 1 deletion framework/decode/vulkan_cpp_template_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 36ad2f2

Please sign in to comment.