From 66af8942cbbc76aaf32cdfa520d7bbbbf26e1f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Thu, 13 Jun 2024 10:08:18 +0200 Subject: [PATCH] Fix command sequence for enumerating commands with just one success code. (#1900) --- VulkanHppGenerator.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index d6ad631..d853422 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -3282,13 +3282,31 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const & switch ( commandData.successCodes.size() ) { case 1: + assert( commandData.successCodes[0] == "VK_SUCCESS" ); + if ( commandData.errorCodes.empty() ) { - assert( commandData.successCodes[0] == "VK_SUCCESS" ); std::string const callSequenceTemplate = R"(${dispatcher}${vkCommand}( ${firstCallArguments} ); ${resizes} ${dispatcher}${vkCommand}( ${secondCallArguments} ); )"; + return replaceWithMap( callSequenceTemplate, + { { "dispatcher", dispatcher }, + { "firstCallArguments", firstCallArguments }, + { "secondCallArguments", secondCallArguments }, + { "resizes", resizes }, + { "vkCommand", name } } ); + } + else + { + std::string const callSequenceTemplate = R"(VULKAN_HPP_NAMESPACE::Result result = ${dispatcher}${vkCommand}( ${firstCallArguments} ); + if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess ) + { + ${resizes} + result = ${dispatcher}${vkCommand}( ${secondCallArguments} ); + } +)"; + return replaceWithMap( callSequenceTemplate, { { "dispatcher", dispatcher }, { "firstCallArguments", firstCallArguments },