Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Uno.UI.Runtime.Skia.Android/ApplicationActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public partial class ApplicationActivity : Controls.NativePage
private static bool _started;
private bool _isContentViewSet;

/// <summary>
/// Set by the GL thread after the first Skia frame has been rendered.
/// Used to keep the splash screen visible until pixels are ready.
/// </summary>
internal volatile bool FirstFrameRendered;

/// <summary>
/// The windows model implies only one managed activity.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions src/Uno.UI.Runtime.Skia.Android/Rendering/UnoSKCanvasView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ void IRenderer.OnDrawFrame(IGL10? gl)
// else : we already drew directly on the OpenGL-backed canvas

_context!.Flush();

if (!ApplicationActivity.Instance.FirstFrameRendered)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equivalent signaling is missing from UnoSKVulkanView.RenderFrame(). When FeatureConfiguration.Rendering.UseVulkanOnSkiaAndroid = true, the Vulkan renderer renders frames but never sets FirstFrameRendered = true, so OnPreDraw() keeps returning false and the splash screen is held forever.

The same block (set flag → post Invalidate) should be placed after _vulkanContext.RenderFrame(...) in UnoSKVulkanView.RenderFrame().

Fix this →

{
ApplicationActivity.Instance.FirstFrameRendered = true;
// Trigger OnPreDraw re-evaluation so the splash can dismiss once the first frame is on screen
ApplicationActivity.RelativeLayout?.Post(() =>
ApplicationActivity.RelativeLayout?.Invalidate());
}
}

void IRenderer.OnSurfaceChanged(IGL10? gl, int width, int height)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ public ActivationPreDrawListener(IntPtr handle, JniHandleOwnership transfer)

public bool OnPreDraw()
{
if (_windowWrapper._contentViewAttachedToWindow)
if (_windowWrapper._contentViewAttachedToWindow
&& MUX.ApplicationActivity.Instance?.FirstFrameRendered == true)
{
_windowWrapper.RemovePreDrawListener();
return true;
Expand Down
Loading