From bbe9624b95d62772f3c0caf21f389d7fc4abf6c6 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 13 Jul 2022 11:32:18 +0100 Subject: [PATCH] Rejig some code around to avoid stack size explosion in vulkan serialise --- renderdoc/driver/vulkan/vk_serialise.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_serialise.cpp b/renderdoc/driver/vulkan/vk_serialise.cpp index 7dfdd3efa..23ae5f065 100644 --- a/renderdoc/driver/vulkan/vk_serialise.cpp +++ b/renderdoc/driver/vulkan/vk_serialise.cpp @@ -1600,6 +1600,16 @@ SERIALISE_VK_HANDLES(); static const rdcliteral pNextName = "pNext"_lit; static const rdcliteral pNextTypeName = "pNextType"_lit; +template +static void SerialiseNextError(SerialiserType &ser, const char *sType, const void *&pNext) +{ + RDResult res; + SET_ERROR_RESULT(res, ResultCode::APIUnsupported, "No support for %s is available in this build", + sType); + pNext = NULL; + ser.SetError(res); +} + template static void SerialiseNext(SerialiserType &ser, VkStructureType &sType, const void *&pNext) { @@ -1631,16 +1641,8 @@ static void SerialiseNext(SerialiserType &ser, VkStructureType &sType, const voi // if we encounter an unsupported struct on read we *cannot* continue since we don't know the // members that got serialised after it -#define PNEXT_UNSUPPORTED(StructType) \ - case StructType: \ - { \ - RDResult res; \ - SET_ERROR_RESULT(res, ResultCode::APIUnsupported, \ - "No support for " #StructType " is available in this build"); \ - pNext = NULL; \ - ser.SetError(res); \ - return; \ - } +#define PNEXT_UNSUPPORTED(StructType) \ + case StructType: return SerialiseNextError(ser, #StructType, pNext); // if we come across a struct we should process, then serialise a pointer to it. #define PNEXT_STRUCT(StructType, StructName) \