Merge pull request #59606 from m4gr3d/fix_low_processor_mode_3x

[3.x] Fix flickering issues with low processor mode on Android
This commit is contained in:
Rémi Verschelde 2022-03-29 22:51:32 +02:00 committed by GitHub
commit 3c0d32562b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 2548 additions and 41 deletions

View file

@ -51,7 +51,6 @@ class OS {
bool low_processor_usage_mode;
int low_processor_usage_mode_sleep_usec;
bool _update_vital_only;
bool _update_pending;
bool _verbose_stdout;
bool _debug_stdout;
String _local_clipboard;
@ -77,6 +76,8 @@ class OS {
List<String> restart_commandline;
protected:
bool _update_pending;
void _set_logger(CompositeLogger *p_logger);
public:

View file

@ -33,6 +33,10 @@ while IFS= read -rd '' f; do
continue 2
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/input/InputManager"* ]]; then
continue 2
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView"* ]]; then
continue 2
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper"* ]]; then
continue 2
fi
python misc/scripts/copyright_headers.py "$f"
continue 2

View file

@ -33,6 +33,7 @@ package org.godotengine.godot;
import android.app.Activity;
import android.hardware.SensorEvent;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
/**
@ -66,13 +67,13 @@ public class GodotLib {
* Invoked on the GL thread when the underlying Android surface has changed size.
* @param width
* @param height
* @see android.opengl.GLSurfaceView.Renderer#onSurfaceChanged(GL10, int, int)
* @see org.godotengine.godot.gl.GLSurfaceView.Renderer#onSurfaceChanged(GL10, int, int)
*/
public static native void resize(int width, int height);
/**
* Invoked on the GL thread when the underlying Android surface is created or recreated.
* @see android.opengl.GLSurfaceView.Renderer#onSurfaceCreated(GL10, EGLConfig)
* @see org.godotengine.godot.gl.GLSurfaceView.Renderer#onSurfaceCreated(GL10, EGLConfig)
*/
public static native void newcontext();
@ -83,9 +84,9 @@ public class GodotLib {
/**
* Invoked on the GL thread to draw the current frame.
* @see android.opengl.GLSurfaceView.Renderer#onDrawFrame(GL10)
* @see org.godotengine.godot.gl.GLSurfaceView.Renderer#onDrawFrame(GL10)
*/
public static native void step();
public static native boolean step();
/**
* Forward touch events from the main thread to the GL thread.

View file

@ -30,11 +30,9 @@
package org.godotengine.godot;
import org.godotengine.godot.gl.GLSurfaceView;
import org.godotengine.godot.plugin.GodotPlugin;
import org.godotengine.godot.plugin.GodotPluginRegistry;
import org.godotengine.godot.utils.GLUtils;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
@ -50,19 +48,21 @@ class GodotRenderer implements GLSurfaceView.Renderer {
this.pluginRegistry = GodotPluginRegistry.getPluginRegistry();
}
public void onDrawFrame(GL10 gl) {
public boolean onDrawFrame(GL10 gl) {
if (activityJustResumed) {
GodotLib.onRendererResumed();
activityJustResumed = false;
}
GodotLib.step();
boolean swapBuffers = GodotLib.step();
for (int i = 0; i < Godot.singleton_count; i++) {
Godot.singletons[i].onGLDrawFrame(gl);
}
for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) {
plugin.onGLDrawFrame(gl);
}
return swapBuffers;
}
public void onSurfaceChanged(GL10 gl, int width, int height) {

View file

@ -30,6 +30,7 @@
package org.godotengine.godot;
import org.godotengine.godot.gl.GLSurfaceView;
import org.godotengine.godot.input.GodotGestureHandler;
import org.godotengine.godot.input.GodotInputHandler;
import org.godotengine.godot.utils.GLUtils;
@ -44,7 +45,6 @@ import org.godotengine.godot.xr.regular.RegularFallbackConfigChooser;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;

View file

@ -0,0 +1,566 @@
// clang-format off
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.godotengine.godot.gl;
import android.opengl.GLDebugHelper;
import android.opengl.GLException;
import java.io.IOException;
import java.io.Writer;
import javax.microedition.khronos.egl.EGL;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGL11;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
class EGLLogWrapper implements EGL11 {
private EGL10 mEgl10;
Writer mLog;
boolean mLogArgumentNames;
boolean mCheckError;
private int mArgCount;
public EGLLogWrapper(EGL egl, int configFlags, Writer log) {
mEgl10 = (EGL10) egl;
mLog = log;
mLogArgumentNames =
(GLDebugHelper.CONFIG_LOG_ARGUMENT_NAMES & configFlags) != 0;
mCheckError =
(GLDebugHelper.CONFIG_CHECK_GL_ERROR & configFlags) != 0;
}
public boolean eglChooseConfig(EGLDisplay display, int[] attrib_list,
EGLConfig[] configs, int config_size, int[] num_config) {
begin("eglChooseConfig");
arg("display", display);
arg("attrib_list", attrib_list);
arg("config_size", config_size);
end();
boolean result = mEgl10.eglChooseConfig(display, attrib_list, configs,
config_size, num_config);
arg("configs", configs);
arg("num_config", num_config);
returns(result);
checkError();
return result;
}
public boolean eglCopyBuffers(EGLDisplay display, EGLSurface surface,
Object native_pixmap) {
begin("eglCopyBuffers");
arg("display", display);
arg("surface", surface);
arg("native_pixmap", native_pixmap);
end();
boolean result = mEgl10.eglCopyBuffers(display, surface, native_pixmap);
returns(result);
checkError();
return result;
}
public EGLContext eglCreateContext(EGLDisplay display, EGLConfig config,
EGLContext share_context, int[] attrib_list) {
begin("eglCreateContext");
arg("display", display);
arg("config", config);
arg("share_context", share_context);
arg("attrib_list", attrib_list);
end();
EGLContext result = mEgl10.eglCreateContext(display, config,
share_context, attrib_list);
returns(result);
checkError();
return result;
}
public EGLSurface eglCreatePbufferSurface(EGLDisplay display,
EGLConfig config, int[] attrib_list) {
begin("eglCreatePbufferSurface");
arg("display", display);
arg("config", config);
arg("attrib_list", attrib_list);
end();
EGLSurface result = mEgl10.eglCreatePbufferSurface(display, config,
attrib_list);
returns(result);
checkError();
return result;
}
public EGLSurface eglCreatePixmapSurface(EGLDisplay display,
EGLConfig config, Object native_pixmap, int[] attrib_list) {
begin("eglCreatePixmapSurface");
arg("display", display);
arg("config", config);
arg("native_pixmap", native_pixmap);
arg("attrib_list", attrib_list);
end();
EGLSurface result = mEgl10.eglCreatePixmapSurface(display, config,
native_pixmap, attrib_list);
returns(result);
checkError();
return result;
}
public EGLSurface eglCreateWindowSurface(EGLDisplay display,
EGLConfig config, Object native_window, int[] attrib_list) {
begin("eglCreateWindowSurface");
arg("display", display);
arg("config", config);
arg("native_window", native_window);
arg("attrib_list", attrib_list);
end();
EGLSurface result = mEgl10.eglCreateWindowSurface(display, config,
native_window, attrib_list);
returns(result);
checkError();
return result;
}
public boolean eglDestroyContext(EGLDisplay display, EGLContext context) {
begin("eglDestroyContext");
arg("display", display);
arg("context", context);
end();
boolean result = mEgl10.eglDestroyContext(display, context);
returns(result);
checkError();
return result;
}
public boolean eglDestroySurface(EGLDisplay display, EGLSurface surface) {
begin("eglDestroySurface");
arg("display", display);
arg("surface", surface);
end();
boolean result = mEgl10.eglDestroySurface(display, surface);
returns(result);
checkError();
return result;
}
public boolean eglGetConfigAttrib(EGLDisplay display, EGLConfig config,
int attribute, int[] value) {
begin("eglGetConfigAttrib");
arg("display", display);
arg("config", config);
arg("attribute", attribute);
end();
boolean result = mEgl10.eglGetConfigAttrib(display, config, attribute,
value);
arg("value", value);
returns(result);
checkError();
return false;
}
public boolean eglGetConfigs(EGLDisplay display, EGLConfig[] configs,
int config_size, int[] num_config) {
begin("eglGetConfigs");
arg("display", display);
arg("config_size", config_size);
end();
boolean result = mEgl10.eglGetConfigs(display, configs, config_size,
num_config);
arg("configs", configs);
arg("num_config", num_config);
returns(result);
checkError();
return result;
}
public EGLContext eglGetCurrentContext() {
begin("eglGetCurrentContext");
end();
EGLContext result = mEgl10.eglGetCurrentContext();
returns(result);
checkError();
return result;
}
public EGLDisplay eglGetCurrentDisplay() {
begin("eglGetCurrentDisplay");
end();
EGLDisplay result = mEgl10.eglGetCurrentDisplay();
returns(result);
checkError();
return result;
}
public EGLSurface eglGetCurrentSurface(int readdraw) {
begin("eglGetCurrentSurface");
arg("readdraw", readdraw);
end();
EGLSurface result = mEgl10.eglGetCurrentSurface(readdraw);
returns(result);
checkError();
return result;
}
public EGLDisplay eglGetDisplay(Object native_display) {
begin("eglGetDisplay");
arg("native_display", native_display);
end();
EGLDisplay result = mEgl10.eglGetDisplay(native_display);
returns(result);
checkError();
return result;
}
public int eglGetError() {
begin("eglGetError");
end();
int result = mEgl10.eglGetError();
returns(getErrorString(result));
return result;
}
public boolean eglInitialize(EGLDisplay display, int[] major_minor) {
begin("eglInitialize");
arg("display", display);
end();
boolean result = mEgl10.eglInitialize(display, major_minor);
returns(result);
arg("major_minor", major_minor);
checkError();
return result;
}
public boolean eglMakeCurrent(EGLDisplay display, EGLSurface draw,
EGLSurface read, EGLContext context) {
begin("eglMakeCurrent");
arg("display", display);
arg("draw", draw);
arg("read", read);
arg("context", context);
end();
boolean result = mEgl10.eglMakeCurrent(display, draw, read, context);
returns(result);
checkError();
return result;
}
public boolean eglQueryContext(EGLDisplay display, EGLContext context,
int attribute, int[] value) {
begin("eglQueryContext");
arg("display", display);
arg("context", context);
arg("attribute", attribute);
end();
boolean result = mEgl10.eglQueryContext(display, context, attribute,
value);
returns(value[0]);
returns(result);
checkError();
return result;
}
public String eglQueryString(EGLDisplay display, int name) {
begin("eglQueryString");
arg("display", display);
arg("name", name);
end();
String result = mEgl10.eglQueryString(display, name);
returns(result);
checkError();
return result;
}
public boolean eglQuerySurface(EGLDisplay display, EGLSurface surface,
int attribute, int[] value) {
begin("eglQuerySurface");
arg("display", display);
arg("surface", surface);
arg("attribute", attribute);
end();
boolean result = mEgl10.eglQuerySurface(display, surface, attribute,
value);
returns(value[0]);
returns(result);
checkError();
return result;
}
public boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface) {
begin("eglSwapBuffers");
arg("display", display);
arg("surface", surface);
end();
boolean result = mEgl10.eglSwapBuffers(display, surface);
returns(result);
checkError();
return result;
}
public boolean eglTerminate(EGLDisplay display) {
begin("eglTerminate");
arg("display", display);
end();
boolean result = mEgl10.eglTerminate(display);
returns(result);
checkError();
return result;
}
public boolean eglWaitGL() {
begin("eglWaitGL");
end();
boolean result = mEgl10.eglWaitGL();
returns(result);
checkError();
return result;
}
public boolean eglWaitNative(int engine, Object bindTarget) {
begin("eglWaitNative");
arg("engine", engine);
arg("bindTarget", bindTarget);
end();
boolean result = mEgl10.eglWaitNative(engine, bindTarget);
returns(result);
checkError();
return result;
}
private void checkError() {
int eglError;
if ((eglError = mEgl10.eglGetError()) != EGL_SUCCESS) {
String errorMessage = "eglError: " + getErrorString(eglError);
logLine(errorMessage);
if (mCheckError) {
throw new GLException(eglError, errorMessage);
}
}
}
private void logLine(String message) {
log(message + '\n');
}
private void log(String message) {
try {
mLog.write(message);
} catch (IOException e) {
// Ignore exception, keep on trying
}
}
private void begin(String name) {
log(name + '(');
mArgCount = 0;
}
private void arg(String name, String value) {
if (mArgCount++ > 0) {
log(", ");
}
if (mLogArgumentNames) {
log(name + "=");
}
log(value);
}
private void end() {
log(");\n");
flush();
}
private void flush() {
try {
mLog.flush();
} catch (IOException e) {
mLog = null;
}
}
private void arg(String name, int value) {
arg(name, Integer.toString(value));
}
private void arg(String name, Object object) {
arg(name, toString(object));
}
private void arg(String name, EGLDisplay object) {
if (object == EGL10.EGL_DEFAULT_DISPLAY) {
arg(name, "EGL10.EGL_DEFAULT_DISPLAY");
} else if (object == EGL_NO_DISPLAY) {
arg(name, "EGL10.EGL_NO_DISPLAY");
} else {
arg(name, toString(object));
}
}
private void arg(String name, EGLContext object) {
if (object == EGL10.EGL_NO_CONTEXT) {
arg(name, "EGL10.EGL_NO_CONTEXT");
} else {
arg(name, toString(object));
}
}
private void arg(String name, EGLSurface object) {
if (object == EGL10.EGL_NO_SURFACE) {
arg(name, "EGL10.EGL_NO_SURFACE");
} else {
arg(name, toString(object));
}
}
private void returns(String result) {
log(" returns " + result + ";\n");
flush();
}
private void returns(int result) {
returns(Integer.toString(result));
}
private void returns(boolean result) {
returns(Boolean.toString(result));
}
private void returns(Object result) {
returns(toString(result));
}
private String toString(Object obj) {
if (obj == null) {
return "null";
} else {
return obj.toString();
}
}
private void arg(String name, int[] arr) {
if (arr == null) {
arg(name, "null");
} else {
arg(name, toString(arr.length, arr, 0));
}
}
private void arg(String name, Object[] arr) {
if (arr == null) {
arg(name, "null");
} else {
arg(name, toString(arr.length, arr, 0));
}
}
private String toString(int n, int[] arr, int offset) {
StringBuilder buf = new StringBuilder();
buf.append("{\n");
int arrLen = arr.length;
for (int i = 0; i < n; i++) {
int index = offset + i;
buf.append(" [" + index + "] = ");
if (index < 0 || index >= arrLen) {
buf.append("out of bounds");
} else {
buf.append(arr[index]);
}
buf.append('\n');
}
buf.append("}");
return buf.toString();
}
private String toString(int n, Object[] arr, int offset) {
StringBuilder buf = new StringBuilder();
buf.append("{\n");
int arrLen = arr.length;
for (int i = 0; i < n; i++) {
int index = offset + i;
buf.append(" [" + index + "] = ");
if (index < 0 || index >= arrLen) {
buf.append("out of bounds");
} else {
buf.append(arr[index]);
}
buf.append('\n');
}
buf.append("}");
return buf.toString();
}
private static String getHex(int value) {
return "0x" + Integer.toHexString(value);
}
public static String getErrorString(int error) {
switch (error) {
case EGL_SUCCESS:
return "EGL_SUCCESS";
case EGL_NOT_INITIALIZED:
return "EGL_NOT_INITIALIZED";
case EGL_BAD_ACCESS:
return "EGL_BAD_ACCESS";
case EGL_BAD_ALLOC:
return "EGL_BAD_ALLOC";
case EGL_BAD_ATTRIBUTE:
return "EGL_BAD_ATTRIBUTE";
case EGL_BAD_CONFIG:
return "EGL_BAD_CONFIG";
case EGL_BAD_CONTEXT:
return "EGL_BAD_CONTEXT";
case EGL_BAD_CURRENT_SURFACE:
return "EGL_BAD_CURRENT_SURFACE";
case EGL_BAD_DISPLAY:
return "EGL_BAD_DISPLAY";
case EGL_BAD_MATCH:
return "EGL_BAD_MATCH";
case EGL_BAD_NATIVE_PIXMAP:
return "EGL_BAD_NATIVE_PIXMAP";
case EGL_BAD_NATIVE_WINDOW:
return "EGL_BAD_NATIVE_WINDOW";
case EGL_BAD_PARAMETER:
return "EGL_BAD_PARAMETER";
case EGL_BAD_SURFACE:
return "EGL_BAD_SURFACE";
case EGL11.EGL_CONTEXT_LOST:
return "EGL_CONTEXT_LOST";
default:
return getHex(error);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -30,8 +30,9 @@
package org.godotengine.godot.xr.ovr;
import org.godotengine.godot.gl.GLSurfaceView;
import android.opengl.EGLExt;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;

View file

@ -30,8 +30,9 @@
package org.godotengine.godot.xr.ovr;
import org.godotengine.godot.gl.GLSurfaceView;
import android.opengl.EGL14;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;

View file

@ -30,7 +30,7 @@
package org.godotengine.godot.xr.ovr;
import android.opengl.GLSurfaceView;
import org.godotengine.godot.gl.GLSurfaceView;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;

View file

@ -30,10 +30,9 @@
package org.godotengine.godot.xr.regular;
import org.godotengine.godot.gl.GLSurfaceView;
import org.godotengine.godot.utils.GLUtils;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;

View file

@ -31,9 +31,9 @@
package org.godotengine.godot.xr.regular;
import org.godotengine.godot.GodotLib;
import org.godotengine.godot.gl.GLSurfaceView;
import org.godotengine.godot.utils.GLUtils;
import android.opengl.GLSurfaceView;
import android.util.Log;
import javax.microedition.khronos.egl.EGL10;

View file

@ -30,8 +30,6 @@
package org.godotengine.godot.xr.regular;
import org.godotengine.godot.utils.GLUtils;
import android.util.Log;
import javax.microedition.khronos.egl.EGL10;

View file

@ -18,4 +18,4 @@ target_include_directories(${PROJECT_NAME}
${GODOT_ROOT_DIR}
${GODOT_ROOT_DIR}/modules/gdnative/include)
add_definitions(-DUNIX_ENABLED -DTOOLS_ENABLED)
add_definitions(-DUNIX_ENABLED -DANDROID_ENABLED)

View file

@ -29,8 +29,6 @@ android {
}
}
ndkVersion versions.ndkVersion
externalNativeBuild {
cmake {
path "CMakeLists.txt"

View file

@ -240,9 +240,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jcl
}
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz) {
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz) {
if (step.get() == -1)
return;
return true;
if (step.get() == 0) {
// Since Godot is initialized on the UI thread, _main_thread_id was set to that thread's id,
@ -250,12 +250,12 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jcl
Main::setup2(Thread::get_caller_id());
input_handler = new AndroidInputHandler();
step.increment();
return;
return true;
}
if (step.get() == 1) {
if (!Main::start()) {
return; // should exit instead and print the error
return true; // should exit instead and print the error
}
godot_java->on_godot_setup_completed(env);
@ -269,9 +269,12 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jcl
os_android->process_magnetometer(magnetometer);
os_android->process_gyroscope(gyroscope);
if (os_android->main_loop_iterate()) {
bool should_swap_buffers = false;
if (os_android->main_loop_iterate(&should_swap_buffers)) {
godot_java->force_quit(env);
}
return should_swap_buffers;
}
void touch_preprocessing(JNIEnv *env, jclass clazz, jint input_device, jint ev, jint pointer, jint pointer_count, jfloatArray positions, jint buttons_mask, jfloat vertical_factor, jfloat horizontal_factor) {

View file

@ -42,7 +42,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ondestroy(JNIEnv *env
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jclass clazz, jint width, jint height);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *env, jclass clazz);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz);
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jclass clazz);
void touch_preprocessing(JNIEnv *env, jclass clazz, jint input_device, jint ev, jint pointer, jint pointer_count, jfloatArray positions, jint buttons_mask = 0, jfloat vertical_factor = 0, jfloat horizontal_factor = 0);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch__IIII_3F(JNIEnv *env, jclass clazz, jint input_device, jint ev, jint pointer, jint pointer_count, jfloatArray positions);

View file

@ -292,15 +292,6 @@ void OS_Android::set_keep_screen_on(bool p_enabled) {
godot_java->set_keep_screen_on(p_enabled);
}
void OS_Android::set_low_processor_usage_mode(bool p_enabled) {
#ifdef TOOLS_ENABLED
// Disabled as it causes flickers. We also expect the devices running Godot in editor mode to be high end.
OS_Unix::set_low_processor_usage_mode(false);
#else
OS_Unix::set_low_processor_usage_mode(p_enabled);
#endif
}
Size2 OS_Android::get_window_size() const {
return Vector2(default_videomode.width, default_videomode.height);
}
@ -328,10 +319,16 @@ void OS_Android::main_loop_begin() {
main_loop->init();
}
bool OS_Android::main_loop_iterate() {
bool OS_Android::main_loop_iterate(bool *r_should_swap_buffers) {
if (!main_loop)
return false;
return Main::iteration();
bool exit = Main::iteration();
if (r_should_swap_buffers) {
*r_should_swap_buffers = !is_in_low_processor_usage_mode() || _update_pending;
}
return exit;
}
void OS_Android::main_loop_end() {

View file

@ -113,7 +113,6 @@ public:
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
virtual void set_keep_screen_on(bool p_enabled);
virtual void set_low_processor_usage_mode(bool p_enabled);
virtual Size2 get_window_size() const;
virtual Rect2 get_window_safe_area() const;
@ -124,7 +123,7 @@ public:
virtual bool can_draw() const;
void main_loop_begin();
bool main_loop_iterate();
bool main_loop_iterate(bool *r_should_swap_buffers = nullptr);
void main_loop_end();
void main_loop_focusout();
void main_loop_focusin();