mirror of https://github.com/godotengine/godot
Fix initialising of gl_manager and checking gl_manager and context_vulkan preventing crash issues.
This commit is contained in:
parent
b0e93711b3
commit
d08b28aeb0
|
|
@ -70,8 +70,8 @@ class DisplayServerAndroid : public DisplayServer {
|
||||||
CursorShape cursor_shape = CursorShape::CURSOR_ARROW;
|
CursorShape cursor_shape = CursorShape::CURSOR_ARROW;
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
VulkanContextAndroid *context_vulkan;
|
VulkanContextAndroid *context_vulkan = nullptr;
|
||||||
RenderingDeviceVulkan *rendering_device_vulkan;
|
RenderingDeviceVulkan *rendering_device_vulkan = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ObjectID window_attached_instance_id;
|
ObjectID window_attached_instance_id;
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ class DisplayServerIPhone : public DisplayServer {
|
||||||
_THREAD_SAFE_CLASS_
|
_THREAD_SAFE_CLASS_
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
VulkanContextIPhone *context_vulkan;
|
VulkanContextIPhone *context_vulkan = nullptr;
|
||||||
RenderingDeviceVulkan *rendering_device_vulkan;
|
RenderingDeviceVulkan *rendering_device_vulkan = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DisplayServer::ScreenOrientation screen_orientation;
|
DisplayServer::ScreenOrientation screen_orientation;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ DisplayServerIPhone::DisplayServerIPhone(const String &p_rendering_driver, Windo
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
// FIXME: Add support for both OpenGL and Vulkan when OpenGL is implemented
|
// FIXME: Add support for both OpenGL and Vulkan when OpenGL is implemented
|
||||||
// again,
|
// again,
|
||||||
|
// Note that we should be checking "opengl3" as the driver, might never enable this seeing OpenGL is deprecated on iOS
|
||||||
|
// We are hardcoding the rendering_driver to "vulkan" down below
|
||||||
|
|
||||||
if (rendering_driver == "opengl_es") {
|
if (rendering_driver == "opengl_es") {
|
||||||
bool gl_initialization_error = false;
|
bool gl_initialization_error = false;
|
||||||
|
|
@ -131,7 +133,6 @@ DisplayServerIPhone::DisplayServerIPhone(const String &p_rendering_driver, Windo
|
||||||
|
|
||||||
DisplayServerIPhone::~DisplayServerIPhone() {
|
DisplayServerIPhone::~DisplayServerIPhone() {
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
|
||||||
if (rendering_device_vulkan) {
|
if (rendering_device_vulkan) {
|
||||||
rendering_device_vulkan->finalize();
|
rendering_device_vulkan->finalize();
|
||||||
memdelete(rendering_device_vulkan);
|
memdelete(rendering_device_vulkan);
|
||||||
|
|
@ -143,7 +144,6 @@ DisplayServerIPhone::~DisplayServerIPhone() {
|
||||||
memdelete(context_vulkan);
|
memdelete(context_vulkan);
|
||||||
context_vulkan = nullptr;
|
context_vulkan = nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -565,11 +565,9 @@ void DisplayServerIPhone::resize_window(CGSize viewSize) {
|
||||||
Size2i size = Size2i(viewSize.width, viewSize.height) * screen_get_max_scale();
|
Size2i size = Size2i(viewSize.width, viewSize.height) * screen_get_max_scale();
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
|
||||||
if (context_vulkan) {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_resize(MAIN_WINDOW_ID, size.x, size.y);
|
context_vulkan->window_resize(MAIN_WINDOW_ID, size.x, size.y);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Variant resize_rect = Rect2i(Point2i(), size);
|
Variant resize_rect = Rect2i(Point2i(), size);
|
||||||
|
|
|
||||||
|
|
@ -1150,7 +1150,7 @@ void DisplayServerX11::delete_sub_window(WindowID p_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_destroy(p_id);
|
context_vulkan->window_destroy(p_id);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2927,7 +2927,7 @@ void DisplayServerX11::_window_changed(XEvent *event) {
|
||||||
wd.size = new_rect.size;
|
wd.size = new_rect.size;
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_resize(window_id, wd.size.width, wd.size.height);
|
context_vulkan->window_resize(window_id, wd.size.width, wd.size.height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -4672,12 +4672,12 @@ DisplayServerX11::~DisplayServerX11() {
|
||||||
//destroy all windows
|
//destroy all windows
|
||||||
for (KeyValue<WindowID, WindowData> &E : windows) {
|
for (KeyValue<WindowID, WindowData> &E : windows) {
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_destroy(E.key);
|
context_vulkan->window_destroy(E.key);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef GLES3_ENABLED
|
#ifdef GLES3_ENABLED
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
gl_manager->window_destroy(E.key);
|
gl_manager->window_destroy(E.key);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -4693,15 +4693,15 @@ DisplayServerX11::~DisplayServerX11() {
|
||||||
|
|
||||||
//destroy drivers
|
//destroy drivers
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
|
||||||
if (rendering_device_vulkan) {
|
if (rendering_device_vulkan) {
|
||||||
rendering_device_vulkan->finalize();
|
rendering_device_vulkan->finalize();
|
||||||
memdelete(rendering_device_vulkan);
|
memdelete(rendering_device_vulkan);
|
||||||
|
rendering_device_vulkan = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context_vulkan) {
|
if (context_vulkan) {
|
||||||
memdelete(context_vulkan);
|
memdelete(context_vulkan);
|
||||||
}
|
context_vulkan = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,12 +167,12 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (DS_OSX->rendering_driver == "opengl3") {
|
if (DS_OSX->gl_manager) {
|
||||||
DS_OSX->gl_manager->window_destroy(window_id);
|
DS_OSX->gl_manager->window_destroy(window_id);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
if (DS_OSX->rendering_driver == "vulkan") {
|
if (DS_OSX->context_vulkan) {
|
||||||
DS_OSX->context_vulkan->window_destroy(window_id);
|
DS_OSX->context_vulkan->window_destroy(window_id);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -272,12 +272,12 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (DS_OSX->rendering_driver == "opengl3") {
|
if (DS_OSX->gl_manager) {
|
||||||
DS_OSX->gl_manager->window_resize(window_id, wd.size.width, wd.size.height);
|
DS_OSX->gl_manager->window_resize(window_id, wd.size.width, wd.size.height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (DS_OSX->rendering_driver == "vulkan") {
|
if (DS_OSX->context_vulkan) {
|
||||||
DS_OSX->context_vulkan->window_resize(window_id, wd.size.width, wd.size.height);
|
DS_OSX->context_vulkan->window_resize(window_id, wd.size.width, wd.size.height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -403,7 +403,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
|
||||||
|
|
||||||
- (CALayer *)makeBackingLayer {
|
- (CALayer *)makeBackingLayer {
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (DS_OSX->rendering_driver == "vulkan") {
|
if (DS_OSX->context_vulkan) {
|
||||||
CALayer *layer = [[CAMetalLayer class] layer];
|
CALayer *layer = [[CAMetalLayer class] layer];
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
@ -413,12 +413,12 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
|
||||||
|
|
||||||
- (void)updateLayer {
|
- (void)updateLayer {
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (DS_OSX->rendering_driver == "opengl3") {
|
if (DS_OSX->gl_manager) {
|
||||||
DS_OSX->gl_manager->window_update(window_id);
|
DS_OSX->gl_manager->window_update(window_id);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (DS_OSX->rendering_driver == "vulkan") {
|
if (DS_OSX->context_vulkan) {
|
||||||
[super updateLayer];
|
[super updateLayer];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2577,12 +2577,12 @@ void DisplayServerOSX::_set_window_per_pixel_transparency_enabled(bool p_enabled
|
||||||
[layer setOpaque:NO];
|
[layer setOpaque:NO];
|
||||||
}
|
}
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
//TODO - implement transparency for Vulkan
|
//TODO - implement transparency for Vulkan
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
//TODO - reimplement OpenGLES
|
//TODO - reimplement OpenGLES
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2596,24 +2596,24 @@ void DisplayServerOSX::_set_window_per_pixel_transparency_enabled(bool p_enabled
|
||||||
[layer setOpaque:YES];
|
[layer setOpaque:YES];
|
||||||
}
|
}
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
//TODO - implement transparency for Vulkan
|
//TODO - implement transparency for Vulkan
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
//TODO - reimplement OpenGLES
|
//TODO - reimplement OpenGLES
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wd.layered_window = false;
|
wd.layered_window = false;
|
||||||
}
|
}
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
//TODO - reimplement OpenGLES
|
//TODO - reimplement OpenGLES
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
//TODO - implement transparency for Vulkan
|
//TODO - implement transparency for Vulkan
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3451,12 +3451,12 @@ void DisplayServerOSX::set_icon(const Ref<Image> &p_icon) {
|
||||||
void DisplayServerOSX::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {
|
void DisplayServerOSX::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
gl_manager->swap_buffers();
|
gl_manager->swap_buffers();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->set_vsync_mode(p_window, p_vsync_mode);
|
context_vulkan->set_vsync_mode(p_window, p_vsync_mode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3465,12 +3465,12 @@ void DisplayServerOSX::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mo
|
||||||
DisplayServer::VSyncMode DisplayServerOSX::window_get_vsync_mode(WindowID p_window) const {
|
DisplayServer::VSyncMode DisplayServerOSX::window_get_vsync_mode(WindowID p_window) const {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
return (gl_manager->is_using_vsync() ? DisplayServer::VSyncMode::VSYNC_ENABLED : DisplayServer::VSyncMode::VSYNC_DISABLED);
|
return (gl_manager->is_using_vsync() ? DisplayServer::VSyncMode::VSYNC_ENABLED : DisplayServer::VSyncMode::VSYNC_DISABLED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
return context_vulkan->get_vsync_mode(p_window);
|
return context_vulkan->get_vsync_mode(p_window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3586,20 +3586,16 @@ DisplayServerOSX::WindowID DisplayServerOSX::_create_window(WindowMode p_mode, V
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
|
||||||
if (context_vulkan) {
|
if (context_vulkan) {
|
||||||
Error err = context_vulkan->window_create(window_id_counter, p_vsync_mode, wd.window_view, p_rect.size.width, p_rect.size.height);
|
Error err = context_vulkan->window_create(window_id_counter, p_vsync_mode, wd.window_view, p_rect.size.width, p_rect.size.height);
|
||||||
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create a Vulkan context");
|
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create a Vulkan context");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
|
||||||
if (gl_manager) {
|
if (gl_manager) {
|
||||||
Error err = gl_manager->window_create(window_id_counter, wd.window_view, p_rect.size.width, p_rect.size.height);
|
Error err = gl_manager->window_create(window_id_counter, wd.window_view, p_rect.size.width, p_rect.size.height);
|
||||||
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create an OpenGL context");
|
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create an OpenGL context");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
id = window_id_counter++;
|
id = window_id_counter++;
|
||||||
windows[id] = wd;
|
windows[id] = wd;
|
||||||
|
|
@ -3618,12 +3614,12 @@ DisplayServerOSX::WindowID DisplayServerOSX::_create_window(WindowMode p_mode, V
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
gl_manager->window_resize(id, wd.size.width, wd.size.height);
|
gl_manager->window_resize(id, wd.size.width, wd.size.height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_resize(id, wd.size.width, wd.size.height);
|
context_vulkan->window_resize(id, wd.size.width, wd.size.height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -538,12 +538,12 @@ void DisplayServerWindows::delete_sub_window(WindowID p_window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_destroy(p_window);
|
context_vulkan->window_destroy(p_window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef GLES3_ENABLED
|
#ifdef GLES3_ENABLED
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
gl_manager->window_destroy(p_window);
|
gl_manager->window_destroy(p_window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -828,12 +828,12 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
|
||||||
wd.height = h;
|
wd.height = h;
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_resize(p_window, w, h);
|
context_vulkan->window_resize(p_window, w, h);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
gl_manager->window_resize(p_window, w, h);
|
gl_manager->window_resize(p_window, w, h);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2646,7 +2646,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
windows[window_id].height = window_h;
|
windows[window_id].height = window_h;
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if ((rendering_driver == "vulkan") && window_created) {
|
if (context_vulkan && window_created) {
|
||||||
context_vulkan->window_resize(window_id, windows[window_id].width, windows[window_id].height);
|
context_vulkan->window_resize(window_id, windows[window_id].width, windows[window_id].height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3108,7 +3108,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
if (context_vulkan->window_create(id, p_vsync_mode, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top) == -1) {
|
if (context_vulkan->window_create(id, p_vsync_mode, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top) == -1) {
|
||||||
memdelete(context_vulkan);
|
memdelete(context_vulkan);
|
||||||
context_vulkan = nullptr;
|
context_vulkan = nullptr;
|
||||||
|
|
@ -3119,7 +3119,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GLES3_ENABLED
|
#ifdef GLES3_ENABLED
|
||||||
if (rendering_driver == "opengl3") {
|
if (gl_manager) {
|
||||||
Error err = gl_manager->window_create(id, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top);
|
Error err = gl_manager->window_create(id, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top);
|
||||||
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Failed to create an OpenGL window.");
|
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Failed to create an OpenGL window.");
|
||||||
}
|
}
|
||||||
|
|
@ -3458,7 +3458,7 @@ DisplayServerWindows::~DisplayServerWindows() {
|
||||||
|
|
||||||
if (windows.has(MAIN_WINDOW_ID)) {
|
if (windows.has(MAIN_WINDOW_ID)) {
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
if (rendering_driver == "vulkan") {
|
if (context_vulkan) {
|
||||||
context_vulkan->window_destroy(MAIN_WINDOW_ID);
|
context_vulkan->window_destroy(MAIN_WINDOW_ID);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3470,14 +3470,15 @@ DisplayServerWindows::~DisplayServerWindows() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
|
||||||
if (rendering_device_vulkan) {
|
if (rendering_device_vulkan) {
|
||||||
rendering_device_vulkan->finalize();
|
rendering_device_vulkan->finalize();
|
||||||
memdelete(rendering_device_vulkan);
|
memdelete(rendering_device_vulkan);
|
||||||
|
rendering_device_vulkan = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context_vulkan)
|
if (context_vulkan) {
|
||||||
memdelete(context_vulkan);
|
memdelete(context_vulkan);
|
||||||
|
context_vulkan = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,12 +305,12 @@ class DisplayServerWindows : public DisplayServer {
|
||||||
Point2i center;
|
Point2i center;
|
||||||
|
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
GLManager_Windows *gl_manager;
|
GLManager_Windows *gl_manager = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
VulkanContextWindows *context_vulkan;
|
VulkanContextWindows *context_vulkan = nullptr;
|
||||||
RenderingDeviceVulkan *rendering_device_vulkan;
|
RenderingDeviceVulkan *rendering_device_vulkan = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Map<int, Vector2> touch_state;
|
Map<int, Vector2> touch_state;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue