Merge pull request #52562 from BastiaanOlij/gd_extensions_register_drivers

Add driver types to GD extension initialisation levels
This commit is contained in:
Rémi Verschelde 2021-09-15 08:46:43 +02:00 committed by GitHub
commit 0e7beb183a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -2687,18 +2687,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();