1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #98615 from Summersay415/three-opengls-please

Fix fallbacks to OpenGL
This commit is contained in:
Thaddeus Crews
2024-10-29 19:25:48 -05:00
7 changed files with 76 additions and 42 deletions

View File

@@ -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)
}
@@ -818,6 +823,13 @@ class Godot(private val context: Context) {
return ("forward_plus" == renderer || "mobile" == renderer) && "vulkan" == renderingDevice
}
/**
* 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.
*/