@ -98,6 +98,13 @@ partial class MediaContext
if ( AvaloniaLocator . Current . GetService < IPlatformRenderInterface > ( ) = = null )
if ( AvaloniaLocator . Current . GetService < IPlatformRenderInterface > ( ) = = null )
return ;
return ;
using var _ = NonPumpingLockHelper . Use ( ) ;
SyncWaitCompositorBatch ( compositor , CommitCompositor ( compositor ) , waitFullRender , catchExceptions ) ;
}
private void SyncWaitCompositorBatch ( Compositor compositor , CompositionBatch batch ,
bool waitFullRender , bool catchExceptions )
{
using var _ = NonPumpingLockHelper . Use ( ) ;
using var _ = NonPumpingLockHelper . Use ( ) ;
if ( compositor is
if ( compositor is
{
{
@ -105,12 +112,10 @@ partial class MediaContext
Loop . RunsInBackground : true
Loop . RunsInBackground : true
} )
} )
{
{
var batch = CommitCompositor ( compositor ) ;
( waitFullRender ? batch . Rendered : batch . Processed ) . Wait ( ) ;
( waitFullRender ? batch . Rendered : batch . Processed ) . Wait ( ) ;
}
}
else
else
{
{
CommitCompositor ( compositor ) ;
compositor . Server . Render ( catchExceptions ) ;
compositor . Server . Render ( catchExceptions ) ;
}
}
}
}
@ -132,10 +137,15 @@ partial class MediaContext
/// </summary>
/// </summary>
public void SyncDisposeCompositionTarget ( CompositionTarget compositionTarget )
public void SyncDisposeCompositionTarget ( CompositionTarget compositionTarget )
{
{
compositionTarget . Dispose ( ) ;
using var _ = NonPumpingLockHelper . Use ( ) ;
// TODO: We are sending a dispose command outside of the normal commit cycle and we might
// want to ask the compositor to skip any actual rendering and return the control ASAP
// Not sure if we should do that for background thread rendering since it might affect the animation
// smoothness of other windows
// TODO: introduce a way to skip any actual rendering for other targets and only do a dispose?
var oobBatch = compositionTarget . Compositor . OobDispose ( compositionTarget ) ;
SyncCommit ( compositionTarget . Compositor , false , true ) ;
SyncWaitCompositorBatch ( compositionTarget . Compositor , oobBatch , false , true ) ;
}
}
/// <summary>
/// <summary>