Add driver types to GD extension initialisation levels

This commit is contained in:
Bastiaan Olij 2021-09-11 12:08:12 +10:00
parent bbdfc547ca
commit f9849a2717
4 changed files with 12 additions and 5 deletions

View File

@ -449,6 +449,8 @@ typedef enum {
GDNATIVE_INITIALIZATION_SERVERS,
GDNATIVE_INITIALIZATION_SCENE,
GDNATIVE_INITIALIZATION_EDITOR,
GDNATIVE_INITIALIZATION_DRIVER,
GDNATIVE_MAX_INITIALIZATION_LEVEL,
} GDNativeInitializationLevel;
typedef struct {

View File

@ -70,6 +70,7 @@ public:
INITIALIZATION_LEVEL_SERVERS,
INITIALIZATION_LEVEL_SCENE,
INITIALIZATION_LEVEL_EDITOR,
INITIALIZATION_LEVEL_DRIVER,
};
bool is_library_open() const;

View File

@ -30,6 +30,7 @@
#include "register_driver_types.h"
#include "core/extension/native_extension_manager.h"
#include "drivers/png/image_loader_png.h"
#include "drivers/png/resource_saver_png.h"
@ -54,7 +55,9 @@ void unregister_core_driver_types() {
}
void register_driver_types() {
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_DRIVER);
}
void unregister_driver_types() {
NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_DRIVER);
}

View File

@ -2669,18 +2669,19 @@ void Main::cleanup(bool p_force) {
//clear global shader variables before scene and other graphics stuff are deinitialized.
rendering_server->global_variables_clear();
#ifdef TOOLS_ENABLED
EditorNode::unregister_editor_types();
#endif
if (xr_server) {
// cleanup now before we pull the rug from underneath...
memdelete(xr_server);
}
unregister_driver_types();
#ifdef TOOLS_ENABLED
EditorNode::unregister_editor_types();
#endif
ImageLoader::cleanup();
unregister_driver_types();
unregister_module_types();
unregister_platform_apis();
unregister_scene_types();