Handle broken GetDeviceProcAddr behaviour ourselves

* This might be handled by the ICD using app-profiles, but we replace the app-
  profile with our own for safety so we need to handle this one.
This commit is contained in:
baldurk
2018-07-16 23:38:06 +01:00
parent 6418efb7e8
commit e2d228d5f2
3 changed files with 19 additions and 0 deletions
@@ -49,6 +49,8 @@ struct InstanceDeviceInfo
#undef CheckExt
#define CheckExt(name, ver) bool ext_##name;
bool brokenGetDeviceProcAddr = false;
int vulkanVersion = VK_API_VERSION_1_0;
CheckDeviceExts();
+5
View File
@@ -300,6 +300,11 @@ VK_LAYER_RENDERDOC_CaptureGetDeviceProcAddr(VkDevice device, const char *pName)
HookInitVulkanDeviceExts();
if(instDevInfo->brokenGetDeviceProcAddr)
{
HookInitVulkanInstanceExts();
}
if(GetDeviceDispatchTable(device)->GetDeviceProcAddr == NULL)
return NULL;
return GetDeviceDispatchTable(device)->GetDeviceProcAddr(Unwrap(device), pName);
@@ -27,6 +27,7 @@
#include "../vk_rendertext.h"
#include "../vk_shader_cache.h"
#include "api/replay/version.h"
#include "strings/string_utils.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
@@ -454,9 +455,15 @@ VkResult WrappedVulkan::vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo
modifiedCreateInfo.ppEnabledExtensionNames = addedExts;
bool brokenGetDeviceProcAddr = false;
// override applicationInfo with RenderDoc's, but preserve apiVersion
if(modifiedCreateInfo.pApplicationInfo)
{
if(modifiedCreateInfo.pApplicationInfo->pEngineName &&
strlower(modifiedCreateInfo.pApplicationInfo->pEngineName) == "idtech")
brokenGetDeviceProcAddr = true;
if(modifiedCreateInfo.pApplicationInfo->apiVersion >= VK_API_VERSION_1_0)
renderdocAppInfo.apiVersion = modifiedCreateInfo.pApplicationInfo->apiVersion;
@@ -481,6 +488,8 @@ VkResult WrappedVulkan::vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo
record->instDevInfo = new InstanceDeviceInfo();
record->instDevInfo->brokenGetDeviceProcAddr = brokenGetDeviceProcAddr;
record->instDevInfo->vulkanVersion = VK_API_VERSION_1_0;
if(renderdocAppInfo.apiVersion > VK_API_VERSION_1_0)
@@ -1897,6 +1906,9 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
record->instDevInfo = new InstanceDeviceInfo();
record->instDevInfo->brokenGetDeviceProcAddr =
GetRecord(m_Instance)->instDevInfo->brokenGetDeviceProcAddr;
record->instDevInfo->vulkanVersion = GetRecord(m_Instance)->instDevInfo->vulkanVersion;
#undef CheckExt