Browse Source
Fixed creating RenderTarget when using Vulkan backend (#20952 )
* Updated VulkanContext.TryGetFeature to also provide IVulkanKhrSurfacePlatformSurfaceFactory
This also fixed creating new RenderTarget when using Vulkan backend, see issue #20824
* Prevent duplicate check if _renderTarget is null
pull/20549/merge
Andrej Benedik
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
13 additions and
5 deletions
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
src/Avalonia.Vulkan/VulkanContext.cs
@ -149,12 +149,16 @@ namespace Avalonia.Rendering.Composition.Server
try
{
if ( _ renderTarget = = null & & ! _ compositor . IsReadyToCreateRenderTarget ( _ surfaces ( ) ) )
if ( _ renderTarget = = null )
{
IsWaitingForReadyRenderTarget = IsEnabled ;
return ;
if ( ! _ compositor . IsReadyToCreateRenderTarget ( _ surfaces ( ) ) )
{
IsWaitingForReadyRenderTarget = IsEnabled ;
return ;
}
_ renderTarget = _ compositor . CreateRenderTarget ( _ surfaces ( ) ) ;
}
_ renderTarget ? ? = _ compositor . CreateRenderTarget ( _ surfaces ( ) ) ;
}
catch ( RenderTargetNotReadyException )
{
@ -41,6 +41,10 @@ internal class VulkanContext : IVulkanPlatformGraphicsContext
{
if ( featureType = = typeof ( IVulkanContextExternalObjectsFeature ) )
return _ externalObjectsFeature ;
if ( featureType = = typeof ( IVulkanKhrSurfacePlatformSurfaceFactory ) )
return _ surfaceFactory ;
return null ;
}
@ -71,4 +75,4 @@ internal class VulkanContext : IVulkanPlatformGraphicsContext
throw new VulkanException ( "Unable to find a suitable platform surface" ) ;
}
}
}