-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GPU interop features now don't require to skip the first frame and av…
…ailable earlier in general (#14651) # Conflicts: # src/iOS/Avalonia.iOS/Platform.cs
- Loading branch information
Showing
13 changed files
with
139 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.UserApis.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Avalonia.Platform; | ||
using Avalonia.Utilities; | ||
|
||
namespace Avalonia.Rendering.Composition.Server; | ||
|
||
internal partial class ServerCompositor | ||
{ | ||
private IReadOnlyDictionary<Type, object>? _renderInterfaceFeatureCache; | ||
private readonly object _renderInterfaceFeaturesUserApiLock = new(); | ||
|
||
void RT_OnContextCreated(IPlatformRenderInterfaceContext context) | ||
{ | ||
lock (_renderInterfaceFeaturesUserApiLock) | ||
{ | ||
_renderInterfaceFeatureCache = null; | ||
_renderInterfaceFeatureCache = context.PublicFeatures.ToDictionary(x => x.Key, x => x.Value); | ||
} | ||
} | ||
|
||
bool RT_OnContextLostExceptionFilterObserver(Exception e) | ||
{ | ||
if (e is PlatformGraphicsContextLostException) | ||
{ | ||
lock (_renderInterfaceFeaturesUserApiLock) | ||
_renderInterfaceFeatureCache = null; | ||
} | ||
return false; | ||
} | ||
|
||
void RT_OnContextDisposed() | ||
{ | ||
lock (_renderInterfaceFeaturesUserApiLock) | ||
_renderInterfaceFeatureCache = null; | ||
} | ||
|
||
public IReadOnlyDictionary<Type, object>? AT_TryGetCachedRenderInterfaceFeatures() | ||
{ | ||
lock (_renderInterfaceFeaturesUserApiLock) | ||
return _renderInterfaceFeatureCache; | ||
} | ||
|
||
public IReadOnlyDictionary<Type, object> RT_GetRenderInterfaceFeatures() | ||
{ | ||
lock (_renderInterfaceFeaturesUserApiLock) | ||
return _renderInterfaceFeatureCache ??= RenderInterface.Value.PublicFeatures; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters