From 9a2be7ac36add3c53c225f0003db0960d067cecb Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 3 Mar 2018 16:47:21 +0000 Subject: [PATCH] Use same reported app info in vulkan on capture and replay * This can change the driver behaviour and break replay if we replay with a different reported app info. Since we don't want to report as the app while replaying and doing different things, it's safer to change the app while being captured to report as us. --- .../vulkan/wrappers/vk_device_funcs.cpp | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp index d412f324d..1b271bb88 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp @@ -27,6 +27,20 @@ #include "../vk_rendertext.h" #include "../vk_shader_cache.h" +// intercept and overwrite the application info if present. We must use the same appinfo on +// capture and replay, and the safer default is not to replay as if we were the original app but +// with a slightly different workload. So instead we trample what the app reported and put in our +// own info. +static VkApplicationInfo renderdocAppInfo = { + VK_STRUCTURE_TYPE_APPLICATION_INFO, + NULL, + "RenderDoc Capturing App", + VK_MAKE_VERSION(RENDERDOC_VERSION_MAJOR, RENDERDOC_VERSION_MINOR, 0), + "RenderDoc", + VK_MAKE_VERSION(RENDERDOC_VERSION_MAJOR, RENDERDOC_VERSION_MINOR, 0), + VK_API_VERSION_1_0, +}; + // vk_dispatchtables.cpp void InitDeviceTable(VkDevice dev, PFN_vkGetDeviceProcAddr gpa); void InitInstanceTable(VkInstance inst, PFN_vkGetInstanceProcAddr gpa); @@ -96,9 +110,6 @@ ReplayStatus WrappedVulkan::Initialise(VkInitParams ¶ms, uint64_t sectionVer m_InitParams = params; m_SectionVersion = sectionVersion; - params.AppName = string("RenderDoc @ ") + params.AppName; - params.EngineName = string("RenderDoc @ ") + params.EngineName; - // PORTABILITY verify that layers/extensions are available StripUnwantedLayers(params.Layers); @@ -211,21 +222,11 @@ ReplayStatus WrappedVulkan::Initialise(VkInitParams ¶ms, uint64_t sectionVer for(size_t i = 0; i < params.Extensions.size(); i++) extscstr[i] = params.Extensions[i].c_str(); - VkApplicationInfo appinfo = { - VK_STRUCTURE_TYPE_APPLICATION_INFO, - NULL, - params.AppName.c_str(), - params.AppVersion, - params.EngineName.c_str(), - params.EngineVersion, - VK_API_VERSION_1_0, - }; - VkInstanceCreateInfo instinfo = { VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, NULL, 0, - &appinfo, + &renderdocAppInfo, (uint32_t)params.Layers.size(), layerscstr, (uint32_t)params.Extensions.size(), @@ -407,6 +408,9 @@ VkResult WrappedVulkan::vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo modifiedCreateInfo.ppEnabledExtensionNames = addedExts; + if(modifiedCreateInfo.pApplicationInfo) + modifiedCreateInfo.pApplicationInfo = &renderdocAppInfo; + VkResult ret = createFunc(&modifiedCreateInfo, pAllocator, pInstance); m_Instance = *pInstance;