Skip to content

Commit

Permalink
Fix Aztec swapchain replay count
Browse files Browse the repository at this point in the history
Fix the swapchain replay count for Aztec by checking the swapchain
requirements of the replay system.
  • Loading branch information
MarkY-LunarG committed Dec 28, 2023
1 parent 92612b3 commit afd3e52
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions framework/decode/vulkan_cpp_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ void VulkanCppConsumerBase::Generate_vkCreateSwapchainKHR(
FILE* file = GetFrameFile();

fprintf(file, "\t{\n");

// device
// pCreateInfo
std::stringstream stream_pcreate_info;
Expand All @@ -602,6 +603,34 @@ void VulkanCppConsumerBase::Generate_vkCreateSwapchainKHR(
{
this->AddHandles(pswapchain_name, pSwapchain->GetPointer());
}

DeviceInfo* dev_info = nullptr;
if (device_info_map_.find(device) != device_info_map_.end())
{
dev_info = device_info_map_[device];

fprintf(file, "\t\tVkSurfaceCapabilitiesKHR surface_caps;\n");
fprintf(file,
"\t\tif (VK_SUCCESS == loaded_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(%s, %s, &surface_caps)) {\n",
this->GetHandle(dev_info->parent).c_str(),
this->GetHandle(pCreateInfo->GetMetaStructPointer()->surface).c_str());

// VkSwapchainCreateInfoKHR modified_create_info = *create_info;
// modified_create_info.imageUsage =
// modified_create_info.imageUsage | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;

fprintf(file, "\t\t\tif (%s.minImageCount < surface_caps.minImageCount) {\n", pcreate_info_struct.c_str());
fprintf(file, "\t\t\t\t%s.minImageCount = surface_caps.minImageCount;\n", pcreate_info_struct.c_str());
fprintf(file, "\t\t\t}\n");
fprintf(file,
"\t\t\tif ((surface_caps.maxImageCount > 0) && (%s.minImageCount > surface_caps.maxImageCount)) {\n",
pcreate_info_struct.c_str());
fprintf(file, "\t\t\t\t%s.minImageCount = surface_caps.maxImageCount;\n", pcreate_info_struct.c_str());
fprintf(file, "\t\t\t}\n");

fprintf(file, "\t\t}\n");
}

pfn_loader_.AddMethodName("vkCreateSwapchainKHR");
fprintf(file,
"\t\tVK_CALL_CHECK(loaded_vkCreateSwapchainKHR(%s, &%s, %s, &%s), %s);\n",
Expand Down
2 changes: 1 addition & 1 deletion framework/decode/vulkan_cpp_structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ std::string GenerateStruct_VkSwapchainCreateInfoKHR(std::ostream&
// surface
struct_body << "\t\t\t" << consumer.GetHandle(metaInfo->surface) << "," << std::endl;
// minImageCount
struct_body << "\t\t\t3,\n"; // structInfo->minImageCount << "," << std::endl;
struct_body << "\t\t\t" << structInfo->minImageCount << "," << std::endl;
// imageFormat
struct_body << "\t\t\t"
<< "VkFormat(" << structInfo->imageFormat << ")"
Expand Down

0 comments on commit afd3e52

Please sign in to comment.