I am trying to figure out how to create a Vulkan 2D image shared with D3D11 texture.
My Windows 10 development system is equipped with Radeon RX 570 Series card which is a primary GPU device with monitors connected to it. I have 19.7.2 driver installed along with Vulkan RT and SDK 1.1.108.
For the record, there is a related topic here, which however does not help me enough.
It is worth mentioning that vkGetPhysicalDeviceImageFormatProperties2 gets me VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT | VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT external memory features with VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT compatible handle for VK_FORMAT_R8G8B8A8_UNORM image. And this is what I am trying to do: to "import" an existing D3D11 texture for allocation of Vulkan image, if I understand the concept of import right.
Things are not going well at already vkGetImageMemoryRequirements2 step here.
If validation layer is not enabled, I get a memory access violation inside the call.
If however, the layer is enabled, the call passes through, but output VkMemoryRequirements remain uninitialized.
If I attempt to "fix" this by regular vkGetImageMemoryRequirements and use the data for allocation, I seem to be able to complete allocation and binding and the rest of the calls succeed (with still no confirmation whether the copied data got into the texture).
In a more complicated application where I do seemingly the same thing, but the source of the data is coming from image receiving render results, I have a consistent BSOD inside vkQueueSubmit call. Even though the properties of the images look the same, submission of work causes a kernel bugcheck (also attached bugcheck.txt😞
The video scheduler has detected that fatal violation has occurred. This resulted
in a condition that video scheduler can no longer progress. Any other values after
parameter 1 must be individually examined according to the subtype.
Arg1: 0000000000000001, The driver has reported an invalid fence ID.
In all cases, I don't see any reasonable hints from validation layer and debug output to help with vkGetImageMemoryRequirements2 and BSOD. That is, it brings me into situation where I am not sure what I should do to troubleshoot this further.
I would appreciate help in setting the interop up correctly or possibly an example of image/texture sharing.
Thak you for the followup, dorisyan.
dorisyan, I extracted relevant code into single .cpp file.
It has all the properties mentioned above:
I thought that cube project behavior could be different because maybe the same code there is executed in the scope of begun command buffer. I assume it could make a difference.
Hi roman380, I can reproduce your problem on AMD card, but I run your app on NV, there are also some bugs like 'access violation', maybe there is something wrong in your app, could you please have a check again?
Thanks for looking, I thought my question is dead...
AFAIR I took a working app from Vulkan SDK just to have baseline initialization done. then on top of that I attached an attempt to use BindImageMemory2 and initialize D3D11 interop. Yes it does not work and in a strange way. I am guessing there is nothing wrong with the app itself, just my edit is not functional, and my edit is basically a single block of code ~200 lines in cube.cpp lines 2126-2303 as highlighted here by github in the bottom file: Comparing master...d3d11-image-interop · roman380/VulkanSdkDemos · GitHub
I will re-check later but I assume the question remains where it was, how to use D3D11 texture interop.