Skip to content

dzn: Fix segmentation fault when Direct3D 12 user mode driver from at least one of GPUs is not available

Kenji Mouri requested to merge (removed):fix_dozen_initialization_issue into main

In the recent days, I was using vkpeak via mesa3d Vulkan dozen backend in my Hyper-V Linux VM instance via NanaBox with GPU-PV enabled and properly configured only for my dedicated NVIDIA GPU for my VM in my Intel platform laptop, the error "MESA: error: ID3D12DeviceFactory::CreateDevice failed" is returned and exited with segmentation fault (core dumped). After I tried some troubleshooting things, I thought I should also configure for my integrated Intel GPU for my VM and I tried that, I got a successful result and posted a tweet to show to my friends.

But I am curious about why it caused that because mesa3d OpenGL d3d12 backend doesn't have this issue. I searched mesa3d issue list and found a similar issue in WSL2. So, I thought I should try to fix it.

I did some debugging, found the reason, fixed that, and finally created this PR.

I think it will give some help for users when they have multiple GPUs and Direct3D 12 user mode driver from at least one of GPUs is not properly adapted for WSL2 GPU acceleration. Also, using Linux VMs powered by Hyper-V with GPU-PV enabled can get the benefit too because WSL2 GPU acceleration is based on Hyper-V GPU-PV.

Kenji Mouri

Merge request reports