Fixed creating RenderTarget when using Vulkan backend by abenedik · Pull Request #20952 · AvaloniaUI/Avalonia (original) (raw)

What does the pull request do?

When using the Vulkan backend in v12-preview2 or rc1, the app started, but nothing was shown.
As described in Issue #20824 this was caused because the Vulkan.TryGetFeature<IVulkanKhrSurfacePlatformSurfaceFactory>() returned null and this prevented the _renderTarget from being created.

This is fixed by the first commint in this PR that updates the TryGetFeature method.

The second commit is just a small improvement that reduces duplicate check for null (first in if and then in ??=).

Fixed issues

Fixes #20824