You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Fix Compatibility Rendering (GLES3) on old and low budget devices.
Co-Authored-By: joined72 <19651914+joined72@users.noreply.github.com>
This commit is contained in:
@@ -1673,7 +1673,24 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
|
||||
mWantRenderNotification = true;
|
||||
mRequestRender = true;
|
||||
mRenderComplete = false;
|
||||
mFinishDrawingRunnable = finishDrawing;
|
||||
|
||||
// fix lost old callback when continuous call requestRenderAndNotify
|
||||
//
|
||||
// If continuous call requestRenderAndNotify before trigger old
|
||||
// callback, old callback will lose, cause VRI will wait for SV's
|
||||
// draw to finish forever not calling finishDraw.
|
||||
// https://android.googlesource.com/platform/frameworks/base/+/044fce0b826f2da3a192aac56785b5089143e693%5E%21/
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
final Runnable oldCallback = mFinishDrawingRunnable;
|
||||
mFinishDrawingRunnable = () -> {
|
||||
if (oldCallback != null) {
|
||||
oldCallback.run();
|
||||
}
|
||||
if (finishDrawing != null) {
|
||||
finishDrawing.run();
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------
|
||||
|
||||
sGLThreadManager.notifyAll();
|
||||
}
|
||||
|
||||
@@ -66,11 +66,15 @@ public class RegularContextFactory implements GLSurfaceView.EGLContextFactory {
|
||||
|
||||
GLUtils.checkEglError(TAG, "Before eglCreateContext", egl);
|
||||
EGLContext context;
|
||||
int[] debug_attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 3, _EGL_CONTEXT_FLAGS_KHR, _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE };
|
||||
int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE };
|
||||
if (mUseDebugOpengl) {
|
||||
int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 3, _EGL_CONTEXT_FLAGS_KHR, _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE };
|
||||
context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
|
||||
context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, debug_attrib_list);
|
||||
if (context == null || context == EGL10.EGL_NO_CONTEXT) {
|
||||
Log.w(TAG, "creating 'OpenGL Debug' context failed");
|
||||
context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
|
||||
}
|
||||
} else {
|
||||
int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE };
|
||||
context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
|
||||
}
|
||||
GLUtils.checkEglError(TAG, "After eglCreateContext", egl);
|
||||
|
||||
Reference in New Issue
Block a user