Hello NVIDIA forums,
I have come across weird behaviour trying to reproduce OptiX denoiser integration as demonstrated in vk_denoise sample nvpro-samples/vk_denoise (on github. Can only link once so this is not a link)
My code can be found in foray-denoiser-optix/foray_optix_cudabuffer.cpp at main · Vulkemp/foray-denoiser-optix · GitHub
For a full testing setup, clone github/Vulkemp/foray-denoising recursively, set ENABLE_OPTIX in CMake cache, set OPTIX_INCLUDE to OptiX include directory. After launch switch denoiser in ImGui to OptiX.
Description of the problem:
- vkGetMemoryWin32HandleKHR returns VK_SUCCESS, but referenced handle is set to all zeroes and is not a valid handle.
Setup
- Vulkan 1.3
- Enabled Instance Extensions: VK_KHR_EXTERNAL_MEMORY_CAPABILITIES
- Enabled Device Extensions: VK_KHR_EXTERNAL_MEMORY, VK_KHR_GET_MEMORY_REQUIREMENTS_2, VK_KHR_EXTERNAL_MEMORY_WIN32
Buffer Allocation
- bufferCreateInfo.pNext initialized with VkExternalMemoryBufferCreateInfo object
- Memory allocated device local and in dedicated device memory
- Allocation via Vulkan Memory Allocator
Environment
- Windows 10 21H2
- GTX 1070ti, Driver 522.25
- Vulkan SDK 1.3.224
- OptiX v7.5.0
Notes
- The same code (with the relevant extensions and flags set to the FD handle equivalent) runs fine on linux on the same machine (driver 515)
- nvpro/vk_denoise runs fine on my machine (but I had to disable parts of the render pipeline, due to my GPU not supporting Ray Query Extension, so I cannot be sure it works 100%)
- nvpro/vk_denoise invokes the same function pointer for vkGetMemoryWin32HandleKHR (I made sure that the Dispatch Table has the correct function pointer)
Attempts to fix the issue:
- Enable a bunch of unnecessary but perhaps related vulkan extensions
- Step through vk_denoise Buffer setup and my code in unison to make sure the buffer is configured the same