mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 21:52:51 +00:00
Merge pull request #93571 from Alex2782/g3.x_fix_GLSurfaceView
[3.x] Fix lost old callback when continuous call `requestRenderAndNotify`
This commit is contained in:
commit
9a6b424c94
@ -869,7 +869,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
|
|||||||
*/
|
*/
|
||||||
public interface EGLConfigChooser {
|
public interface EGLConfigChooser {
|
||||||
/**
|
/**
|
||||||
* Choose a configuration from the list. Implementors typically
|
* Choose a configuration from the list. Implementers typically
|
||||||
* implement this method by calling
|
* implement this method by calling
|
||||||
* {@link EGL10#eglChooseConfig} and iterating through the results. Please consult the
|
* {@link EGL10#eglChooseConfig} and iterating through the results. Please consult the
|
||||||
* EGL specification available from The Khronos Group to learn how to call eglChooseConfig.
|
* EGL specification available from The Khronos Group to learn how to call eglChooseConfig.
|
||||||
@ -1673,7 +1673,24 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
|
|||||||
mWantRenderNotification = true;
|
mWantRenderNotification = true;
|
||||||
mRequestRender = true;
|
mRequestRender = true;
|
||||||
mRenderComplete = false;
|
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();
|
sGLThreadManager.notifyAll();
|
||||||
}
|
}
|
||||||
@ -1938,4 +1955,3 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
|
|||||||
private int mEGLContextClientVersion;
|
private int mEGLContextClientVersion;
|
||||||
private boolean mPreserveEGLContextOnPause;
|
private boolean mPreserveEGLContextOnPause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user