Skip to content

Commit 793a587

Browse files
Fix 3 CI build errors, re-enable Vulkan on all Android GPUs
- CS0122: BassAudioMixer is internal to framework, use reflection for Handle - CS0104: Qualify Environment.ProcessorCount as System.Environment - CS8602: Add null check on Window.DecorView before setting PointerIcon - Remove unused refreshRateDropdown field (InspectCode warning) - Re-enable Vulkan in renderer dropdown for all supported GPUs (not just recommended) Users with Adreno 7xx (S23 Ultra) can now see and select Vulkan Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/399426d4-c22f-491c-9cdd-8970c556a3db Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
1 parent e14baf6 commit 793a587

6 files changed

Lines changed: 17 additions & 22 deletions

File tree

osu.Android/AndroidNativeBridgeManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void StartOboeBridge(Scheduler scheduler, Action<double> onLatencyMeasure
4848

4949
// Calculate dynamic big-core mask for audio thread, matching the pattern in OsuGameAndroid.LoadComplete
5050
int audioAffinityMask;
51-
int cores = Environment.ProcessorCount;
51+
int cores = System.Environment.ProcessorCount;
5252
int bigStart = Math.Max(cores / 2, 1);
5353
audioAffinityMask = 0;
5454

osu.Android/OboeAudioRedirector.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
using ManagedBass.Mix;
1313
using osu.Framework.Audio;
1414
using osu.Framework.Audio.Mixing;
15-
using osu.Framework.Audio.Mixing.Bass;
1615

1716
namespace osu.Android
1817
{
1918
/// <summary>
2019
/// Redirects audio from BASS mixers into an unmanaged callback (Oboe).
21-
/// Uses BassAudioMixer.Handle directly instead of fragile reflection-based handle discovery.
20+
/// Discovers mixer handles via reflection since BassAudioMixer is internal to the framework.
2221
/// </summary>
2322
public class OboeAudioRedirector : IDisposable
2423
{
@@ -285,19 +284,14 @@ private void addMixer(AudioMixer? mixer)
285284
}
286285

287286
/// <summary>
288-
/// Gets the BASS handle from an AudioMixer using the public BassAudioMixer.Handle property.
289-
/// This replaces the previous fragile reflection-based approach.
287+
/// Gets the BASS handle from an AudioMixer via reflection.
288+
/// BassAudioMixer is internal to the framework, so we access its Handle property via reflection.
290289
/// </summary>
291290
private static int getHandle(AudioMixer mixer)
292291
{
293-
if (mixer is BassAudioMixer bassMixer)
294-
return bassMixer.Handle;
295-
296-
// Fallback: if the mixer is not a BassAudioMixer (shouldn't happen in practice),
297-
// try reflection as a last resort.
298292
try
299293
{
300-
var handleProp = mixer.GetType().GetProperty("Handle", BindingFlags.Instance | BindingFlags.Public);
294+
var handleProp = mixer.GetType().GetProperty("Handle", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
301295
if (handleProp?.GetValue(mixer) is int h)
302296
return h;
303297
}

osu.Android/OsuGameActivity.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ protected override void OnCreate(Bundle? savedInstanceState)
114114
{
115115
try
116116
{
117-
Window.DecorView.PointerIcon = PointerIcon.GetSystemIcon(this, PointerIconType.Null);
117+
var decorView = Window.DecorView;
118+
119+
if (decorView != null)
120+
decorView.PointerIcon = PointerIcon.GetSystemIcon(this, PointerIconType.Null);
118121
}
119122
catch (Exception e)
120123
{

osu.Android/OsuGameAndroid.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ protected override void LoadComplete()
199199
{
200200
// Calculate big-core affinity mask dynamically based on device core count.
201201
// On big.LITTLE architectures, the upper half of cores are typically performance cores.
202-
int coreCount = Environment.ProcessorCount;
202+
int coreCount = System.Environment.ProcessorCount;
203203
int bigCoreStart = Math.Max(coreCount / 2, 1);
204204
int affinityMask = 0;
205205

osu.Game/Overlays/Settings/Sections/Graphics/AndroidPerformanceSettings.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private void load(OsuConfigManager config, OsuGame? game)
2929
HintText = "Enables sustained performance mode, immersive fullscreen, and auto-selects the highest refresh rate. Auto-enabled in DeX mode.",
3030
Current = config.GetBindable<bool>(OsuSetting.AndroidPerformanceMode),
3131
}),
32-
new SettingsItemV2(refreshRateDropdown = new RefreshRateDropdown
32+
new SettingsItemV2(new RefreshRateDropdown
3333
{
3434
Caption = "Display refresh rate",
3535
HintText = "Select the display refresh rate. In DeX mode, this controls the external monitor's refresh rate.",
@@ -60,8 +60,6 @@ private void load(OsuConfigManager config, OsuGame? game)
6060
};
6161
}
6262

63-
private RefreshRateDropdown refreshRateDropdown = null!;
64-
6563
private partial class RefreshRateDropdown : FormDropdown<int>
6664
{
6765
protected override LocalisableString GenerateItemText(int item)

osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, IDi
3232

3333
var rendererItems = host.GetPreferredRenderersForCurrentPlatform().ToList();
3434

35-
// Only show Vulkan on Android if the VulkanProbe recommends it (not just supported).
36-
// On devices with known Vulkan issues (e.g. Adreno 7xx flickering), IsVulkanRecommended
37-
// returns false even though the GPU technically supports Vulkan. Showing the option leads
38-
// users to select it and experience poor performance vs OpenGL ES.
35+
// Always show Vulkan on Android when the GPU supports it, so users can try it.
36+
// The VulkanProbe detects feature support; even if some features are disabled (e.g. on
37+
// Adreno 7xx), the renderer itself may still work and provide better performance than
38+
// OpenGL ES for some workloads.
3939
if (RuntimeInfo.OS == RuntimeInfo.Platform.Android)
4040
{
41-
bool isRecommended = game?.IsVulkanRecommended ?? false;
41+
bool isSupported = game?.IsVulkanSupported ?? false;
4242
bool isCurrentlySelected = renderer.Value == RendererType.Vulkan;
4343

44-
if ((isRecommended || isCurrentlySelected) && !rendererItems.Contains(RendererType.Vulkan))
44+
if ((isSupported || isCurrentlySelected) && !rendererItems.Contains(RendererType.Vulkan))
4545
rendererItems.Add(RendererType.Vulkan);
4646
}
4747

0 commit comments

Comments
 (0)