Skip to content
Merged
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
5 changes: 3 additions & 2 deletions osu.Android/Native/VulkanRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public VulkanRenderer()
nativePtr = nVulkanCreate();
}

public void Initialize(IntPtr surface) => nVulkanInit(nativePtr, surface);
public bool Initialize(IntPtr surface) => nVulkanInit(nativePtr, surface);

public void Render()
{
Expand Down Expand Up @@ -58,7 +58,8 @@ protected virtual void Dispose(bool disposing)
private static extern void nVulkanDestroy(long ptr);

[DllImport("osu.Android.Native")]
private static extern void nVulkanInit(long ptr, IntPtr surface);
[return: MarshalAs(UnmanagedType.U1)]
private static extern bool nVulkanInit(long ptr, IntPtr surface);

[DllImport("osu.Android.Native")]
private static extern void nVulkanRender(long ptr);
Expand Down
7 changes: 5 additions & 2 deletions osu.Android/OsuGameActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,16 @@ await Task.WhenAll(uris.Select(async uri =>
return findSurfaceView(rootView)?.Holder?.Surface;
}

public IntPtr GetSurfaceHandleSafe()
public IntPtr GetSurfaceGlobalRef()
{
var tcs = new TaskCompletionSource<IntPtr>();
RunOnUiThread(() =>
{
var surface = GetSurface();
tcs.SetResult(surface?.Handle ?? IntPtr.Zero);
if (surface != null && surface.Handle != IntPtr.Zero)
tcs.SetResult(global::Android.Runtime.JNIEnv.NewGlobalRef(surface.Handle));
else
tcs.SetResult(IntPtr.Zero);
});
tcs.Task.WaitSafely();
return tcs.Task.GetResultSafely();
Expand Down
19 changes: 15 additions & 4 deletions osu.Android/OsuGameAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,21 @@ protected override void LoadComplete()
try
{
vulkanRenderer = new Native.VulkanRenderer();
vulkanRenderer.Initialize(gameActivity.GetSurfaceHandleSafe());

vulkanHook = new VulkanHook(() => vulkanRenderer?.Render());
Add(vulkanHook);
var surfaceRef = gameActivity.GetSurfaceGlobalRef();
bool success = vulkanRenderer.Initialize(surfaceRef);
if (surfaceRef != IntPtr.Zero)
global::Android.Runtime.JNIEnv.DeleteGlobalRef(surfaceRef);

if (success)
{
vulkanHook = new VulkanHook(() => vulkanRenderer?.Render());
Add(vulkanHook);
}
else
{
Debug.WriteLine("Failed to initialize Vulkan: Native initialization returned false.");
cleanupVulkan();
}
}
catch (Exception ex)
{
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Tests/NonVisual/TestSceneUpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void TestUserRequest()
/// User requests should start a new invocation and cancel the existing one.
/// </summary>
[Test]
[FlakyTest]
public void TestUserRequestOverridesExistingCheck()
{
// This part covering double user input is not really possible because the settings button is disabled during the check,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void TestUseTheseModsUnavailableIfNoFreeMods()
Screens.OnlinePlay.DailyChallenge.DailyChallenge screen = null!;
AddStep("push screen", () => LoadScreen(screen = new Screens.OnlinePlay.DailyChallenge.DailyChallenge(room)));
AddUntilStep("wait for pushed", () => screen.IsCurrentScreen());
AddUntilStep("wait for scores", () => this.ChildrenOfType<BeatmapLeaderboardScore>().Count() > 1);
AddStep("force transforms to finish", () => FinishTransforms(true));
AddStep("right click second score", () =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void SetUp() => Schedule(() =>
});

[Test]
[FlakyTest]
public void TestOsuInputNotReceivedWhilePaused()
{
KeyCounter counter = null!;
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void TestBasic()
}

[Test]
[FlakyTest]
public void TestSeekToKnownTime()
{
AddStep("seek to known time", () => gameplayClockContainer.Seek(60000));
Expand Down