Make sure to add WSI extensions needed for replay - app may not use WSI

This commit is contained in:
baldurk
2016-05-04 21:00:21 +02:00
parent 75b2f9e8a0
commit abca888524
4 changed files with 67 additions and 10 deletions
+3
View File
@@ -484,6 +484,9 @@ private:
VulkanDrawcallTreeNode m_ParentDrawcall;
// in vk_<platform>.cpp
void AddRequiredExtensions(bool instance, vector<string> &extensionList);
void InsertDrawsAndRefreshIDs(vector<VulkanDrawcallTreeNode> &cmdBufNodes, uint32_t baseEventID, uint32_t baseDrawID);
list<VulkanDrawcallTreeNode *> m_DrawcallStack;
+24
View File
@@ -86,6 +86,30 @@ bool VulkanReplay::IsOutputWindowVisible(uint64_t id)
return true;
}
void WrappedVulkan::AddRequiredExtensions(bool instance, vector<string> &extensionList)
{
bool device = !instance;
// TODO should check if these are present..
if(instance)
{
extensionList.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
#if defined(VK_USE_PLATFORM_XCB_KHR)
extensionList.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
#endif
#if defined(VK_USE_PLATFORM_XLIB_KHR)
extensionList.push_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
#endif
}
else if(device)
{
extensionList.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
}
}
#if defined(VK_USE_PLATFORM_XCB_KHR)
VkBool32 WrappedVulkan::vkGetPhysicalDeviceXcbPresentationSupportKHR(
+17
View File
@@ -69,6 +69,23 @@ bool VulkanReplay::IsOutputWindowVisible(uint64_t id)
return (IsWindowVisible(m_OutputWindows[id].wnd) == TRUE);
}
void WrappedVulkan::AddRequiredExtensions(bool instance, vector<string> &extensionList)
{
bool device = !instance;
// TODO should check if these are present..
if(instance)
{
extensionList.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
extensionList.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
}
else if(device)
{
extensionList.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
}
}
#if !defined(VK_USE_PLATFORM_WIN32_KHR)
#error "Win32 KHR platform not defined"
#endif
@@ -99,6 +99,8 @@ void WrappedVulkan::Initialise(VkInitParams &params)
params.Extensions.push_back("VK_EXT_debug_report");
#endif
AddRequiredExtensions(true, params.Extensions);
const char **layerscstr = new const char *[params.Layers.size()];
for(size_t i=0; i < params.Layers.size(); i++)
layerscstr[i] = params.Layers[i].c_str();
@@ -518,18 +520,13 @@ bool WrappedVulkan::Serialise_vkCreateDevice(
// we must make any modifications locally, so the free of pointers
// in the serialised VkDeviceCreateInfo don't double-free
VkDeviceCreateInfo createInfo = serCreateInfo;
// disable this extension as we might have captured it but we don't need
// to replay it
std::vector<string> Extensions;
for(uint32_t i=0; i < createInfo.enabledExtensionCount; i++)
{
const char **extNames = (const char **)createInfo.ppEnabledExtensionNames;
if(!strcmp(extNames[i], DEBUG_MARKER_EXTENSION_NAME))
{
for(uint32_t j=i; j < createInfo.enabledExtensionCount-1; j++)
extNames[j] = extNames[j+1];
createInfo.enabledExtensionCount--;
}
// don't include the debug marker extension
if(strcmp(createInfo.ppEnabledExtensionNames[i], DEBUG_MARKER_EXTENSION_NAME))
Extensions.push_back(createInfo.ppEnabledExtensionNames[i]);
}
std::vector<string> Layers;
@@ -537,6 +534,8 @@ bool WrappedVulkan::Serialise_vkCreateDevice(
Layers.push_back(createInfo.ppEnabledLayerNames[i]);
StripUnwantedLayers(Layers);
AddRequiredExtensions(false, Extensions);
#if defined(FORCE_VALIDATION_LAYERS)
Layers.push_back("VK_LAYER_LUNARG_standard_validation");
@@ -555,6 +554,19 @@ bool WrappedVulkan::Serialise_vkCreateDevice(
createInfo.ppEnabledLayerNames = layerArray;
}
createInfo.enabledExtensionCount = (uint32_t)Extensions.size();
const char **extArray = NULL;
if(!Extensions.empty())
{
extArray = new const char *[createInfo.enabledExtensionCount];
for(uint32_t i=0; i < createInfo.enabledExtensionCount; i++)
extArray[i] = Extensions[i].c_str();
createInfo.ppEnabledExtensionNames = extArray;
}
physicalDevice = GetResourceManager()->GetLiveHandle<VkPhysicalDevice>(physId);
VkDevice device;
@@ -716,6 +728,7 @@ bool WrappedVulkan::Serialise_vkCreateDevice(
SAFE_DELETE_ARRAY(modQueues);
SAFE_DELETE_ARRAY(layerArray);
SAFE_DELETE_ARRAY(extArray);
}
return true;