FidelityFX-SDK
FidelityFX-SDK copied to clipboard
amd_fidelityfx_vk null exception while creating context
Hello,
I was testing Vulkan backend but keep getting access violation error on this line at ffx_vk.cpp.
After changing this line on same file as below problem dissapeared for me.
backendContext->vkFunctionTable.vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2KHR)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkGetBufferMemoryRequirements2");
With pull request #77 I have tried to solve this and one another extension issue I have noticed.
Hello! You might need to load the extension VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME to make it works. But as you have pointed out in your merge request, this function is now in core Vulkan 1.1. Maybe this function should always be used (assuming Vulkan 1.1 is supported)?
vkGetBufferMemoryRequirements2KHR on my RTX3080Ti is NULL vkGetBufferMemoryRequirements2 is defined
->
vkGetBufferMemoryRequirements2KHR = vkGetBufferMemoryRequirements2; // After vulkan initialisation
With the latest driver, your GPU has this extension available. Please refer to https://vulkan.gpuinfo.org/displayreport.php?id=32759#extensions
Have you make sure the extension is loaded during device creation (see VkDeviceCreateInfo::ppEnabledExenstionNames)?
I use Volk for vulkan initialisation, i think it doesn"t fill all the functions. But i override the vkDeviceProcAddr function in ffx::CreateBackendVKDesc BackendVKDesc, and it solved all my FSR problems (but not the framegeneration crash at this time :D)
I give you the information in case off it can help you...
Hi,
Thanks for advice, as far I as remeber FSR3.1 upscaler uses 4 (2 or 3 of them for debugging) Vulkan extensions and last time when I have checked they weren't listed in the docs at all. So it might be better if AMD add this info to FSR docs to prevent confusion.
Hello! You might need to load the extension VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME to make it works. But as you have pointed out in your merge request, this function is now in core Vulkan 1.1. Maybe this function should always be used (assuming Vulkan 1.1 is supported)?
If you want to fix this without modifying FidelityFX source:
PFN_vkVoidFunction VKAPI_PTR CustomVulkanDeviceProcAddr(VkDevice device, const char* pName)
{
// Brixelizer uses an old version of this function:
// https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/issues/73
// So we patch it with the correct one.
if (strcmp(pName, "vkGetBufferMemoryRequirements2KHR") == 0)
return reinterpret_cast<PFN_vkVoidFunction>(vkGetBufferMemoryRequirements2);
// Forward as normal.
return vkGetDeviceProcAddr(device, pName);
}
And
VkDeviceContext ffxDeviceContext {};
{
ffxDeviceContext.vkDevice = ...
ffxDeviceContext.vkPhysicalDevice = ...
ffxDeviceContext.vkDeviceProcAddr = CustomVulkanDeviceProcAddr;
}
auto ffxDevice = ffxGetDeviceVK(&ffxDeviceContext);
IMO the real fix should be provided by volk to auto-resolve all the diverging EXT/KHR/Default vulkan function pointers which is becoming a bit messy.