summaryrefslogtreecommitdiff
path: root/platform/iphone
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-12-18 11:37:52 +0100
committerGitHub <noreply@github.com>2021-12-18 11:37:52 +0100
commit8485d0c53a55ee0295187a3144b390f35787b57d (patch)
tree3661f4066fb345e39c6ab1cbde0625874eb2326f /platform/iphone
parentaef799f1fa973e8b0f678f0e82549ec2534bc282 (diff)
parentd08b28aeb0cc5c182a9094813ada6be2fc69e212 (diff)
Merge pull request #55918 from BastiaanOlij/fix_win_opengl_destroy_crash
Fix incorrect destroy of OpenGL driver if using Vulkan on Windows
Diffstat (limited to 'platform/iphone')
-rw-r--r--platform/iphone/display_server_iphone.h4
-rw-r--r--platform/iphone/display_server_iphone.mm28
2 files changed, 15 insertions, 17 deletions
diff --git a/platform/iphone/display_server_iphone.h b/platform/iphone/display_server_iphone.h
index 5cfcc1765c..5ed03cc06e 100644
--- a/platform/iphone/display_server_iphone.h
+++ b/platform/iphone/display_server_iphone.h
@@ -54,8 +54,8 @@ class DisplayServerIPhone : public DisplayServer {
_THREAD_SAFE_CLASS_
#if defined(VULKAN_ENABLED)
- VulkanContextIPhone *context_vulkan;
- RenderingDeviceVulkan *rendering_device_vulkan;
+ VulkanContextIPhone *context_vulkan = nullptr;
+ RenderingDeviceVulkan *rendering_device_vulkan = nullptr;
#endif
DisplayServer::ScreenOrientation screen_orientation;
diff --git a/platform/iphone/display_server_iphone.mm b/platform/iphone/display_server_iphone.mm
index b746c60d4e..6a01ca1b13 100644
--- a/platform/iphone/display_server_iphone.mm
+++ b/platform/iphone/display_server_iphone.mm
@@ -54,6 +54,8 @@ DisplayServerIPhone::DisplayServerIPhone(const String &p_rendering_driver, Windo
#if defined(GLES3_ENABLED)
// FIXME: Add support for both OpenGL and Vulkan when OpenGL is implemented
// 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") {
bool gl_initialization_error = false;
@@ -131,18 +133,16 @@ DisplayServerIPhone::DisplayServerIPhone(const String &p_rendering_driver, Windo
DisplayServerIPhone::~DisplayServerIPhone() {
#if defined(VULKAN_ENABLED)
- if (rendering_driver == "vulkan") {
- if (rendering_device_vulkan) {
- rendering_device_vulkan->finalize();
- memdelete(rendering_device_vulkan);
- rendering_device_vulkan = nullptr;
- }
+ if (rendering_device_vulkan) {
+ rendering_device_vulkan->finalize();
+ memdelete(rendering_device_vulkan);
+ rendering_device_vulkan = nullptr;
+ }
- if (context_vulkan) {
- context_vulkan->window_destroy(MAIN_WINDOW_ID);
- memdelete(context_vulkan);
- context_vulkan = nullptr;
- }
+ if (context_vulkan) {
+ context_vulkan->window_destroy(MAIN_WINDOW_ID);
+ memdelete(context_vulkan);
+ context_vulkan = nullptr;
}
#endif
}
@@ -565,10 +565,8 @@ void DisplayServerIPhone::resize_window(CGSize viewSize) {
Size2i size = Size2i(viewSize.width, viewSize.height) * screen_get_max_scale();
#if defined(VULKAN_ENABLED)
- if (rendering_driver == "vulkan") {
- if (context_vulkan) {
- context_vulkan->window_resize(MAIN_WINDOW_ID, size.x, size.y);
- }
+ if (context_vulkan) {
+ context_vulkan->window_resize(MAIN_WINDOW_ID, size.x, size.y);
}
#endif