From 11ca89f278ad5d30c91c4616f49d1c8d2fce7122 Mon Sep 17 00:00:00 2001 From: Jakub Janeczko Date: Tue, 25 Jun 2024 15:24:06 +0200 Subject: [PATCH] update size and format and fix errors --- renderdoc/driver/vulkan/vk_dispatchtables.cpp | 32 +++++++++---------- renderdoc/driver/vulkan/vk_dispatchtables.h | 3 +- renderdoc/driver/vulkan/vk_layer.cpp | 16 ++++++---- renderdoc/driver/vulkan/vk_state.cpp | 22 ++++++------- renderdoc/replay/renderdoc_serialise.inl | 2 +- 5 files changed, 39 insertions(+), 36 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_dispatchtables.cpp b/renderdoc/driver/vulkan/vk_dispatchtables.cpp index 6f2402c7bdd..b2fcc812715 100644 --- a/renderdoc/driver/vulkan/vk_dispatchtables.cpp +++ b/renderdoc/driver/vulkan/vk_dispatchtables.cpp @@ -91,14 +91,14 @@ void InitInstanceExtensionTables(VkInstance instance, InstanceDeviceInfo *info) #undef HookInitPromotedExtension #define HookInitPromotedExtension(cond, func, suffix) \ - if(cond) \ - { \ - InstanceGPA(func); \ - InstanceGPA(CONCAT(func, suffix)); \ - if(table->func == NULL) \ - table->func = table->CONCAT(func, suffix); \ - if(table->CONCAT(func, suffix) == NULL) \ - table->CONCAT(func, suffix) = table->func; \ + if(cond) \ + { \ + InstanceGPA(func); \ + InstanceGPA(CONCAT(func, suffix)); \ + if(table->func == NULL) \ + table->func = table->CONCAT(func, suffix); \ + if(table->CONCAT(func, suffix) == NULL) \ + table->CONCAT(func, suffix) = table->func; \ } #undef HookInitExtensionEXTtoKHR @@ -141,14 +141,14 @@ void InitDeviceExtensionTables(VkDevice device, InstanceDeviceInfo *info) #undef HookInitPromotedExtension #define HookInitPromotedExtension(cond, func, suffix) \ - if(cond) \ - { \ - DeviceGPA(func); \ - DeviceGPA(CONCAT(func, suffix)); \ - if(table->func == NULL) \ - table->func = table->CONCAT(func, suffix); \ - if(table->CONCAT(func, suffix) == NULL) \ - table->CONCAT(func, suffix) = table->func; \ + if(cond) \ + { \ + DeviceGPA(func); \ + DeviceGPA(CONCAT(func, suffix)); \ + if(table->func == NULL) \ + table->func = table->CONCAT(func, suffix); \ + if(table->CONCAT(func, suffix) == NULL) \ + table->CONCAT(func, suffix) = table->func; \ } #undef HookInitExtensionEXTtoKHR diff --git a/renderdoc/driver/vulkan/vk_dispatchtables.h b/renderdoc/driver/vulkan/vk_dispatchtables.h index c884f915bcd..1e7ed5cc48a 100644 --- a/renderdoc/driver/vulkan/vk_dispatchtables.h +++ b/renderdoc/driver/vulkan/vk_dispatchtables.h @@ -39,7 +39,8 @@ void InitReplayTables(void *vulkanModule); // bitmask of extension enabled status -enum ExtensionStatusFlagBits { +enum ExtensionStatusFlagBits +{ NotEnabled = 0, ExplicitEnabled = 1 << 0, PromotionEnabled = 1 << 1, diff --git a/renderdoc/driver/vulkan/vk_layer.cpp b/renderdoc/driver/vulkan/vk_layer.cpp index d1462517ef6..8ffdf66bfb4 100644 --- a/renderdoc/driver/vulkan/vk_layer.cpp +++ b/renderdoc/driver/vulkan/vk_layer.cpp @@ -374,12 +374,14 @@ VK_LAYER_RENDERDOC_CaptureEnumerateInstanceExtensionProperties( } #undef DeclExt -#define DeclExt(name) \ - ExtensionStatusFlags name = ExtensionStatusFlagBits::NotEnabled; \ +#define DeclExt(name) \ + ExtensionStatusFlags name = ExtensionStatusFlagBits::NotEnabled; \ (void)name; #undef CheckExt -#define CheckExt(name, ver) name = instDevInfo == NULL ? ExtensionStatusFlagBits::NotEnabled : instDevInfo->ext_##name; +#define CheckExt(name, ver) \ + name = instDevInfo == NULL ? (ExtensionStatusFlags)ExtensionStatusFlagBits::NotEnabled \ + : instDevInfo->ext_##name; #undef HookInit #define HookInit(function) \ @@ -396,7 +398,7 @@ VK_LAYER_RENDERDOC_CaptureEnumerateInstanceExtensionProperties( // for promoted extensions, we return the function pointer for either name as an alias. #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, function, suffix) \ +#define HookInitPromotedExtension(cond, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ { \ if(ExtensionStatusFlagBits::ExplicitEnabled & cond) \ @@ -515,9 +517,9 @@ VK_LAYER_RENDERDOC_CaptureGetInstanceProcAddr(VkInstance instance, const char *p return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, function, suffix) \ +#define HookInitPromotedExtension(cond, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, function))) || \ - !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ + !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); #undef HookInitExtensionEXTtoKHR @@ -596,7 +598,7 @@ VK_LAYER_RENDERDOC_Capture_layerGetPhysicalDeviceProcAddr(VkInstance instance, c return NULL; #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, function, suffix) \ +#define HookInitPromotedExtension(cond, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, function))) || \ !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ return NULL; diff --git a/renderdoc/driver/vulkan/vk_state.cpp b/renderdoc/driver/vulkan/vk_state.cpp index cec05b53e25..5467554cf53 100644 --- a/renderdoc/driver/vulkan/vk_state.cpp +++ b/renderdoc/driver/vulkan/vk_state.cpp @@ -663,18 +663,18 @@ void VulkanRenderState::BindDynamicState(WrappedVulkan *vk, VkCommandBuffer cmd) else if(ibuffer.bytewidth == 1) type = VK_INDEX_TYPE_UINT8_KHR; - VkBuffer idxBufferUnwrapped = - Unwrap(vk->GetResourceManager()->GetCurrentHandle(ibuffer.buf)); - if(ibuffer.size == VK_WHOLE_SIZE) - { - ObjDisp(cmd)->CmdBindIndexBuffer(Unwrap(cmd), idxBufferUnwrapped, ibuffer.offs, type); - } - else - { - ObjDisp(cmd)->CmdBindIndexBuffer2KHR(Unwrap(cmd), idxBufferUnwrapped, ibuffer.offs, - ibuffer.size, type); - } + VkBuffer idxBufferUnwrapped = + Unwrap(vk->GetResourceManager()->GetCurrentHandle(ibuffer.buf)); + if(ibuffer.size == VK_WHOLE_SIZE) + { + ObjDisp(cmd)->CmdBindIndexBuffer(Unwrap(cmd), idxBufferUnwrapped, ibuffer.offs, type); } + else + { + ObjDisp(cmd)->CmdBindIndexBuffer2KHR(Unwrap(cmd), idxBufferUnwrapped, ibuffer.offs, + ibuffer.size, type); + } + } if((vk->DynamicVertexInput() || vk->ShaderObject()) && dynamicStates[VkDynamicVertexInputEXT]) { diff --git a/renderdoc/replay/renderdoc_serialise.inl b/renderdoc/replay/renderdoc_serialise.inl index 7a4acd72c22..bc6838204c8 100644 --- a/renderdoc/replay/renderdoc_serialise.inl +++ b/renderdoc/replay/renderdoc_serialise.inl @@ -2290,7 +2290,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::State &el) SERIALISE_MEMBER(conditionalRendering); - SIZE_CHECK(1820); + SIZE_CHECK(1816); } #pragma endregion Vulkan pipeline state