Trigger save of the RD pipeline cache on application pause

This commit is contained in:
Fredia Huya-Kouadio
2025-12-30 19:25:29 -08:00
parent 1559ab34c6
commit be24804e1a
6 changed files with 28 additions and 6 deletions

View File

@@ -717,6 +717,14 @@ void DisplayServerAndroid::notify_surface_changed(int p_width, int p_height) {
}
}
void DisplayServerAndroid::notify_application_paused() {
#if defined(RD_ENABLED)
if (rendering_device) {
rendering_device->update_pipeline_cache();
}
#endif // defined(RD_ENABLED)
}
DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, DisplayServer::WindowMode p_mode, DisplayServer::VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, int64_t p_parent_window, Error &r_error) {
rendering_driver = p_rendering_driver;

View File

@@ -247,6 +247,7 @@ public:
void reset_window();
void notify_surface_changed(int p_width, int p_height);
void notify_application_paused();
virtual Point2i mouse_get_position() const override;
virtual BitField<MouseButtonMask> mouse_get_button_state() const override;

View File

@@ -21,4 +21,12 @@ target_include_directories(${PROJECT_NAME}
${ANDROID_ROOT_DIR}
${OPENXR_INCLUDE_DIR})
add_definitions(-DUNIX_ENABLED -DVULKAN_ENABLED -DANDROID_ENABLED -DGLES3_ENABLED -DTOOLS_ENABLED -DDEBUG_ENABLED)
add_definitions(
-DUNIX_ENABLED
-DVULKAN_ENABLED
-DANDROID_ENABLED
-DGLES3_ENABLED
-DTOOLS_ENABLED
-DDEBUG_ENABLED
-DRD_ENABLED
)

View File

@@ -624,6 +624,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererPaused(JNIE
if (os_android->get_main_loop()) {
os_android->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_PAUSED);
}
if (DisplayServerAndroid *dsa = Object::cast_to<DisplayServerAndroid>(DisplayServer::get_singleton())) {
dsa->notify_application_paused();
}
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onScreenRotationChange(JNIEnv *env, jclass clazz, jint p_orientation) {