summaryrefslogtreecommitdiffstats
path: root/platform/android/java
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-10-29 19:25:48 -0500
committerThaddeus Crews <repiteo@outlook.com>2024-10-29 19:25:48 -0500
commit05a4620e88fc454e844f69e87a6eb444426c2a6e (patch)
tree2af7c1e884e874234cfec77b3e8d8c4667435f02 /platform/android/java
parent73830b3c120406b10b344063783ba32bbbc2110f (diff)
parent6d14cd6ff96f74199acea2ad449ec2e1d2dcceab (diff)
downloadredot-engine-05a4620e88fc454e844f69e87a6eb444426c2a6e.tar.gz
Merge pull request #98615 from Summersay415/three-opengls-please
Fix fallbacks to OpenGL
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/Godot.kt18
1 files changed, 15 insertions, 3 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt
index f4b9771128..9ad1e0b740 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt
+++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt
@@ -479,12 +479,17 @@ class Godot(private val context: Context) {
// ...add to FrameLayout
containerLayout?.addView(editText)
renderView = if (usesVulkan()) {
- if (!meetsVulkanRequirements(activity.packageManager)) {
+ if (meetsVulkanRequirements(activity.packageManager)) {
+ GodotVulkanRenderView(host, this, godotInputHandler)
+ } else if (canFallbackToOpenGL()) {
+ // Fallback to OpenGl.
+ GodotGLRenderView(host, this, godotInputHandler, xrMode, useDebugOpengl)
+ } else {
throw IllegalStateException(activity.getString(R.string.error_missing_vulkan_requirements_message))
}
- GodotVulkanRenderView(host, this, godotInputHandler)
+
} else {
- // Fallback to openGl
+ // Fallback to OpenGl.
GodotGLRenderView(host, this, godotInputHandler, xrMode, useDebugOpengl)
}
@@ -819,6 +824,13 @@ class Godot(private val context: Context) {
}
/**
+ * Returns true if can fallback to OpenGL.
+ */
+ private fun canFallbackToOpenGL(): Boolean {
+ return java.lang.Boolean.parseBoolean(GodotLib.getGlobal("rendering/rendering_device/fallback_to_opengl3"))
+ }
+
+ /**
* Returns true if the device meets the base requirements for Vulkan support, false otherwise.
*/
private fun meetsVulkanRequirements(packageManager: PackageManager?): Boolean {