Use OpenGL ES graphics backend per default on Android

As Vulkan crashes immediately on launch on a lot of Android devices (for around 15% of users that commented on the Android beta on Discord).

The previous usage of the OpenGL backend in the shortcuts was incorrect, as this backend is not strictly available on Android and the GLES backend should be used instead, as this is also what is displayed in the graphics settings.
This commit is contained in:
Robert Müller 2024-09-24 13:35:36 +02:00
parent 193b33b0d7
commit 24ebb54971
4 changed files with 9 additions and 7 deletions

View file

@ -29,8 +29,8 @@ public class NativeMain extends SDLActivity {
if(gfxBackend != null) {
if(gfxBackend.equals("Vulkan")) {
launchArguments = new String[] {"gfx_backend Vulkan"};
} else if(gfxBackend.equals("OpenGL")) {
launchArguments = new String[] {"gfx_backend OpenGL"};
} else if(gfxBackend.equals("GLES")) {
launchArguments = new String[] {"gfx_backend GLES"};
}
}
}

View file

@ -2,5 +2,5 @@
<resources>
<string name="app_name">DDNet</string>
<string name="shortcut_play_vulkan_short">Play (Vulkan)</string>
<string name="shortcut_play_opengl_short">Play (OpenGL)</string>
<string name="shortcut_play_gles_short">Play (OpenGL ES)</string>
</resources>

View file

@ -14,17 +14,17 @@
</intent>
</shortcut>
<shortcut
android:shortcutId="play-opengl"
android:shortcutId="play-gles"
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:shortcutShortLabel="@string/shortcut_play_opengl_short">
android:shortcutShortLabel="@string/shortcut_play_gles_short">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.ddnet.client"
android:targetClass="org.ddnet.client.NativeMain">
<extra
android:name="gfx-backend"
android:value="OpenGL" />
android:value="GLES" />
</intent>
</shortcut>
</shortcuts>

View file

@ -717,7 +717,9 @@ MACRO_CONFIG_STR(Gfx3DTextureAnalysisRenderer, gfx_3d_texture_analysis_renderer,
MACRO_CONFIG_STR(Gfx3DTextureAnalysisVersion, gfx_3d_texture_analysis_version, 128, "", CFGFLAG_SAVE | CFGFLAG_CLIENT, "The version on which the analysis was performed")
MACRO_CONFIG_STR(GfxGpuName, gfx_gpu_name, 256, "auto", CFGFLAG_SAVE | CFGFLAG_CLIENT, "The GPU's name, which will be selected by the backend. (if supported by the backend)")
#if !defined(CONF_ARCH_IA32) && !defined(CONF_PLATFORM_MACOS)
#if defined(CONF_PLATFORM_ANDROID)
MACRO_CONFIG_STR(GfxBackend, gfx_backend, 256, "GLES", CFGFLAG_SAVE | CFGFLAG_CLIENT, "The backend to use (e.g. GLES or Vulkan)")
#elif !defined(CONF_ARCH_IA32) && !defined(CONF_PLATFORM_MACOS)
MACRO_CONFIG_STR(GfxBackend, gfx_backend, 256, "Vulkan", CFGFLAG_SAVE | CFGFLAG_CLIENT, "The backend to use (e.g. OpenGL or Vulkan)")
#else
MACRO_CONFIG_STR(GfxBackend, gfx_backend, 256, "OpenGL", CFGFLAG_SAVE | CFGFLAG_CLIENT, "The backend to use (e.g. OpenGL or Vulkan)")