Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amd_fidelityfx_vk null exception while creating context #73

Open
cdozdil opened this issue Jul 9, 2024 · 7 comments
Open

amd_fidelityfx_vk null exception while creating context #73

cdozdil opened this issue Jul 9, 2024 · 7 comments

Comments

@cdozdil
Copy link

cdozdil commented Jul 9, 2024

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");
@cdozdil
Copy link
Author

cdozdil commented Jul 16, 2024

With pull request #77 I have tried to solve this and one another extension issue I have noticed.

@lordOznek
Copy link

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)?

@HerveRV
Copy link

HerveRV commented Aug 29, 2024

vkGetBufferMemoryRequirements2KHR on my RTX3080Ti is NULL
vkGetBufferMemoryRequirements2 is defined

->

vkGetBufferMemoryRequirements2KHR = vkGetBufferMemoryRequirements2; // After vulkan initialisation

@lordOznek
Copy link

lordOznek commented Aug 29, 2024

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)?

@HerveRV
Copy link

HerveRV commented Aug 29, 2024

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...

@cdozdil
Copy link
Author

cdozdil commented Aug 31, 2024

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)?

@parsaiej
Copy link

parsaiej commented Oct 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants