From 60047de40a737410855f5d67512fa83b8695843a Mon Sep 17 00:00:00 2001 From: Mark Young Date: Tue, 12 Dec 2023 14:15:29 -0700 Subject: [PATCH] Fix imported semaphore support Fix support for imported semaphores (i.e we ignore them on replay). This change gets Aztec running on my Pixel device. Also remove the global variable tracking which never worked properly for me and other debug code that crept it's way in --- framework/decode/vulkan_cpp_consumer_base.cpp | 272 ++++++++++- framework/decode/vulkan_cpp_consumer_base.h | 54 ++ .../decode/vulkan_cpp_resource_tracker.cpp | 12 - .../decode/vulkan_cpp_resource_tracker.h | 11 +- framework/decode/vulkan_cpp_structs.cpp | 462 +++++++++++++++++- framework/decode/vulkan_cpp_structs.h | 25 +- .../decode/vulkan_cpp_template_strings.h | 1 - framework/decode/vulkan_cpp_util_datapack.h | 1 - .../generated_vulkan_cpp_consumer.cpp | 224 +-------- .../generated_vulkan_cpp_structs.cpp | 263 ---------- .../generated/generated_vulkan_cpp_structs.h | 6 - .../vulkan_cpp_consumer_body_generator.py | 10 + .../vulkan_cpp_struct_generator.py | 3 + tools/tocpp/main.cpp | 1 - 14 files changed, 787 insertions(+), 558 deletions(-) diff --git a/framework/decode/vulkan_cpp_consumer_base.cpp b/framework/decode/vulkan_cpp_consumer_base.cpp index 09ae28cb9d..15a602bf27 100644 --- a/framework/decode/vulkan_cpp_consumer_base.cpp +++ b/framework/decode/vulkan_cpp_consumer_base.cpp @@ -27,8 +27,9 @@ #include "generated/generated_vulkan_cpp_consumer_extension.h" #include "generated/generated_vulkan_enum_to_string.h" -#include +#include #include +#include GFXRECON_BEGIN_NAMESPACE(gfxrecon) GFXRECON_BEGIN_NAMESPACE(decode) @@ -1455,6 +1456,18 @@ void VulkanCppConsumerBase::Intercept_vkCmdBeginRenderPass( } } +void VulkanCppConsumerBase::Intercept_vkDestroySemaphore( + format::HandleId device, + format::HandleId semaphore, + StructPointerDecoder* pAllocator) +{ + if (semaphore != format::kNullHandleId) + { + imported_semaphores_.erase(std::remove(imported_semaphores_.begin(), imported_semaphores_.end(), semaphore), + imported_semaphores_.end()); + } +} + void VulkanCppConsumerBase::Generate_vkAcquireNextImageKHR(VkResult returnValue, format::HandleId device, format::HandleId swapchain, @@ -2238,6 +2251,66 @@ void VulkanCppConsumerBase::Generate_vkCreateComputePipelines( fprintf(file, " }\n"); } +void VulkanCppConsumerBase::Generate_vkGetSemaphoreWin32HandleKHR( + VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pGetWin32HandleInfo, + PointerDecoder* pHandle) +{ + GFXRECON_UNREFERENCED_PARAMETER(returnValue); + GFXRECON_UNREFERENCED_PARAMETER(device); + GFXRECON_UNREFERENCED_PARAMETER(pGetWin32HandleInfo); + GFXRECON_UNREFERENCED_PARAMETER(pHandle); + FILE* file = GetFrameFile(); + fprintf(file, "\t// vkGetSemaphoreWin32HandleKHR ignored\n"); + + // No other work necessary because we're not actually sharing the semaphore during replay +} + +void VulkanCppConsumerBase::Generate_vkImportSemaphoreWin32HandleKHR( + VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pImportSemaphoreWin32HandleInfo) +{ + GFXRECON_UNREFERENCED_PARAMETER(returnValue); + GFXRECON_UNREFERENCED_PARAMETER(device); + + // Add the semaphore to the list of imported semaphores + imported_semaphores_.push_back(pImportSemaphoreWin32HandleInfo->GetMetaStructPointer()->semaphore); + + // No other work necessary because we're not actually importing the semaphore during replay +} + +void VulkanCppConsumerBase::Generate_vkGetSemaphoreFdKHR( + VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pGetFdInfo, + PointerDecoder* pFd) +{ + GFXRECON_UNREFERENCED_PARAMETER(returnValue); + GFXRECON_UNREFERENCED_PARAMETER(device); + GFXRECON_UNREFERENCED_PARAMETER(pGetFdInfo); + GFXRECON_UNREFERENCED_PARAMETER(pFd); + FILE* file = GetFrameFile(); + fprintf(file, "\t// vkGetSemaphoreFdKHR ignored\n"); + + // No other work necessary because we're not actually sharing the semaphore during replay +} + +void VulkanCppConsumerBase::Generate_vkImportSemaphoreFdKHR( + VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pImportSemaphoreFdInfo) +{ + GFXRECON_UNREFERENCED_PARAMETER(returnValue); + GFXRECON_UNREFERENCED_PARAMETER(device); + + // Add the semaphore to the list of imported semaphores + imported_semaphores_.push_back(pImportSemaphoreFdInfo->GetMetaStructPointer()->semaphore); + + // No other work necessary because we're not actually importing the semaphore during replay +} + std::string VulkanCppConsumerBase::ToEscape(const char* value) { return (value != nullptr) ? std::string("\"") + value + "\"" : "NULL"; @@ -2547,15 +2620,7 @@ void VulkanCppConsumerBase::AddKnownVariables(const std::string& type, const std::string& name, const format::HandleId* handleId) { - FILE* file = GetFrameFile(); - GfxToCppVariable variable = { type, name, 0 }; - if (!resource_tracker_->IsGlobalVariable(*handleId)) - { - fprintf(file, "//Local var at frame: %d, handle id: %" PRIu64 "\n", frame_number_, *handleId); - fprintf(file, "%s;\n", variable.GenerateString().c_str()); - return; - } variable_data_.emplace_back(variable); } @@ -2564,17 +2629,7 @@ void VulkanCppConsumerBase::AddKnownVariables(const std::string& type, const format::HandleId* handleId, uint32_t count) { - bool has_global = std::any_of(handleId, handleId + count, [&](const format::HandleId handleId) { - return resource_tracker_->IsGlobalVariable(handleId); - }); - GfxToCppVariable variable = { type, name, count }; - - if (!has_global) - { - fprintf(GetFrameFile(), "//Local var at frame: %d, handle id: %" PRIu64 "\n", frame_number_, handleId[0]); - fprintf(GetFrameFile(), "%s;\n", variable.GenerateString().c_str()); - return; - } + GfxToCppVariable variable = { type, name, count }; variable_data_.emplace_back(variable); } @@ -2629,6 +2684,7 @@ void VulkanCppConsumerBase::ProcessFillMemoryCommand(uint64_t memory_id, } else if (android_memory_id_map_.find(memory_id) != android_memory_id_map_.end()) { + // Update the memory using the Android Hardware buffer path (using "vulkan_replay_consumer_base" as a reference) VulkanCppAndroidMemoryInfo android_memory_info = android_memory_id_map_[memory_id]; std::string android_hw_mem_name = android_memory_info.name; FILE* file = GetFrameFile(); @@ -2733,6 +2789,7 @@ void VulkanCppConsumerBase::ProcessCreateHardwareBufferCommand( uint32_t layers, const std::vector& plane_info) { + // Create an Android Hardware buffer using the code from "vulkan_replay_consumer_base" as a reference. if (platform_ == GfxToCppPlatform::PLATFORM_ANDROID) { FILE* file = GetFrameFile(); @@ -2925,7 +2982,7 @@ void VulkanCppConsumerBase::Generate_vkGetAndroidHardwareBufferPropertiesANDROID buffer_name = android_buffer_id_map_[buffer].name; } - std::string properties_name = "pProperties_" + std::to_string(this->GetNextId()); + std::string properties_name = "properties_" + std::to_string(this->GetNextId()); std::stringstream stream_properties; properties_name = GenerateStruct_VkAndroidHardwareBufferPropertiesANDROID( stream_properties, pProperties->GetPointer(), pProperties->GetMetaStructPointer(), *this); @@ -2995,6 +3052,179 @@ void VulkanCppConsumerBase::Generate_vkGetMemoryAndroidHardwareBufferANDROID( fprintf(file, "\t}\n"); } +void VulkanCppConsumerBase::Generate_vkQueueSubmit(VkResult returnValue, + format::HandleId queue, + uint32_t submitCount, + StructPointerDecoder* pSubmits, + format::HandleId fence) +{ + FILE* file = GetFrameFile(); + fprintf(file, "\t{\n"); + // queue + // submitCount + // pSubmits + std::stringstream stream_psubmits; + std::string psubmits_array = "NULL"; + PointerPairContainerGetPointer()), decltype(pSubmits->GetMetaStructPointer())> psubmits_pair{ + pSubmits->GetPointer(), pSubmits->GetMetaStructPointer(), submitCount + }; + std::string psubmits_names = toStringJoin( + psubmits_pair.begin(), + psubmits_pair.end(), + [&](auto pair) { + { + return GenerateStruct_VkSubmitInfo(stream_psubmits, pair.t1, pair.t2, imported_semaphores_, *this); + } + }, + ", "); + if (stream_psubmits.str().length() > 0) + { + fprintf(file, "%s", stream_psubmits.str().c_str()); + if (submitCount == 1) + { + psubmits_array = "&" + psubmits_names; + } + else if (submitCount > 1) + { + psubmits_array = "submits_" + std::to_string(this->GetNextId()); + fprintf(file, "\t\tVkSubmitInfo %s[] = { %s };\n", psubmits_array.c_str(), psubmits_names.c_str()); + } + } + // fence + fprintf(file, + "\t\tVK_CALL_CHECK(vkQueueSubmit(%s, %u, %s, %s), %s);\n", + this->GetHandle(queue).c_str(), + submitCount, + psubmits_array.c_str(), + this->GetHandle(fence).c_str(), + util::ToString(returnValue).c_str()); + fprintf(file, "\t}\n"); +} + +void VulkanCppConsumerBase::Generate_vkQueueSubmit2(VkResult returnValue, + format::HandleId queue, + uint32_t submitCount, + StructPointerDecoder* pSubmits, + format::HandleId fence, + const char* extension) +{ + FILE* file = GetFrameFile(); + fprintf(file, "\t{\n"); + // queue + // submitCount + // pSubmits + std::stringstream stream_psubmits; + std::string psubmits_array = "NULL"; + PointerPairContainerGetPointer()), decltype(pSubmits->GetMetaStructPointer())> psubmits_pair{ + pSubmits->GetPointer(), pSubmits->GetMetaStructPointer(), submitCount + }; + std::string psubmits_names = toStringJoin( + psubmits_pair.begin(), + psubmits_pair.end(), + [&](auto pair) { + { + return GenerateStruct_VkSubmitInfo2(stream_psubmits, pair.t1, pair.t2, imported_semaphores_, *this); + } + }, + ", "); + if (stream_psubmits.str().length() > 0) + { + fprintf(file, "%s", stream_psubmits.str().c_str()); + if (submitCount == 1) + { + psubmits_array = "&" + psubmits_names; + } + else if (submitCount > 1) + { + psubmits_array = "submits_" + std::to_string(this->GetNextId()); + fprintf(file, "\t\tVkSubmitInfo2 %s[] = { %s };\n", psubmits_array.c_str(), psubmits_names.c_str()); + } + } + // fence + fprintf(file, + "\t\tVK_CALL_CHECK(vkQueueSubmit2%s(%s, %u, %s, %s), %s);\n", + extension, + this->GetHandle(queue).c_str(), + submitCount, + psubmits_array.c_str(), + this->GetHandle(fence).c_str(), + util::ToString(returnValue).c_str()); + fprintf(file, "\t}\n"); +} + +void VulkanCppConsumerBase::Generate_vkQueueBindSparse(VkResult returnValue, + format::HandleId queue, + uint32_t bindInfoCount, + StructPointerDecoder* pBindInfo, + format::HandleId fence) +{ + FILE* file = GetFrameFile(); + fprintf(file, "\t{\n"); + // queue + // bindInfoCount + // pBindInfo + std::stringstream stream_pbind_info; + std::string pbind_info_array = "NULL"; + PointerPairContainerGetPointer()), decltype(pBindInfo->GetMetaStructPointer())> + pbind_info_pair{ pBindInfo->GetPointer(), pBindInfo->GetMetaStructPointer(), bindInfoCount }; + std::string pbind_info_names = toStringJoin( + pbind_info_pair.begin(), + pbind_info_pair.end(), + [&](auto pair) { + { + return GenerateStruct_VkBindSparseInfo( + stream_pbind_info, pair.t1, pair.t2, imported_semaphores_, *this); + } + }, + ", "); + if (stream_pbind_info.str().length() > 0) + { + fprintf(file, "%s", stream_pbind_info.str().c_str()); + if (bindInfoCount == 1) + { + pbind_info_array = "&" + pbind_info_names; + } + else if (bindInfoCount > 1) + { + pbind_info_array = "bind_info_" + std::to_string(this->GetNextId()); + fprintf(file, "\t\tVkBindSparseInfo %s[] = { %s };\n", pbind_info_array.c_str(), pbind_info_names.c_str()); + } + } + // fence + fprintf(file, + "\t\tVK_CALL_CHECK(vkQueueBindSparse(%s, %u, %s, %s), %s);\n", + this->GetHandle(queue).c_str(), + bindInfoCount, + pbind_info_array.c_str(), + this->GetHandle(fence).c_str(), + util::ToString(returnValue).c_str()); + fprintf(file, "\t}\n"); +} + +void VulkanCppConsumerBase::Generate_vkQueuePresentKHR(VkResult returnValue, + format::HandleId queue, + StructPointerDecoder* pPresentInfo) +{ + FILE* file = GetFrameFile(); + fprintf(file, "\t{\n"); + // queue + // pPresentInfo + std::stringstream stream_ppresent_info; + std::string ppresent_info_struct = GenerateStruct_VkPresentInfoKHR(stream_ppresent_info, + pPresentInfo->GetPointer(), + pPresentInfo->GetMetaStructPointer(), + imported_semaphores_, + *this); + fprintf(file, "%s", stream_ppresent_info.str().c_str()); + pfn_loader_.AddMethodName("vkQueuePresentKHR"); + fprintf(file, + "\t\tVK_CALL_CHECK(loaded_vkQueuePresentKHR(%s, &%s), %s);\n", + this->GetHandle(queue).c_str(), + ppresent_info_struct.c_str(), + util::ToString(returnValue).c_str()); + fprintf(file, "\t}\n"); +} + void VulkanCppConsumerBase::ProcessDestroyHardwareBufferCommand(uint64_t buffer_id) { if (android_buffer_id_map_.find(buffer_id) != android_buffer_id_map_.end()) diff --git a/framework/decode/vulkan_cpp_consumer_base.h b/framework/decode/vulkan_cpp_consumer_base.h index f354cb4136..d522318826 100644 --- a/framework/decode/vulkan_cpp_consumer_base.h +++ b/framework/decode/vulkan_cpp_consumer_base.h @@ -393,6 +393,55 @@ class VulkanCppConsumerBase : public VulkanConsumer format::HandleId device, StructPointerDecoder* pInfo, PointerDecoder* pBuffer); + void Generate_vkGetSemaphoreWin32HandleKHR( + VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pGetWin32HandleInfo, + PointerDecoder* pHandle); + void Generate_vkImportSemaphoreWin32HandleKHR( + VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pImportSemaphoreWin32HandleInfo); + void Generate_vkGetSemaphoreFdKHR(VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pGetFdInfo, + PointerDecoder* pFd); + void + Generate_vkImportSemaphoreFdKHR(VkResult returnValue, + format::HandleId device, + StructPointerDecoder* pImportSemaphoreFdInfo); + + void Generate_vkQueueSubmit(VkResult returnValue, + format::HandleId queue, + uint32_t submitCount, + StructPointerDecoder* pSubmits, + format::HandleId fence); + + void Generate_vkQueueSubmit2(VkResult returnValue, + format::HandleId queue, + uint32_t submitCount, + StructPointerDecoder* pSubmits, + format::HandleId fence, + const char* extension = ""); + + void Generate_vkQueueSubmit2KHR(VkResult returnValue, + format::HandleId queue, + uint32_t submitCount, + StructPointerDecoder* pSubmits, + format::HandleId fence) + { + Generate_vkQueueSubmit2(returnValue, queue, submitCount, pSubmits, fence, "KHR"); + } + + void Generate_vkQueueBindSparse(VkResult returnValue, + format::HandleId queue, + uint32_t bindInfoCount, + StructPointerDecoder* pBindInfo, + format::HandleId fence); + + void Generate_vkQueuePresentKHR(VkResult returnValue, + format::HandleId queue, + StructPointerDecoder* pPresentInfo); // Intercept commands that perform additional work prior to the standard code generation void Intercept_vkCreateDevice(VkResult returnValue, @@ -417,6 +466,10 @@ class VulkanCppConsumerBase : public VulkanConsumer StructPointerDecoder* pRenderPassBegin, VkSubpassContents contents); + void Intercept_vkDestroySemaphore(format::HandleId device, + format::HandleId semaphore, + StructPointerDecoder* pAllocator); + // Complete manual process functions void Process_vkCreateRayTracingPipelinesKHR( const ApiCallInfo& call_info, @@ -587,6 +640,7 @@ class VulkanCppConsumerBase : public VulkanConsumer uint32_t window_height_; uint32_t max_command_limit_{ 1000 }; std::vector variable_data_; + std::vector imported_semaphores_; std::map descriptor_update_template_entry_map_; std::map>> memory_resource_map_; std::map resource_memory_req_map_; diff --git a/framework/decode/vulkan_cpp_resource_tracker.cpp b/framework/decode/vulkan_cpp_resource_tracker.cpp index c995aec805..bbf7e8ab49 100644 --- a/framework/decode/vulkan_cpp_resource_tracker.cpp +++ b/framework/decode/vulkan_cpp_resource_tracker.cpp @@ -40,17 +40,5 @@ void VulkanCppResourceTracker::AddHandleUsage(uint32_t frame_numb } } -void VulkanCppResourceTracker::CalculateGlobalVariables() -{ - for (const auto& handle_id_usage : handle_id_usage_map_) - { - // If the resource is used in more than a single frame then it's global - uint32_t size = handle_id_usage.second.size(); - bool is_global = size > 1; - - global_variable_map_[handle_id_usage.first] = is_global; - } -} - GFXRECON_END_NAMESPACE(decode) GFXRECON_END_NAMESPACE(gfxrecon) \ No newline at end of file diff --git a/framework/decode/vulkan_cpp_resource_tracker.h b/framework/decode/vulkan_cpp_resource_tracker.h index 61623211d7..95e082678c 100644 --- a/framework/decode/vulkan_cpp_resource_tracker.h +++ b/framework/decode/vulkan_cpp_resource_tracker.h @@ -47,7 +47,8 @@ struct FrameIdHasher { // With a 32-bit frame and split number, we can easily just output a 64-bit "hash" which is just both // numbers bit-shifted giving a unique value instead of doing an actual 32-bit hash on each number. - return (static_cast(frameId.frame_split) << 32) | (static_cast(frameId.frame_number) & 0x00000000FFFFFFFF); + return (static_cast(frameId.frame_split) << 32) | + (static_cast(frameId.frame_number) & 0x00000000FFFFFFFF); } }; @@ -73,17 +74,9 @@ class VulkanCppResourceTracker } } - void CalculateGlobalVariables(); - - bool IsGlobalVariable(format::HandleId handleId) - { - return true; - } // return global_variable_map_[handleId]; } // Brainpain - private: // HandleId -> (frame_number, frame_split) std::map> handle_id_usage_map_; - std::map global_variable_map_; }; GFXRECON_END_NAMESPACE(decode) diff --git a/framework/decode/vulkan_cpp_structs.cpp b/framework/decode/vulkan_cpp_structs.cpp index 2de4555ff1..1e0e302f93 100644 --- a/framework/decode/vulkan_cpp_structs.cpp +++ b/framework/decode/vulkan_cpp_structs.cpp @@ -191,10 +191,429 @@ std::string GenerateStruct_VkWriteDescriptorSet(std::ostream& ou return variable_name; } -std::string GenerateStruct_VkPresentInfoKHR(std::ostream& out, - const VkPresentInfoKHR* structInfo, - Decoded_VkPresentInfoKHR* metaInfo, - VulkanCppConsumerBase& consumer) +// At replay time, there will be no external semaphores, so remove any external +// semaphores that have been imported from the list during replay. +void StripImportedSemaphores(std::ostream& out, + uint32_t& count, + const format::HandleId* semaphore_array, + const VkPipelineStageFlags* wait_flags, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer, + std::string& semaphore_array_name, + std::string* wait_flags_array_name) +{ + // Start by setting the arrays to NULL. This is the fallback in case there are either + // no semaphores passed in, or they are all imported. + semaphore_array_name = "NULL"; + if (wait_flags_array_name != nullptr) + { + *wait_flags_array_name = "NULL"; + } + + if (semaphore_array != nullptr && count > 0) + { + uint32_t new_count = 0; + bool update_wait_flags = (wait_flags != nullptr && wait_flags_array_name != nullptr); + + std::stringstream semaphore_handle_stream; + std::string wait_dst_flags_values; + for (uint32_t sem = 0; sem < count; ++sem) + { + // Check each semaphore, if it is not found in the imported array, add it to the list + // of final semaphores. + const format::HandleId current = semaphore_array[sem]; + auto it = std::find(imported_semaphores.begin(), imported_semaphores.end(), current); + if (it == imported_semaphores.end()) + { + semaphore_handle_stream << consumer.GetHandle(current) << ", "; + new_count++; + + // Add the Wait Destination target flags if present for this semaphore as well. + if (update_wait_flags) + { + wait_dst_flags_values += util::ToString(wait_flags[sem]) + ", "; + } + } + } + + // Create the array of semaphores for use by the code following this removal call. + if (new_count > 0) + { + semaphore_array_name = "semaphores_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_SEMAPHORE)); + out << "\t\t" + << "VkSemaphore " << semaphore_array_name << "[] = {" << semaphore_handle_stream.str() << "};" + << std::endl; + if (update_wait_flags) + { + *wait_flags_array_name = "dst_stg_masks_" + std::to_string(consumer.GetNextId()); + out << "\t\t" + << "VkPipelineStageFlags " << *wait_flags_array_name << "[] = {" << wait_dst_flags_values << "};" + << std::endl; + } + } + count = new_count; + } +} + +// At replay time, there will be no external semaphores, so remove any external +// SemaphoreInfo for semaphores that have been imported from the list during replay. +void StripImportedSemaphoreInfos(std::ostream& out, + uint32_t& count, + const VkSemaphoreSubmitInfo* semaphore_info_array, + Decoded_VkSemaphoreSubmitInfo* semaphore_info_meta, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer, + std::string& semaphore_info_array_name) +{ + // Start by setting the array to NULL. This is the fallback in case there are either + // no semaphores passed in, or they are all imported. + semaphore_info_array_name = "NULL"; + + if (count > 0 && semaphore_info_array != nullptr && semaphore_info_meta != nullptr) + { + uint32_t new_count = 0; + std::string variable_name_array_values; + + for (uint32_t sem = 0; sem < count; ++sem) + { + // Check each semaphore, if it is not found in the imported array, add it to the list + // of final semaphores. + std::string variable_name = "NULL"; + const format::HandleId current = semaphore_info_meta[sem].semaphore; + auto it = std::find(imported_semaphores.begin(), imported_semaphores.end(), current); + if (it == imported_semaphores.end()) + { + variable_name = GenerateStruct_VkSemaphoreSubmitInfo( + out, semaphore_info_array + sem, semaphore_info_meta + sem, consumer); + variable_name_array_values += variable_name + ", "; + new_count++; + } + } + + // Create the array of semaphores for use by the code following this removal call. + if (new_count > 0) + { + semaphore_info_array_name = + "semaphores_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_SEMAPHORE)); + + out << "\t\t" + << "VkSemaphoreSubmitInfo " << semaphore_info_array_name << "[] = {" << variable_name_array_values + << "};" << std::endl; + } + count = new_count; + } +} + +std::string GenerateStruct_VkSubmitInfo(std::ostream& out, + const VkSubmitInfo* structInfo, + Decoded_VkSubmitInfo* metaInfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer) +{ + std::stringstream struct_body; + std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); + + std::string wait_semaphores_array_name = "NULL"; + std::string wait_dst_stage_mask_array_name = "NULL"; + std::string signal_semaphores_array_name = "NULL"; + uint32_t wait_semaphores_count = structInfo->waitSemaphoreCount; + uint32_t signal_semaphores_count = structInfo->signalSemaphoreCount; + if (metaInfo->pWaitSemaphores.GetPointer() != NULL && structInfo->waitSemaphoreCount > 0) + { + StripImportedSemaphores(out, + wait_semaphores_count, + metaInfo->pWaitSemaphores.GetPointer(), + structInfo->pWaitDstStageMask, + imported_semaphores, + consumer, + wait_semaphores_array_name, + &wait_dst_stage_mask_array_name); + } + if (metaInfo->pSignalSemaphores.GetPointer() != NULL && structInfo->signalSemaphoreCount > 0) + { + StripImportedSemaphores(out, + signal_semaphores_count, + metaInfo->pSignalSemaphores.GetPointer(), + nullptr, + imported_semaphores, + consumer, + signal_semaphores_array_name, + nullptr); + } + + std::string command_buffers_array = "NULL"; + if (metaInfo->pCommandBuffers.GetPointer() != NULL && structInfo->commandBufferCount > 0) + { + command_buffers_array = + "command_buffers_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_COMMAND_BUFFER)); + std::string command_buffers_values = toStringJoin( + metaInfo->pCommandBuffers.GetPointer(), + metaInfo->pCommandBuffers.GetPointer() + structInfo->commandBufferCount, + [&](const format::HandleId current) { return consumer.GetHandle(current); }, + ", "); + if (structInfo->commandBufferCount > 0) + { + out << "\t\t" + << "VkCommandBuffer " << command_buffers_array << "[] = {" << command_buffers_values << "};" + << std::endl; + } + } + // sType + struct_body << "\t" + << "VkStructureType(" << structInfo->sType << ")" + << "," << std::endl; + // pNext + struct_body << "\t\t\t" << pnext_name << "," << std::endl; + // waitSemaphoreCount + struct_body << "\t\t\t" << wait_semaphores_count << "," << std::endl; + // pWaitSemaphores + struct_body << "\t\t\t" << wait_semaphores_array_name << "," << std::endl; + // pWaitDstStageMask + struct_body << "\t\t\t" << wait_dst_stage_mask_array_name << "," << std::endl; + // commandBufferCount + struct_body << "\t\t\t" << structInfo->commandBufferCount << "," << std::endl; + // pCommandBuffers + struct_body << "\t\t\t" << command_buffers_array << "," << std::endl; + // signalSemaphoreCount + struct_body << "\t\t\t" << signal_semaphores_count << "," << std::endl; + // pSignalSemaphores + struct_body << "\t\t\t" << signal_semaphores_array_name << ","; + std::string variable_name = consumer.AddStruct(struct_body, "submitInfo"); + out << "\t\t" + << "VkSubmitInfo " << variable_name << " {" << std::endl; + out << "\t\t" << struct_body.str() << std::endl; + out << "\t\t" + << "};" << std::endl; + return variable_name; +} + +std::string GenerateStruct_VkSubmitInfo2(std::ostream& out, + const VkSubmitInfo2* structInfo, + Decoded_VkSubmitInfo2* metaInfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer) +{ + std::stringstream struct_body; + std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); + std::string wait_semaphore_infos_array_name = "NULL"; + std::string signal_semaphore_infos_array_name = "NULL"; + uint32_t wait_semaphore_infos_count = structInfo->waitSemaphoreInfoCount; + uint32_t signal_semaphore_infos_count = structInfo->signalSemaphoreInfoCount; + if (structInfo->pWaitSemaphoreInfos != NULL) + { + StripImportedSemaphoreInfos(out, + wait_semaphore_infos_count, + structInfo->pWaitSemaphoreInfos, + metaInfo->pWaitSemaphoreInfos->GetMetaStructPointer(), + imported_semaphores, + consumer, + wait_semaphore_infos_array_name); + } + if (structInfo->pSignalSemaphoreInfos != NULL) + { + StripImportedSemaphoreInfos(out, + signal_semaphore_infos_count, + structInfo->pSignalSemaphoreInfos, + metaInfo->pSignalSemaphoreInfos->GetMetaStructPointer(), + imported_semaphores, + consumer, + signal_semaphore_infos_array_name); + } + + std::string command_buffer_infos_array = "NULL"; + if (structInfo->pCommandBufferInfos != NULL) + { + command_buffer_infos_array = "cmd_buffer_infos_" + std::to_string(consumer.GetNextId()); + std::string command_buffer_infos_names; + for (uint32_t idx = 0; idx < structInfo->commandBufferInfoCount; idx++) + { + std::string variable_name = "NULL"; + if (structInfo->pCommandBufferInfos + idx != NULL) + { + variable_name = GenerateStruct_VkCommandBufferSubmitInfo( + out, + structInfo->pCommandBufferInfos + idx, + metaInfo->pCommandBufferInfos->GetMetaStructPointer() + idx, + consumer); + } + command_buffer_infos_names += variable_name + ", "; + } + out << "\t\t" + << "VkCommandBufferSubmitInfo " << command_buffer_infos_array << "[] = {" << command_buffer_infos_names + << "};" << std::endl; + } + + // sType + struct_body << "\t" + << "VkStructureType(" << structInfo->sType << ")" + << "," << std::endl; + // pNext + struct_body << "\t\t\t" << pnext_name << "," << std::endl; + // flags + struct_body << "\t\t\t" + << "VkSubmitFlags(" << structInfo->flags << ")" + << "," << std::endl; + // waitSemaphoreInfoCount + struct_body << "\t\t\t" << structInfo->waitSemaphoreInfoCount << "," << std::endl; + // pWaitSemaphoreInfos + struct_body << "\t\t\t" << wait_semaphore_infos_array_name << "," << std::endl; + // commandBufferInfoCount + struct_body << "\t\t\t" << wait_semaphore_infos_count << "," << std::endl; + // pCommandBufferInfos + struct_body << "\t\t\t" << command_buffer_infos_array << "," << std::endl; + // signalSemaphoreInfoCount + struct_body << "\t\t\t" << structInfo->signalSemaphoreInfoCount << "," << std::endl; + // pSignalSemaphoreInfos + struct_body << "\t\t\t" << signal_semaphore_infos_array_name << ","; + std::string variable_name = consumer.AddStruct(struct_body, "submitInfo2"); + out << "\t\t" + << "VkSubmitInfo2 " << variable_name << " {" << std::endl; + out << "\t\t" << struct_body.str() << std::endl; + out << "\t\t" + << "};" << std::endl; + return variable_name; +} + +std::string GenerateStruct_VkBindSparseInfo(std::ostream& out, + const VkBindSparseInfo* structInfo, + Decoded_VkBindSparseInfo* metaInfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer) +{ + std::stringstream struct_body; + std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); + + std::string wait_semaphores_array_name = "NULL"; + uint32_t wait_semaphores_count = structInfo->waitSemaphoreCount; + std::string signal_semaphores_array_name = "NULL"; + uint32_t signal_semaphores_count = structInfo->signalSemaphoreCount; + if (metaInfo->pWaitSemaphores.GetPointer() != NULL && structInfo->waitSemaphoreCount > 0) + { + StripImportedSemaphores(out, + wait_semaphores_count, + metaInfo->pWaitSemaphores.GetPointer(), + nullptr, + imported_semaphores, + consumer, + wait_semaphores_array_name, + nullptr); + } + if (metaInfo->pSignalSemaphores.GetPointer() != NULL && structInfo->signalSemaphoreCount > 0) + { + StripImportedSemaphores(out, + signal_semaphores_count, + metaInfo->pSignalSemaphores.GetPointer(), + nullptr, + imported_semaphores, + consumer, + signal_semaphores_array_name, + nullptr); + } + + std::string buffer_binds_array = "NULL"; + if (structInfo->pBufferBinds != NULL) + { + buffer_binds_array = "buffer_binds_" + std::to_string(consumer.GetNextId()); + std::string buffer_binds_names; + for (uint32_t idx = 0; idx < structInfo->bufferBindCount; idx++) + { + std::string variable_name = "NULL"; + if (structInfo->pBufferBinds + idx != NULL) + { + variable_name = + GenerateStruct_VkSparseBufferMemoryBindInfo(out, + structInfo->pBufferBinds + idx, + metaInfo->pBufferBinds->GetMetaStructPointer() + idx, + consumer); + } + buffer_binds_names += variable_name + ", "; + } + out << "\t\t" + << "VkSparseBufferMemoryBindInfo " << buffer_binds_array << "[] = {" << buffer_binds_names << "};" + << std::endl; + } + std::string image_opaque_binds_array = "NULL"; + if (structInfo->pImageOpaqueBinds != NULL) + { + image_opaque_binds_array = "image_opaque_binds_" + std::to_string(consumer.GetNextId()); + std::string image_opaque_binds_names; + for (uint32_t idx = 0; idx < structInfo->imageOpaqueBindCount; idx++) + { + std::string variable_name = "NULL"; + if (structInfo->pImageOpaqueBinds + idx != NULL) + { + variable_name = GenerateStruct_VkSparseImageOpaqueMemoryBindInfo( + out, + structInfo->pImageOpaqueBinds + idx, + metaInfo->pImageOpaqueBinds->GetMetaStructPointer() + idx, + consumer); + } + image_opaque_binds_names += variable_name + ", "; + } + out << "\t\t" + << "VkSparseImageOpaqueMemoryBindInfo " << image_opaque_binds_array << "[] = {" << image_opaque_binds_names + << "};" << std::endl; + } + std::string image_binds_array = "NULL"; + if (structInfo->pImageBinds != NULL) + { + image_binds_array = "pImageBinds_" + std::to_string(consumer.GetNextId()); + std::string image_binds_names; + for (uint32_t idx = 0; idx < structInfo->imageBindCount; idx++) + { + std::string variable_name = "NULL"; + if (structInfo->pImageBinds + idx != NULL) + { + variable_name = GenerateStruct_VkSparseImageMemoryBindInfo( + out, structInfo->pImageBinds + idx, metaInfo->pImageBinds->GetMetaStructPointer() + idx, consumer); + } + image_binds_names += variable_name + ", "; + } + out << "\t\t" + << "VkSparseImageMemoryBindInfo " << image_binds_array << "[] = {" << image_binds_names << "};" + << std::endl; + } + + // sType + struct_body << "\t" + << "VkStructureType(" << structInfo->sType << ")" + << "," << std::endl; + // pNext + struct_body << "\t\t\t" << pnext_name << "," << std::endl; + // waitSemaphoreCount + struct_body << "\t\t\t" << wait_semaphores_count << "," << std::endl; + // pWaitSemaphores + struct_body << "\t\t\t" << wait_semaphores_array_name << "," << std::endl; + // bufferBindCount + struct_body << "\t\t\t" << structInfo->bufferBindCount << "," << std::endl; + // pBufferBinds + struct_body << "\t\t\t" << buffer_binds_array << "," << std::endl; + // imageOpaqueBindCount + struct_body << "\t\t\t" << structInfo->imageOpaqueBindCount << "," << std::endl; + // pImageOpaqueBinds + struct_body << "\t\t\t" << image_opaque_binds_array << "," << std::endl; + // imageBindCount + struct_body << "\t\t\t" << structInfo->imageBindCount << "," << std::endl; + // pImageBinds + struct_body << "\t\t\t" << image_binds_array << "," << std::endl; + // signalSemaphoreCount + struct_body << "\t\t\t" << signal_semaphores_count << "," << std::endl; + // pSignalSemaphores + struct_body << "\t\t\t" << signal_semaphores_array_name << ","; + std::string variable_name = consumer.AddStruct(struct_body, "bindSparseInfo"); + out << "\t\t" + << "VkBindSparseInfo " << variable_name << " {" << std::endl; + out << "\t\t" << struct_body.str() << std::endl; + out << "\t\t" + << "};" << std::endl; + return variable_name; +} + +std::string GenerateStruct_VkPresentInfoKHR(std::ostream& out, + const VkPresentInfoKHR* structInfo, + Decoded_VkPresentInfoKHR* metaInfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer) { std::string image_array_indices = "NULL"; std::string swapchains_array = "NULL"; @@ -219,8 +638,8 @@ std::string GenerateStruct_VkPresentInfoKHR(std::ostream& out, } else if (structInfo->swapchainCount > 1) { - image_array_indices = "pImageIndices_" + std::to_string(consumer.GetNextId()); - swapchains_array = "pSwapchainsArray_" + std::to_string(consumer.GetNextId()); + image_array_indices = "image_indices_" + std::to_string(consumer.GetNextId()); + swapchains_array = "swapchains_array_" + std::to_string(consumer.GetNextId()); out << "\t\tVkSwapchainKHR " << swapchains_array << "[] = {" << swapchain_handle_values << "};" << std::endl; @@ -233,26 +652,17 @@ std::string GenerateStruct_VkPresentInfoKHR(std::ostream& out, } std::string wait_semaphore_array_string = "NULL"; - if (metaInfo->pWaitSemaphores.GetPointer() != NULL) + uint32_t wait_semaphores_count = structInfo->waitSemaphoreCount; + if (metaInfo->pWaitSemaphores.GetPointer() != NULL && structInfo->waitSemaphoreCount > 0) { - const format::HandleId* wait_semaphore_array = metaInfo->pWaitSemaphores.GetPointer(); - std::string wait_semaphore_values = toStringJoin( - wait_semaphore_array, - wait_semaphore_array + structInfo->waitSemaphoreCount, - [&](const format::HandleId current) { return consumer.GetHandle(current); }, - ", "); - - if (structInfo->waitSemaphoreCount == 1) - { - wait_semaphore_array_string = "&" + wait_semaphore_values; - } - else if (structInfo->waitSemaphoreCount > 1) - { - wait_semaphore_array_string = "pWaitSemaphoresArray_" + std::to_string(consumer.GetNextId()); - - out << "\t\tVkSemaphore " << wait_semaphore_array_string << "[] = {" << wait_semaphore_values << "};" - << std::endl; - } + StripImportedSemaphores(out, + wait_semaphores_count, + metaInfo->pWaitSemaphores.GetPointer(), + nullptr, + imported_semaphores, + consumer, + wait_semaphore_array_string, + nullptr); } std::stringstream struct_body; @@ -262,7 +672,7 @@ std::string GenerateStruct_VkPresentInfoKHR(std::ostream& out, // pNext std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); struct_body << "\t\t\t" << pnext_name << "," << std::endl; - struct_body << "\t\t\t" << structInfo->waitSemaphoreCount << "," << std::endl; + struct_body << "\t\t\t" << wait_semaphores_count << "," << std::endl; struct_body << "\t\t\t" << wait_semaphore_array_string << "," << std::endl; struct_body << "\t\t\t" << structInfo->swapchainCount << "," << std::endl; struct_body << "\t\t\t" << swapchains_array << "," << std::endl; diff --git a/framework/decode/vulkan_cpp_structs.h b/framework/decode/vulkan_cpp_structs.h index 3e26aa5b03..8fa6cf58d2 100644 --- a/framework/decode/vulkan_cpp_structs.h +++ b/framework/decode/vulkan_cpp_structs.h @@ -45,10 +45,27 @@ std::string GenerateStruct_VkWriteDescriptorSet(std::ostream& ou Decoded_VkWriteDescriptorSet* metaInfo, VulkanCppConsumerBase& consumer); -std::string GenerateStruct_VkPresentInfoKHR(std::ostream& out, - const VkPresentInfoKHR* structInfo, - Decoded_VkPresentInfoKHR* metainfo, - VulkanCppConsumerBase& consumer); +std::string GenerateStruct_VkSubmitInfo(std::ostream& out, + const VkSubmitInfo* structInfo, + Decoded_VkSubmitInfo* metaInfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer); +std::string GenerateStruct_VkSubmitInfo2(std::ostream& out, + const VkSubmitInfo2* structInfo, + Decoded_VkSubmitInfo2* metaInfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer); +std::string GenerateStruct_VkBindSparseInfo(std::ostream& out, + const VkBindSparseInfo* structInfo, + Decoded_VkBindSparseInfo* metaInfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer); + +std::string GenerateStruct_VkPresentInfoKHR(std::ostream& out, + const VkPresentInfoKHR* structInfo, + Decoded_VkPresentInfoKHR* metainfo, + const std::vector& imported_semaphores, + VulkanCppConsumerBase& consumer); std::string GenerateStruct_VkDescriptorUpdateTemplateCreateInfoKHR(std::ostream& out, diff --git a/framework/decode/vulkan_cpp_template_strings.h b/framework/decode/vulkan_cpp_template_strings.h index f52c1cdb38..9a1de0bd93 100644 --- a/framework/decode/vulkan_cpp_template_strings.h +++ b/framework/decode/vulkan_cpp_template_strings.h @@ -54,7 +54,6 @@ static const char* sCommonFrameSourceHeader = R"( #include "global_var.h" #include "loader.h" #include "vulkan/vulkan.h" -#include )"; static const char* sCommonFrameSourceFooter = R"( diff --git a/framework/decode/vulkan_cpp_util_datapack.h b/framework/decode/vulkan_cpp_util_datapack.h index cfcd5b6e52..1bfc1054bf 100644 --- a/framework/decode/vulkan_cpp_util_datapack.h +++ b/framework/decode/vulkan_cpp_util_datapack.h @@ -18,7 +18,6 @@ #ifndef GFXRECON_DECODE_VULKAN_CPP_UTIL_DATAPACK_H #define GFXRECON_DECODE_VULKAN_CPP_UTIL_DATAPACK_H -// #include // Brainpain #include #include diff --git a/framework/generated/generated_vulkan_cpp_consumer.cpp b/framework/generated/generated_vulkan_cpp_consumer.cpp index d4931e2be6..73410847eb 100644 --- a/framework/generated/generated_vulkan_cpp_consumer.cpp +++ b/framework/generated/generated_vulkan_cpp_consumer.cpp @@ -2728,6 +2728,7 @@ void VulkanCppConsumer::Process_vkDestroySemaphore( format::HandleId semaphore, StructPointerDecoder* pAllocator) { + Intercept_vkDestroySemaphore(device, semaphore, pAllocator); FILE* file = GetFrameFile(); fprintf(file, "\t{\n"); // device @@ -3386,36 +3387,7 @@ void VulkanCppConsumer::Process_vkQueueBindSparse( StructPointerDecoder* pBindInfo, format::HandleId fence) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// queue -// bindInfoCount -// pBindInfo - std::stringstream stream_pbind_info; - std::string pbind_info_array = "NULL"; - PointerPairContainerGetPointer()), decltype(pBindInfo->GetMetaStructPointer())> pbind_info_pair{ pBindInfo->GetPointer(), pBindInfo->GetMetaStructPointer(), bindInfoCount }; - std::string pbind_info_names = toStringJoin(pbind_info_pair.begin(), - pbind_info_pair.end(), - [&](auto pair) {{ return GenerateStruct_VkBindSparseInfo(stream_pbind_info, pair.t1, pair.t2, *this); }}, - ", "); - if (stream_pbind_info.str().length() > 0) { - fprintf(file, "%s", stream_pbind_info.str().c_str()); - if (bindInfoCount == 1) { - pbind_info_array = "&" + pbind_info_names; - } else if (bindInfoCount > 1) { - pbind_info_array = "pBindInfo_" + std::to_string(this->GetNextId()); - fprintf(file, "\t\tVkBindSparseInfo %s[] = { %s };\n", pbind_info_array.c_str(), pbind_info_names.c_str()); - } - } -// fence - fprintf(file, - "\t\tVK_CALL_CHECK(vkQueueBindSparse(%s, %u, %s, %s), %s);\n", - this->GetHandle(queue).c_str(), - bindInfoCount, - pbind_info_array.c_str(), - this->GetHandle(fence).c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkQueueBindSparse(returnValue, queue, bindInfoCount, pBindInfo, fence); Post_APICall(format::ApiCallId::ApiCall_vkQueueBindSparse); } @@ -3427,36 +3399,7 @@ void VulkanCppConsumer::Process_vkQueueSubmit( StructPointerDecoder* pSubmits, format::HandleId fence) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// queue -// submitCount -// pSubmits - std::stringstream stream_psubmits; - std::string psubmits_array = "NULL"; - PointerPairContainerGetPointer()), decltype(pSubmits->GetMetaStructPointer())> psubmits_pair{ pSubmits->GetPointer(), pSubmits->GetMetaStructPointer(), submitCount }; - std::string psubmits_names = toStringJoin(psubmits_pair.begin(), - psubmits_pair.end(), - [&](auto pair) {{ return GenerateStruct_VkSubmitInfo(stream_psubmits, pair.t1, pair.t2, *this); }}, - ", "); - if (stream_psubmits.str().length() > 0) { - fprintf(file, "%s", stream_psubmits.str().c_str()); - if (submitCount == 1) { - psubmits_array = "&" + psubmits_names; - } else if (submitCount > 1) { - psubmits_array = "pSubmits_" + std::to_string(this->GetNextId()); - fprintf(file, "\t\tVkSubmitInfo %s[] = { %s };\n", psubmits_array.c_str(), psubmits_names.c_str()); - } - } -// fence - fprintf(file, - "\t\tVK_CALL_CHECK(vkQueueSubmit(%s, %u, %s, %s), %s);\n", - this->GetHandle(queue).c_str(), - submitCount, - psubmits_array.c_str(), - this->GetHandle(fence).c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkQueueSubmit(returnValue, queue, submitCount, pSubmits, fence); Post_APICall(format::ApiCallId::ApiCall_vkQueueSubmit); } @@ -5667,36 +5610,7 @@ void VulkanCppConsumer::Process_vkQueueSubmit2( StructPointerDecoder* pSubmits, format::HandleId fence) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// queue -// submitCount -// pSubmits - std::stringstream stream_psubmits; - std::string psubmits_array = "NULL"; - PointerPairContainerGetPointer()), decltype(pSubmits->GetMetaStructPointer())> psubmits_pair{ pSubmits->GetPointer(), pSubmits->GetMetaStructPointer(), submitCount }; - std::string psubmits_names = toStringJoin(psubmits_pair.begin(), - psubmits_pair.end(), - [&](auto pair) {{ return GenerateStruct_VkSubmitInfo2(stream_psubmits, pair.t1, pair.t2, *this); }}, - ", "); - if (stream_psubmits.str().length() > 0) { - fprintf(file, "%s", stream_psubmits.str().c_str()); - if (submitCount == 1) { - psubmits_array = "&" + psubmits_names; - } else if (submitCount > 1) { - psubmits_array = "pSubmits_" + std::to_string(this->GetNextId()); - fprintf(file, "\t\tVkSubmitInfo2 %s[] = { %s };\n", psubmits_array.c_str(), psubmits_names.c_str()); - } - } -// fence - fprintf(file, - "\t\tVK_CALL_CHECK(vkQueueSubmit2(%s, %u, %s, %s), %s);\n", - this->GetHandle(queue).c_str(), - submitCount, - psubmits_array.c_str(), - this->GetHandle(fence).c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkQueueSubmit2(returnValue, queue, submitCount, pSubmits, fence); Post_APICall(format::ApiCallId::ApiCall_vkQueueSubmit2); } @@ -6010,23 +5924,7 @@ void VulkanCppConsumer::Process_vkQueuePresentKHR( format::HandleId queue, StructPointerDecoder* pPresentInfo) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// queue -// pPresentInfo - std::stringstream stream_ppresent_info; - std::string ppresent_info_struct = GenerateStruct_VkPresentInfoKHR(stream_ppresent_info, - pPresentInfo->GetPointer(), - pPresentInfo->GetMetaStructPointer(), - *this); - fprintf(file, "%s", stream_ppresent_info.str().c_str()); - pfn_loader_.AddMethodName("vkQueuePresentKHR"); - fprintf(file, - "\t\tVK_CALL_CHECK(loaded_vkQueuePresentKHR(%s, &%s), %s);\n", - this->GetHandle(queue).c_str(), - ppresent_info_struct.c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkQueuePresentKHR(returnValue, queue, pPresentInfo); Post_APICall(format::ApiCallId::ApiCall_vkQueuePresentKHR); } void VulkanCppConsumer::Process_vkCreateDisplayModeKHR( @@ -7417,27 +7315,7 @@ void VulkanCppConsumer::Process_vkGetSemaphoreWin32HandleKHR( StructPointerDecoder* pGetWin32HandleInfo, PointerDecoder* pHandle) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// device -// pGetWin32HandleInfo - std::stringstream stream_pget_win32_handle_info; - std::string pget_win32_handle_info_struct = GenerateStruct_VkSemaphoreGetWin32HandleInfoKHR(stream_pget_win32_handle_info, - pGetWin32HandleInfo->GetPointer(), - pGetWin32HandleInfo->GetMetaStructPointer(), - *this); - fprintf(file, "%s", stream_pget_win32_handle_info.str().c_str()); -// pHandle - std::string phandle_name = "pHandle_" + std::to_string(this->GetNextId()); - fprintf(file, "\t\tuint8_t* %s;\n", phandle_name.c_str()); - pfn_loader_.AddMethodName("vkGetSemaphoreWin32HandleKHR"); - fprintf(file, - "\t\tVK_CALL_CHECK(loaded_vkGetSemaphoreWin32HandleKHR(%s, &%s, &%s), %s);\n", - this->GetHandle(device).c_str(), - pget_win32_handle_info_struct.c_str(), - phandle_name.c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkGetSemaphoreWin32HandleKHR(returnValue, device, pGetWin32HandleInfo, pHandle); Post_APICall(format::ApiCallId::ApiCall_vkGetSemaphoreWin32HandleKHR); } @@ -7447,23 +7325,7 @@ void VulkanCppConsumer::Process_vkImportSemaphoreWin32HandleKHR( format::HandleId device, StructPointerDecoder* pImportSemaphoreWin32HandleInfo) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// device -// pImportSemaphoreWin32HandleInfo - std::stringstream stream_pimport_semaphore_win32_handle_info; - std::string pimport_semaphore_win32_handle_info_struct = GenerateStruct_VkImportSemaphoreWin32HandleInfoKHR(stream_pimport_semaphore_win32_handle_info, - pImportSemaphoreWin32HandleInfo->GetPointer(), - pImportSemaphoreWin32HandleInfo->GetMetaStructPointer(), - *this); - fprintf(file, "%s", stream_pimport_semaphore_win32_handle_info.str().c_str()); - pfn_loader_.AddMethodName("vkImportSemaphoreWin32HandleKHR"); - fprintf(file, - "\t\tVK_CALL_CHECK(loaded_vkImportSemaphoreWin32HandleKHR(%s, &%s), %s);\n", - this->GetHandle(device).c_str(), - pimport_semaphore_win32_handle_info_struct.c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkImportSemaphoreWin32HandleKHR(returnValue, device, pImportSemaphoreWin32HandleInfo); Post_APICall(format::ApiCallId::ApiCall_vkImportSemaphoreWin32HandleKHR); } void VulkanCppConsumer::Process_vkGetSemaphoreFdKHR( @@ -7473,27 +7335,7 @@ void VulkanCppConsumer::Process_vkGetSemaphoreFdKHR( StructPointerDecoder* pGetFdInfo, PointerDecoder* pFd) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// device -// pGetFdInfo - std::stringstream stream_pget_fd_info; - std::string pget_fd_info_struct = GenerateStruct_VkSemaphoreGetFdInfoKHR(stream_pget_fd_info, - pGetFdInfo->GetPointer(), - pGetFdInfo->GetMetaStructPointer(), - *this); - fprintf(file, "%s", stream_pget_fd_info.str().c_str()); -// pFd - std::string pfd_name = "pFd_" + std::to_string(this->GetNextId()); - fprintf(file, "\t\tint %s;\n", pfd_name.c_str()); - pfn_loader_.AddMethodName("vkGetSemaphoreFdKHR"); - fprintf(file, - "\t\tVK_CALL_CHECK(loaded_vkGetSemaphoreFdKHR(%s, &%s, &%s), %s);\n", - this->GetHandle(device).c_str(), - pget_fd_info_struct.c_str(), - pfd_name.c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkGetSemaphoreFdKHR(returnValue, device, pGetFdInfo, pFd); Post_APICall(format::ApiCallId::ApiCall_vkGetSemaphoreFdKHR); } @@ -7503,23 +7345,7 @@ void VulkanCppConsumer::Process_vkImportSemaphoreFdKHR( format::HandleId device, StructPointerDecoder* pImportSemaphoreFdInfo) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// device -// pImportSemaphoreFdInfo - std::stringstream stream_pimport_semaphore_fd_info; - std::string pimport_semaphore_fd_info_struct = GenerateStruct_VkImportSemaphoreFdInfoKHR(stream_pimport_semaphore_fd_info, - pImportSemaphoreFdInfo->GetPointer(), - pImportSemaphoreFdInfo->GetMetaStructPointer(), - *this); - fprintf(file, "%s", stream_pimport_semaphore_fd_info.str().c_str()); - pfn_loader_.AddMethodName("vkImportSemaphoreFdKHR"); - fprintf(file, - "\t\tVK_CALL_CHECK(loaded_vkImportSemaphoreFdKHR(%s, &%s), %s);\n", - this->GetHandle(device).c_str(), - pimport_semaphore_fd_info_struct.c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkImportSemaphoreFdKHR(returnValue, device, pImportSemaphoreFdInfo); Post_APICall(format::ApiCallId::ApiCall_vkImportSemaphoreFdKHR); } void VulkanCppConsumer::Process_vkCmdPushDescriptorSetKHR( @@ -9351,37 +9177,7 @@ void VulkanCppConsumer::Process_vkQueueSubmit2KHR( StructPointerDecoder* pSubmits, format::HandleId fence) { - FILE* file = GetFrameFile(); - fprintf(file, "\t{\n"); -// queue -// submitCount -// pSubmits - std::stringstream stream_psubmits; - std::string psubmits_array = "NULL"; - PointerPairContainerGetPointer()), decltype(pSubmits->GetMetaStructPointer())> psubmits_pair{ pSubmits->GetPointer(), pSubmits->GetMetaStructPointer(), submitCount }; - std::string psubmits_names = toStringJoin(psubmits_pair.begin(), - psubmits_pair.end(), - [&](auto pair) {{ return GenerateStruct_VkSubmitInfo2(stream_psubmits, pair.t1, pair.t2, *this); }}, - ", "); - if (stream_psubmits.str().length() > 0) { - fprintf(file, "%s", stream_psubmits.str().c_str()); - if (submitCount == 1) { - psubmits_array = "&" + psubmits_names; - } else if (submitCount > 1) { - psubmits_array = "pSubmits_" + std::to_string(this->GetNextId()); - fprintf(file, "\t\tVkSubmitInfo2 %s[] = { %s };\n", psubmits_array.c_str(), psubmits_names.c_str()); - } - } -// fence - pfn_loader_.AddMethodName("vkQueueSubmit2KHR"); - fprintf(file, - "\t\tVK_CALL_CHECK(loaded_vkQueueSubmit2KHR(%s, %u, %s, %s), %s);\n", - this->GetHandle(queue).c_str(), - submitCount, - psubmits_array.c_str(), - this->GetHandle(fence).c_str(), - util::ToString(returnValue).c_str()); - fprintf(file, "\t}\n"); + Generate_vkQueueSubmit2KHR(returnValue, queue, submitCount, pSubmits, fence); Post_APICall(format::ApiCallId::ApiCall_vkQueueSubmit2KHR); } void VulkanCppConsumer::Process_vkCmdBlitImage2KHR( diff --git a/framework/generated/generated_vulkan_cpp_structs.cpp b/framework/generated/generated_vulkan_cpp_structs.cpp index 41edf74443..599dca8151 100644 --- a/framework/generated/generated_vulkan_cpp_structs.cpp +++ b/framework/generated/generated_vulkan_cpp_structs.cpp @@ -2165,115 +2165,6 @@ std::string GenerateStruct_VkAttachmentReference(std::ostream &out, const VkAtta } -std::string GenerateStruct_VkBindSparseInfo(std::ostream &out, const VkBindSparseInfo* structInfo, Decoded_VkBindSparseInfo* metaInfo, VulkanCppConsumerBase &consumer){ - std::stringstream struct_body; - std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); - std::string pwait_semaphores_array = "NULL"; - if (metaInfo->pWaitSemaphores.GetPointer() != NULL && structInfo->waitSemaphoreCount > 0) { - pwait_semaphores_array = "pwait_semaphores_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_SEMAPHORE)); - std::string pwait_semaphores_values = toStringJoin(metaInfo->pWaitSemaphores.GetPointer(), - metaInfo->pWaitSemaphores.GetPointer() + structInfo->waitSemaphoreCount, - [&](const format::HandleId current) { return consumer.GetHandle(current); }, - ", "); - if (structInfo->waitSemaphoreCount == 1) { - pwait_semaphores_array = "&" + pwait_semaphores_values; - } else if (structInfo->waitSemaphoreCount > 1) { - out << "\t\t" << "VkSemaphore " << pwait_semaphores_array << "[] = {" << pwait_semaphores_values << "};" << std::endl; - } - } - std::string pbuffer_binds_array = "NULL"; - if (structInfo->pBufferBinds != NULL) { - pbuffer_binds_array = "pBufferBinds_" + std::to_string(consumer.GetNextId()); - std::string pbuffer_binds_names; - for (uint32_t idx = 0; idx < structInfo->bufferBindCount; idx++) { - std::string variable_name = "NULL"; - if (structInfo->pBufferBinds + idx != NULL) { - variable_name = GenerateStruct_VkSparseBufferMemoryBindInfo(out, - structInfo->pBufferBinds + idx, - metaInfo->pBufferBinds->GetMetaStructPointer() + idx, - consumer); - } - pbuffer_binds_names += variable_name + ", "; - } - out << "\t\t" << "VkSparseBufferMemoryBindInfo " << pbuffer_binds_array << "[] = {" << pbuffer_binds_names << "};" << std::endl; - } - std::string pimage_opaque_binds_array = "NULL"; - if (structInfo->pImageOpaqueBinds != NULL) { - pimage_opaque_binds_array = "pImageOpaqueBinds_" + std::to_string(consumer.GetNextId()); - std::string pimage_opaque_binds_names; - for (uint32_t idx = 0; idx < structInfo->imageOpaqueBindCount; idx++) { - std::string variable_name = "NULL"; - if (structInfo->pImageOpaqueBinds + idx != NULL) { - variable_name = GenerateStruct_VkSparseImageOpaqueMemoryBindInfo(out, - structInfo->pImageOpaqueBinds + idx, - metaInfo->pImageOpaqueBinds->GetMetaStructPointer() + idx, - consumer); - } - pimage_opaque_binds_names += variable_name + ", "; - } - out << "\t\t" << "VkSparseImageOpaqueMemoryBindInfo " << pimage_opaque_binds_array << "[] = {" << pimage_opaque_binds_names << "};" << std::endl; - } - std::string pimage_binds_array = "NULL"; - if (structInfo->pImageBinds != NULL) { - pimage_binds_array = "pImageBinds_" + std::to_string(consumer.GetNextId()); - std::string pimage_binds_names; - for (uint32_t idx = 0; idx < structInfo->imageBindCount; idx++) { - std::string variable_name = "NULL"; - if (structInfo->pImageBinds + idx != NULL) { - variable_name = GenerateStruct_VkSparseImageMemoryBindInfo(out, - structInfo->pImageBinds + idx, - metaInfo->pImageBinds->GetMetaStructPointer() + idx, - consumer); - } - pimage_binds_names += variable_name + ", "; - } - out << "\t\t" << "VkSparseImageMemoryBindInfo " << pimage_binds_array << "[] = {" << pimage_binds_names << "};" << std::endl; - } - std::string psignal_semaphores_array = "NULL"; - if (metaInfo->pSignalSemaphores.GetPointer() != NULL && structInfo->signalSemaphoreCount > 0) { - psignal_semaphores_array = "psignal_semaphores_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_SEMAPHORE)); - std::string psignal_semaphores_values = toStringJoin(metaInfo->pSignalSemaphores.GetPointer(), - metaInfo->pSignalSemaphores.GetPointer() + structInfo->signalSemaphoreCount, - [&](const format::HandleId current) { return consumer.GetHandle(current); }, - ", "); - if (structInfo->signalSemaphoreCount == 1) { - psignal_semaphores_array = "&" + psignal_semaphores_values; - } else if (structInfo->signalSemaphoreCount > 1) { - out << "\t\t" << "VkSemaphore " << psignal_semaphores_array << "[] = {" << psignal_semaphores_values << "};" << std::endl; - } - } -// sType - struct_body << "\t" << "VkStructureType(" << structInfo->sType << ")" << "," << std::endl; -// pNext - struct_body << "\t\t\t" << pnext_name << "," << std::endl; -// waitSemaphoreCount - struct_body << "\t\t\t" << structInfo->waitSemaphoreCount << "," << std::endl; -// pWaitSemaphores - struct_body << "\t\t\t" << pwait_semaphores_array << "," << std::endl; -// bufferBindCount - struct_body << "\t\t\t" << structInfo->bufferBindCount << "," << std::endl; -// pBufferBinds - struct_body << "\t\t\t" << pbuffer_binds_array << "," << std::endl; -// imageOpaqueBindCount - struct_body << "\t\t\t" << structInfo->imageOpaqueBindCount << "," << std::endl; -// pImageOpaqueBinds - struct_body << "\t\t\t" << pimage_opaque_binds_array << "," << std::endl; -// imageBindCount - struct_body << "\t\t\t" << structInfo->imageBindCount << "," << std::endl; -// pImageBinds - struct_body << "\t\t\t" << pimage_binds_array << "," << std::endl; -// signalSemaphoreCount - struct_body << "\t\t\t" << structInfo->signalSemaphoreCount << "," << std::endl; -// pSignalSemaphores - struct_body << "\t\t\t" << psignal_semaphores_array << ","; - std::string variable_name = consumer.AddStruct(struct_body, "bindSparseInfo"); - out << "\t\t" << "VkBindSparseInfo " << variable_name << " {" << std::endl; - out << "\t\t" << struct_body.str() << std::endl; - out << "\t\t" << "};" << std::endl; - return variable_name; -} - - std::string GenerateStruct_VkBufferCopy(std::ostream &out, const VkBufferCopy* structInfo, Decoded_VkBufferCopy* metaInfo, VulkanCppConsumerBase &consumer){ std::stringstream struct_body; // srcOffset @@ -5197,83 +5088,6 @@ std::string GenerateStruct_VkStencilOpState(std::ostream &out, const VkStencilOp } -std::string GenerateStruct_VkSubmitInfo(std::ostream &out, const VkSubmitInfo* structInfo, Decoded_VkSubmitInfo* metaInfo, VulkanCppConsumerBase &consumer){ - std::stringstream struct_body; - std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); - std::string pwait_semaphores_array = "NULL"; - if (metaInfo->pWaitSemaphores.GetPointer() != NULL && structInfo->waitSemaphoreCount > 0) { - pwait_semaphores_array = "pwait_semaphores_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_SEMAPHORE)); - std::string pwait_semaphores_values = toStringJoin(metaInfo->pWaitSemaphores.GetPointer(), - metaInfo->pWaitSemaphores.GetPointer() + structInfo->waitSemaphoreCount, - [&](const format::HandleId current) { return consumer.GetHandle(current); }, - ", "); - if (structInfo->waitSemaphoreCount == 1) { - pwait_semaphores_array = "&" + pwait_semaphores_values; - } else if (structInfo->waitSemaphoreCount > 1) { - out << "\t\t" << "VkSemaphore " << pwait_semaphores_array << "[] = {" << pwait_semaphores_values << "};" << std::endl; - } - } - std::string pwait_dst_stage_mask_values; - std::string pwait_dst_stage_mask_array = "NULL"; - if (structInfo->pWaitDstStageMask != NULL) { - for (uint32_t idx = 0; idx < structInfo->waitSemaphoreCount; idx++) { - pwait_dst_stage_mask_values += util::ToString(structInfo->pWaitDstStageMask[idx]) + ", "; - } - pwait_dst_stage_mask_array = "pWaitDstStageMask_" + std::to_string(consumer.GetNextId()); - out << "\t\t" << "VkPipelineStageFlags " << pwait_dst_stage_mask_array << "[] = {" << pwait_dst_stage_mask_values << "};" << std::endl; - } - std::string pcommand_buffers_array = "NULL"; - if (metaInfo->pCommandBuffers.GetPointer() != NULL && structInfo->commandBufferCount > 0) { - pcommand_buffers_array = "pcommand_buffers_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_COMMAND_BUFFER)); - std::string pcommand_buffers_values = toStringJoin(metaInfo->pCommandBuffers.GetPointer(), - metaInfo->pCommandBuffers.GetPointer() + structInfo->commandBufferCount, - [&](const format::HandleId current) { return consumer.GetHandle(current); }, - ", "); - if (structInfo->commandBufferCount == 1) { - pcommand_buffers_array = "&" + pcommand_buffers_values; - } else if (structInfo->commandBufferCount > 1) { - out << "\t\t" << "VkCommandBuffer " << pcommand_buffers_array << "[] = {" << pcommand_buffers_values << "};" << std::endl; - } - } - std::string psignal_semaphores_array = "NULL"; - if (metaInfo->pSignalSemaphores.GetPointer() != NULL && structInfo->signalSemaphoreCount > 0) { - psignal_semaphores_array = "psignal_semaphores_array_" + std::to_string(consumer.GetNextId(VK_OBJECT_TYPE_SEMAPHORE)); - std::string psignal_semaphores_values = toStringJoin(metaInfo->pSignalSemaphores.GetPointer(), - metaInfo->pSignalSemaphores.GetPointer() + structInfo->signalSemaphoreCount, - [&](const format::HandleId current) { return consumer.GetHandle(current); }, - ", "); - if (structInfo->signalSemaphoreCount == 1) { - psignal_semaphores_array = "&" + psignal_semaphores_values; - } else if (structInfo->signalSemaphoreCount > 1) { - out << "\t\t" << "VkSemaphore " << psignal_semaphores_array << "[] = {" << psignal_semaphores_values << "};" << std::endl; - } - } -// sType - struct_body << "\t" << "VkStructureType(" << structInfo->sType << ")" << "," << std::endl; -// pNext - struct_body << "\t\t\t" << pnext_name << "," << std::endl; -// waitSemaphoreCount - struct_body << "\t\t\t" << structInfo->waitSemaphoreCount << "," << std::endl; -// pWaitSemaphores - struct_body << "\t\t\t" << pwait_semaphores_array << "," << std::endl; -// pWaitDstStageMask - struct_body << "\t\t\t" << pwait_dst_stage_mask_array << "," << std::endl; -// commandBufferCount - struct_body << "\t\t\t" << structInfo->commandBufferCount << "," << std::endl; -// pCommandBuffers - struct_body << "\t\t\t" << pcommand_buffers_array << "," << std::endl; -// signalSemaphoreCount - struct_body << "\t\t\t" << structInfo->signalSemaphoreCount << "," << std::endl; -// pSignalSemaphores - struct_body << "\t\t\t" << psignal_semaphores_array << ","; - std::string variable_name = consumer.AddStruct(struct_body, "submitInfo"); - out << "\t\t" << "VkSubmitInfo " << variable_name << " {" << std::endl; - out << "\t\t" << struct_body.str() << std::endl; - out << "\t\t" << "};" << std::endl; - return variable_name; -} - - std::string GenerateStruct_VkSubpassDependency(std::ostream &out, const VkSubpassDependency* structInfo, Decoded_VkSubpassDependency* metaInfo, VulkanCppConsumerBase &consumer){ std::stringstream struct_body; // srcSubpass @@ -10071,83 +9885,6 @@ std::string GenerateStruct_VkSemaphoreSubmitInfo(std::ostream &out, const VkSema } -std::string GenerateStruct_VkSubmitInfo2(std::ostream &out, const VkSubmitInfo2* structInfo, Decoded_VkSubmitInfo2* metaInfo, VulkanCppConsumerBase &consumer){ - std::stringstream struct_body; - std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); - std::string pwait_semaphore_infos_array = "NULL"; - if (structInfo->pWaitSemaphoreInfos != NULL) { - pwait_semaphore_infos_array = "pWaitSemaphoreInfos_" + std::to_string(consumer.GetNextId()); - std::string pwait_semaphore_infos_names; - for (uint32_t idx = 0; idx < structInfo->waitSemaphoreInfoCount; idx++) { - std::string variable_name = "NULL"; - if (structInfo->pWaitSemaphoreInfos + idx != NULL) { - variable_name = GenerateStruct_VkSemaphoreSubmitInfo(out, - structInfo->pWaitSemaphoreInfos + idx, - metaInfo->pWaitSemaphoreInfos->GetMetaStructPointer() + idx, - consumer); - } - pwait_semaphore_infos_names += variable_name + ", "; - } - out << "\t\t" << "VkSemaphoreSubmitInfo " << pwait_semaphore_infos_array << "[] = {" << pwait_semaphore_infos_names << "};" << std::endl; - } - std::string pcommand_buffer_infos_array = "NULL"; - if (structInfo->pCommandBufferInfos != NULL) { - pcommand_buffer_infos_array = "pCommandBufferInfos_" + std::to_string(consumer.GetNextId()); - std::string pcommand_buffer_infos_names; - for (uint32_t idx = 0; idx < structInfo->commandBufferInfoCount; idx++) { - std::string variable_name = "NULL"; - if (structInfo->pCommandBufferInfos + idx != NULL) { - variable_name = GenerateStruct_VkCommandBufferSubmitInfo(out, - structInfo->pCommandBufferInfos + idx, - metaInfo->pCommandBufferInfos->GetMetaStructPointer() + idx, - consumer); - } - pcommand_buffer_infos_names += variable_name + ", "; - } - out << "\t\t" << "VkCommandBufferSubmitInfo " << pcommand_buffer_infos_array << "[] = {" << pcommand_buffer_infos_names << "};" << std::endl; - } - std::string psignal_semaphore_infos_array = "NULL"; - if (structInfo->pSignalSemaphoreInfos != NULL) { - psignal_semaphore_infos_array = "pSignalSemaphoreInfos_" + std::to_string(consumer.GetNextId()); - std::string psignal_semaphore_infos_names; - for (uint32_t idx = 0; idx < structInfo->signalSemaphoreInfoCount; idx++) { - std::string variable_name = "NULL"; - if (structInfo->pSignalSemaphoreInfos + idx != NULL) { - variable_name = GenerateStruct_VkSemaphoreSubmitInfo(out, - structInfo->pSignalSemaphoreInfos + idx, - metaInfo->pSignalSemaphoreInfos->GetMetaStructPointer() + idx, - consumer); - } - psignal_semaphore_infos_names += variable_name + ", "; - } - out << "\t\t" << "VkSemaphoreSubmitInfo " << psignal_semaphore_infos_array << "[] = {" << psignal_semaphore_infos_names << "};" << std::endl; - } -// sType - struct_body << "\t" << "VkStructureType(" << structInfo->sType << ")" << "," << std::endl; -// pNext - struct_body << "\t\t\t" << pnext_name << "," << std::endl; -// flags - struct_body << "\t\t\t" << "VkSubmitFlags(" << structInfo->flags << ")" << "," << std::endl; -// waitSemaphoreInfoCount - struct_body << "\t\t\t" << structInfo->waitSemaphoreInfoCount << "," << std::endl; -// pWaitSemaphoreInfos - struct_body << "\t\t\t" << pwait_semaphore_infos_array << "," << std::endl; -// commandBufferInfoCount - struct_body << "\t\t\t" << structInfo->commandBufferInfoCount << "," << std::endl; -// pCommandBufferInfos - struct_body << "\t\t\t" << pcommand_buffer_infos_array << "," << std::endl; -// signalSemaphoreInfoCount - struct_body << "\t\t\t" << structInfo->signalSemaphoreInfoCount << "," << std::endl; -// pSignalSemaphoreInfos - struct_body << "\t\t\t" << psignal_semaphore_infos_array << ","; - std::string variable_name = consumer.AddStruct(struct_body, "submitInfo2"); - out << "\t\t" << "VkSubmitInfo2 " << variable_name << " {" << std::endl; - out << "\t\t" << struct_body.str() << std::endl; - out << "\t\t" << "};" << std::endl; - return variable_name; -} - - std::string GenerateStruct_VkWriteDescriptorSetInlineUniformBlock(std::ostream &out, const VkWriteDescriptorSetInlineUniformBlock* structInfo, Decoded_VkWriteDescriptorSetInlineUniformBlock* metaInfo, VulkanCppConsumerBase &consumer){ std::stringstream struct_body; std::string pnext_name = GenerateExtension(out, structInfo->pNext, metaInfo->pNext, consumer); diff --git a/framework/generated/generated_vulkan_cpp_structs.h b/framework/generated/generated_vulkan_cpp_structs.h index 1d017b7158..4fb1b5f2ec 100644 --- a/framework/generated/generated_vulkan_cpp_structs.h +++ b/framework/generated/generated_vulkan_cpp_structs.h @@ -166,8 +166,6 @@ std::string GenerateStruct_VkAttachmentDescription(std::ostream &out, const VkAt std::string GenerateStruct_VkAttachmentReference(std::ostream &out, const VkAttachmentReference* structInfo, Decoded_VkAttachmentReference* metaInfo, VulkanCppConsumerBase &consumer); -std::string GenerateStruct_VkBindSparseInfo(std::ostream &out, const VkBindSparseInfo* structInfo, Decoded_VkBindSparseInfo* metaInfo, VulkanCppConsumerBase &consumer); - std::string GenerateStruct_VkBufferCopy(std::ostream &out, const VkBufferCopy* structInfo, Decoded_VkBufferCopy* metaInfo, VulkanCppConsumerBase &consumer); std::string GenerateStruct_VkBufferCreateInfo(std::ostream &out, const VkBufferCreateInfo* structInfo, Decoded_VkBufferCreateInfo* metaInfo, VulkanCppConsumerBase &consumer); @@ -352,8 +350,6 @@ std::string GenerateStruct_VkSpecializationMapEntry(std::ostream &out, const VkS std::string GenerateStruct_VkStencilOpState(std::ostream &out, const VkStencilOpState* structInfo, Decoded_VkStencilOpState* metaInfo, VulkanCppConsumerBase &consumer); -std::string GenerateStruct_VkSubmitInfo(std::ostream &out, const VkSubmitInfo* structInfo, Decoded_VkSubmitInfo* metaInfo, VulkanCppConsumerBase &consumer); - std::string GenerateStruct_VkSubpassDependency(std::ostream &out, const VkSubpassDependency* structInfo, Decoded_VkSubpassDependency* metaInfo, VulkanCppConsumerBase &consumer); std::string GenerateStruct_VkSubpassDescription(std::ostream &out, const VkSubpassDescription* structInfo, Decoded_VkSubpassDescription* metaInfo, VulkanCppConsumerBase &consumer); @@ -704,8 +700,6 @@ std::string GenerateStruct_VkResolveImageInfo2(std::ostream &out, const VkResolv std::string GenerateStruct_VkSemaphoreSubmitInfo(std::ostream &out, const VkSemaphoreSubmitInfo* structInfo, Decoded_VkSemaphoreSubmitInfo* metaInfo, VulkanCppConsumerBase &consumer); -std::string GenerateStruct_VkSubmitInfo2(std::ostream &out, const VkSubmitInfo2* structInfo, Decoded_VkSubmitInfo2* metaInfo, VulkanCppConsumerBase &consumer); - std::string GenerateStruct_VkWriteDescriptorSetInlineUniformBlock(std::ostream &out, const VkWriteDescriptorSetInlineUniformBlock* structInfo, Decoded_VkWriteDescriptorSetInlineUniformBlock* metaInfo, VulkanCppConsumerBase &consumer); std::string GenerateStruct_VkSurfaceCapabilitiesKHR(std::ostream &out, const VkSurfaceCapabilitiesKHR* structInfo, Decoded_VkSurfaceCapabilitiesKHR* metaInfo, VulkanCppConsumerBase &consumer); diff --git a/framework/generated/vulkan_generators/vulkan_cpp_consumer_body_generator.py b/framework/generated/vulkan_generators/vulkan_cpp_consumer_body_generator.py index 1649e07581..e8261cfb53 100644 --- a/framework/generated/vulkan_generators/vulkan_cpp_consumer_body_generator.py +++ b/framework/generated/vulkan_generators/vulkan_cpp_consumer_body_generator.py @@ -140,6 +140,15 @@ def getExtApiStructs(featureDictionary): 'vkCreateComputePipelines', 'vkGetAndroidHardwareBufferPropertiesANDROID', 'vkGetMemoryAndroidHardwareBufferANDROID', + 'vkGetSemaphoreWin32HandleKHR', + 'vkImportSemaphoreWin32HandleKHR', + 'vkGetSemaphoreFdKHR', + 'vkImportSemaphoreFdKHR', + 'vkQueueSubmit2KHR', + 'vkQueueSubmit', + 'vkQueueSubmit2', + 'vkQueueBindSparse', + 'vkQueuePresentKHR', ] CPP_APICALL_INTERCEPT_LIST = [ @@ -147,6 +156,7 @@ def getExtApiStructs(featureDictionary): 'vkCreateDevice', 'vkCreateFramebuffer', 'vkCreateSwapchainKHR', + 'vkDestroySemaphore', ] CPP_CONSUMER_API_POST_CALL = [ diff --git a/framework/generated/vulkan_generators/vulkan_cpp_struct_generator.py b/framework/generated/vulkan_generators/vulkan_cpp_struct_generator.py index 2e213a44f1..35624c5101 100644 --- a/framework/generated/vulkan_generators/vulkan_cpp_struct_generator.py +++ b/framework/generated/vulkan_generators/vulkan_cpp_struct_generator.py @@ -139,6 +139,9 @@ def __init__( 'VkClearColorValue', 'VkWriteDescriptorSet', 'VkPresentInfoKHR', + 'VkSubmitInfo', + 'VkSubmitInfo2', + 'VkBindSparseInfo', 'VkDescriptorUpdateTemplateCreateInfoKHR', 'VkDescriptorImageInfo', 'VkDescriptorUpdateTemplateEntry', diff --git a/tools/tocpp/main.cpp b/tools/tocpp/main.cpp index b08fa2c4e3..99ba4ff272 100644 --- a/tools/tocpp/main.cpp +++ b/tools/tocpp/main.cpp @@ -667,7 +667,6 @@ int main(int argc, const char** argv) } cpp_consumer.SetWindowSize(window_width, window_height); - resource_tracker.CalculateGlobalVariables(); process_start_time = gfxrecon::util::datetime::GetTimestamp(); result = ProcessCapture(cpp_consumer, input_filename, output_filename, target_platform, frame_limit);