diff --git a/src/Avalonia.Base/Platform/IRenderTarget.cs b/src/Avalonia.Base/Platform/IRenderTarget.cs
index 0bc84c7a145..b6c1734891e 100644
--- a/src/Avalonia.Base/Platform/IRenderTarget.cs
+++ b/src/Avalonia.Base/Platform/IRenderTarget.cs
@@ -33,7 +33,10 @@ public interface IRenderTarget : IDisposable
///
PlatformRenderTargetState PlatformRenderTargetState => PlatformRenderTargetState.Ready;
- public record struct RenderTargetSceneInfo(PixelSize Size, double Scaling, Size LogicalSize, CompositionTransparencyLevel TransparencyLevel)
+ // TopLevelSpecificSceneInfo is an opaque immutable object provided by the platform's
+ // ITopLevelImpl.TopLevelSpecificSceneInfo.
+ public record struct RenderTargetSceneInfo(PixelSize Size, double Scaling, Size LogicalSize,
+ CompositionTransparencyLevel TransparencyLevel, object? TopLevelSpecificSceneInfo = null)
{
public RenderTargetSceneInfo(PixelSize size, double scaling, CompositionTransparencyLevel transparencyLevel) : this(size, scaling, size.ToSize(scaling), transparencyLevel)
{
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
index 72d1eac2785..f16a6e164e6 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
@@ -205,7 +205,9 @@ public void Render()
try
{
renderTargetContext =
- _renderTarget.CreateDrawingContext(new(PixelSize, Scaling, Size, TransparencyLevel), out properties);
+ _renderTarget.CreateDrawingContext(
+ new(PixelSize, Scaling, Size, TransparencyLevel, TopLevelSpecificSceneInfo),
+ out properties);
}
catch (RenderTargetNotReadyException)
{
diff --git a/src/Avalonia.Base/composition-schema.xml b/src/Avalonia.Base/composition-schema.xml
index 1256355fa49..98f860fd0bf 100644
--- a/src/Avalonia.Base/composition-schema.xml
+++ b/src/Avalonia.Base/composition-schema.xml
@@ -11,6 +11,7 @@
+
diff --git a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs
index 548d4989b67..eaed786f17b 100644
--- a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs
+++ b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs
@@ -76,6 +76,18 @@ public interface ITopLevelImpl : IOptionalFeatureProvider, IDisposable
///
Action? TransparencyLevelChanged { get; set; }
+ ///
+ /// Gets an opaque platform-specific object with extra information about the scene,
+ /// to be passed to the platform render target with each frame.
+ /// The object must be immutable; implementations must publish a new instance on change.
+ ///
+ object? TopLevelSpecificSceneInfo => null;
+
+ ///
+ /// Gets or sets a method called when changes.
+ ///
+ Action