Skip to content

Conversation

@m4gr3d
Copy link
Contributor

@m4gr3d m4gr3d commented Apr 18, 2025

Unification and clean up of the Godot Android render logic.

We go from having two SurfaceView renderers, GodotRenderer for OpenGL and VkRenderer for Vulkan, to a single GodotRenderer which covers both.

The render thread management logic has been moved from the Godot SurfaceView implementations to the GodotRenderer renderer, allowing to decouple its initialization from the SurfaceView initialization, and (for future uses) to use the same render thread to power multiple Godot SurfaceView views.

Fixes #98381

@m4gr3d m4gr3d added this to the 4.5 milestone Apr 18, 2025
@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch 6 times, most recently from eef0958 to d803cda Compare April 20, 2025 02:22
@m4gr3d m4gr3d marked this pull request as ready for review April 20, 2025 02:55
@m4gr3d m4gr3d requested a review from a team as a code owner April 20, 2025 02:55
@m4gr3d m4gr3d added the bug label Apr 20, 2025
@dsnopek
Copy link
Contributor

dsnopek commented Apr 21, 2025

I skimmed the code in the 2nd commit and it seems fine to me, but I didn't spend enough time to be comprehensive. I also skimmed over the 3rd and 4th commit with the Kotlin conversion, and that looked OK too.

I tested this on the Meta Quest with both OpenGL and Vulkan, and it worked fine!

@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch 2 times, most recently from 2d882f8 to 699c179 Compare April 22, 2025 19:52
@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch 2 times, most recently from 2d31db6 to 5c814be Compare May 8, 2025 16:47
@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch from 5c814be to fb3af14 Compare May 11, 2025 17:16
@m4gr3d m4gr3d marked this pull request as draft May 15, 2025 16:00
@m4gr3d
Copy link
Contributor Author

m4gr3d commented May 15, 2025

Note for tracking: there's a bug that causes the Android editor to crash when the embedded game window is minimized then brought back to front.

@m4gr3d m4gr3d modified the milestones: 4.5, 4.6 Jun 11, 2025
@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch 2 times, most recently from bcc43d2 to 2fee88c Compare July 16, 2025 15:10
@m4gr3d m4gr3d marked this pull request as ready for review July 16, 2025 15:17
@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch from 2fee88c to f1f6303 Compare July 17, 2025 00:01
@m4gr3d m4gr3d requested a review from a team as a code owner July 17, 2025 00:01
}
try {
view.mRenderer.onSurfaceCreated(gl, mEglHelper.mEglConfig);
mRenderer.onRenderSurfaceCreated(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this always pass null as the surface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically, it's because the native Android OpenGL logic didn't make use of the Android surface given that most of the OpenGL setup was done in the Java layer.

}
try {
view.mRenderer.onSurfaceChanged(gl, w, h);
mRenderer.onRenderSurfaceChanged(null, mRegisteredGLSurface.mFrameParams.w, mRegisteredGLSurface.mFrameParams.h);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here: why always pass null as the surface?

@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch from f1f6303 to 1659b4b Compare August 6, 2025 16:44
@dsnopek
Copy link
Contributor

dsnopek commented Aug 8, 2025

To try and check if there were any performance regressions from this PR, I've run the benchmarks built into this fork of the GDQuest TPS demo on the Meta Quest 3, using both OpenGL and the Vulkan mobile renderer.

OpenGL frame times (lower is better):

Marker 1 Marker 2 Marker 3
Before PR 13.88963 16.69728 13.89239
After PR 14.28664 17.91876 13.88619

Vulkan mobile frame times (lower is better):

Marker 1 Marker 2 Marker 3
Before PR 27.77229 27.77687 16.66597
After PR 27.78113 27.77638 16.81091

I re-ran both the before and after OpenGL tests a couple times, and the results are consistent: there does seem to be small slow down with this PR. The Vulkan mobile numbers don't seem to have been affected.

I don't know how specific my results are to the project that I'm testing or the hardware that I'm testing it on

@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch from 1659b4b to d9f447c Compare September 23, 2025 21:42
@m4gr3d m4gr3d force-pushed the implement_unified_renderer branch from d9f447c to db82949 Compare September 28, 2025 12:24
@syntaxerror247
Copy link
Member

@m4gr3d is this PR ready?
Is #105529 (comment) resolved?

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Oct 21, 2025

@m4gr3d is this PR ready? Is #105529 (comment) resolved?

@syntaxerror247 Not yet. This PR is blocked on a performance instrumented tests PR I'm working on, so we can validate that no performance regressions is introduced.

I'll switch it to draft for the meantime.

@m4gr3d m4gr3d marked this pull request as draft October 21, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modifying the Android system's dark mode causes the Godot example application to crash

3 participants