diff options
Diffstat (limited to 'platform/uwp')
-rw-r--r-- | platform/uwp/detect.py | 2 | ||||
-rw-r--r-- | platform/uwp/export/export.cpp | 45 | ||||
-rw-r--r-- | platform/uwp/gl_context_egl.h | 10 | ||||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 114 | ||||
-rw-r--r-- | platform/uwp/os_uwp.h | 8 | ||||
-rw-r--r-- | platform/uwp/power_uwp.h | 6 | ||||
-rw-r--r-- | platform/uwp/thread_uwp.cpp | 2 | ||||
-rw-r--r-- | platform/uwp/thread_uwp.h | 2 |
8 files changed, 122 insertions, 67 deletions
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 559f23ca5b..f25b9ba9cd 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -17,7 +17,7 @@ def can_build(): # building natively on windows! if (os.getenv("VSINSTALLDIR")): - if (os.getenv("ANGLE_SRC_PATH") == None): + if (os.getenv("ANGLE_SRC_PATH") is None): return False return True diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index ebc2c2d7a2..c0ea13e7fb 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -29,16 +29,16 @@ /*************************************************************************/ #include "export.h" -#include "bind/core_bind.h" +#include "core/bind/core_bind.h" +#include "core/io/marshalls.h" +#include "core/io/zip_io.h" +#include "core/object.h" +#include "core/os/file_access.h" +#include "core/project_settings.h" +#include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" -#include "io/marshalls.h" -#include "io/zip_io.h" -#include "object.h" -#include "os/file_access.h" #include "platform/uwp/logo.gen.h" -#include "project_settings.h" -#include "version.h" #include "thirdparty/minizip/unzip.h" #include "thirdparty/minizip/zip.h" @@ -1021,8 +1021,10 @@ public: return "UWP"; } - virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const { - return "appx"; + virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const { + List<String> list; + list.push_back("appx"); + return list; } virtual Ref<Texture> get_logo() const { @@ -1050,15 +1052,15 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/display_name"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/short_name"), "Godot")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/unique_name"), "Godot.Engine")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/description"), "Godot Engine")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/publisher"), "CN=GodotEngine")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/publisher_display_name"), "Godot Engine")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/display_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/short_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/unique_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game.Name"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/description"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/publisher", PROPERTY_HINT_PLACEHOLDER_TEXT, "CN=CompanyName"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/publisher_display_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Company Name"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "identity/product_guid"), "00000000-0000-0000-0000-000000000000")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "identity/publisher_guid"), "00000000-0000-0000-0000-000000000000")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "identity/product_guid", PROPERTY_HINT_PLACEHOLDER_TEXT, "00000000-0000-0000-0000-000000000000"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "identity/publisher_guid", PROPERTY_HINT_PLACEHOLDER_TEXT, "00000000-0000-0000-0000-000000000000"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "signing/certificate", PROPERTY_HINT_GLOBAL_FILE, "*.pfx"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "signing/password"), "")); @@ -1087,8 +1089,8 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "tiles/show_name_on_wide310x150"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "tiles/show_name_on_square310x310"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); // Capabilities const char **basic = uwp_capabilities; @@ -1132,7 +1134,7 @@ public: } break; } - if (!exists_export_template("uwp_" + platform_infix + "_debug.zip", &err) || !exists_export_template("uwp_" + platform_infix + "_debug.zip", &err)) { + if (!exists_export_template("uwp_" + platform_infix + "_debug.zip", &err) || !exists_export_template("uwp_" + platform_infix + "_release.zip", &err)) { valid = false; r_missing_templates = true; } @@ -1454,6 +1456,9 @@ public: r_features->push_back("UWP"); } + virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) { + } + EditorExportUWP() { Ref<Image> img = memnew(Image(_uwp_logo)); logo.instance(); diff --git a/platform/uwp/gl_context_egl.h b/platform/uwp/gl_context_egl.h index df0108c124..3c7115cc34 100644 --- a/platform/uwp/gl_context_egl.h +++ b/platform/uwp/gl_context_egl.h @@ -34,9 +34,9 @@ #include <wrl.h> #include "EGL/egl.h" +#include "core/error_list.h" +#include "core/os/os.h" #include "drivers/gl_context/context_gl.h" -#include "error_list.h" -#include "os/os.h" using namespace Windows::UI::Core; @@ -71,8 +71,8 @@ public: virtual int get_window_height(); virtual void swap_buffers(); - void set_use_vsync(bool use) { vsync = use; } - bool is_using_vsync() const { return vsync; } + virtual void set_use_vsync(bool use) { vsync = use; } + virtual bool is_using_vsync() const { return vsync; } virtual Error initialize(); void reset(); @@ -80,7 +80,7 @@ public: void cleanup(); ContextEGL(CoreWindow ^ p_window, Driver p_driver); - ~ContextEGL(); + virtual ~ContextEGL(); }; #endif diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 8549a44ce5..1f81d476ea 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -28,25 +28,26 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +// Must include Winsock before windows.h (included by os_uwp.h) +#include "drivers/unix/net_socket_posix.h" + #include "os_uwp.h" +#include "core/io/marshalls.h" +#include "core/project_settings.h" #include "drivers/gles2/rasterizer_gles2.h" #include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/ip_unix.h" #include "drivers/windows/dir_access_windows.h" #include "drivers/windows/file_access_windows.h" #include "drivers/windows/mutex_windows.h" -#include "drivers/windows/packet_peer_udp_winsock.h" #include "drivers/windows/rw_lock_windows.h" #include "drivers/windows/semaphore_windows.h" -#include "drivers/windows/stream_peer_tcp_winsock.h" -#include "drivers/windows/tcp_server_winsock.h" -#include "io/marshalls.h" #include "main/main.h" #include "platform/windows/windows_terminal_logger.h" -#include "project_settings.h" #include "servers/audio_server.h" #include "servers/visual/visual_server_raster.h" +#include "servers/visual/visual_server_wrap_mt.h" #include "thread_uwp.h" #include <ppltasks.h> @@ -151,9 +152,7 @@ void OSUWP::initialize_core() { DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_USERDATA); DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM); - TCPServerWinsock::make_default(); - StreamPeerTCPWinsock::make_default(); - PacketPeerUDPWinsock::make_default(); + NetSocketPosix::make_default(); // We need to know how often the clock is updated if (!QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second)) @@ -187,12 +186,78 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au main_loop = NULL; outside = true; + ContextEGL::Driver opengl_api_type = ContextEGL::GLES_2_0; + if (p_video_driver == VIDEO_DRIVER_GLES2) { - gl_context = memnew(ContextEGL(window, ContextEGL::GLES_2_0)); - } else { - gl_context = memnew(ContextEGL(window, ContextEGL::GLES_3_0)); + opengl_api_type = ContextEGL::GLES_2_0; + } + + bool gl_initialization_error = false; + + gl_context = NULL; + while (!gl_context) { + gl_context = memnew(ContextEGL(window, opengl_api_type)); + + if (gl_context->initialize() != OK) { + memdelete(gl_context); + gl_context = NULL; + + if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best") { + if (p_video_driver == VIDEO_DRIVER_GLES2) { + gl_initialization_error = true; + break; + } + + p_video_driver = VIDEO_DRIVER_GLES2; + opengl_api_type = ContextEGL::GLES_2_0; + } else { + gl_initialization_error = true; + break; + } + } + } + + while (true) { + if (opengl_api_type == ContextEGL::GLES_3_0) { + if (RasterizerGLES3::is_viable() == OK) { + RasterizerGLES3::register_config(); + RasterizerGLES3::make_current(); + break; + } else { + if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best") { + p_video_driver = VIDEO_DRIVER_GLES2; + opengl_api_type = ContextEGL::GLES_2_0; + continue; + } else { + gl_initialization_error = true; + break; + } + } + } + + if (opengl_api_type == ContextEGL::GLES_2_0) { + if (RasterizerGLES2::is_viable() == OK) { + RasterizerGLES2::register_config(); + RasterizerGLES2::make_current(); + break; + } else { + gl_initialization_error = true; + break; + } + } + } + + if (gl_initialization_error) { + OS::get_singleton()->alert("Your video card driver does not support any of the supported OpenGL versions.\n" + "Please update your drivers or if you have a very old or integrated GPU upgrade it.", + "Unable to initialize Video driver"); + return ERR_UNAVAILABLE; } - gl_context->initialize(); + + video_driver_index = p_video_driver; + gl_context->make_current(); + gl_context->set_use_vsync(video_mode.use_vsync); + VideoMode vm; vm.width = gl_context->get_window_width(); vm.height = gl_context->get_window_height(); @@ -230,30 +295,13 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au set_video_mode(vm); - gl_context->make_current(); - - if (p_video_driver == VIDEO_DRIVER_GLES2) { - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); - } else { - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); - } - gl_context->set_use_vsync(vm.use_vsync); - - video_driver_index = p_video_driver; - visual_server = memnew(VisualServerRaster); - // FIXME: Reimplement threaded rendering? Or remove? - /* + // FIXME: Reimplement threaded rendering if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { - - visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD)); + visual_server = memnew(VisualServerWrapMT(visual_server, false)); } - */ visual_server->init(); - input = memnew(InputDefault); joypad = ref new JoypadUWP(input); @@ -356,6 +404,8 @@ void OSUWP::finalize() { } void OSUWP::finalize_core() { + + NetSocketPosix::cleanup(); } void OSUWP::alert(const String &p_alert, const String &p_title) { @@ -812,7 +862,7 @@ void OSUWP::run() { CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); if (managed_object->alert_close_handle) continue; process_events(); // get rid of pending events - if (Main::iteration() == true) + if (Main::iteration()) break; }; diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index 3b48063fe9..9641b9cde9 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -31,14 +31,14 @@ #ifndef OSUWP_H #define OSUWP_H -#include "core/math/math_2d.h" +#include "core/math/transform_2d.h" +#include "core/os/input.h" +#include "core/os/os.h" #include "core/ustring.h" #include "drivers/xaudio2/audio_driver_xaudio2.h" #include "gl_context_egl.h" #include "joypad_uwp.h" #include "main/input_default.h" -#include "os/input.h" -#include "os/os.h" #include "power_uwp.h" #include "servers/audio_server.h" #include "servers/visual/rasterizer.h" @@ -152,7 +152,7 @@ private: Windows::Devices::Sensors::Magnetometer ^ magnetometer; Windows::Devices::Sensors::Gyrometer ^ gyrometer; - // functions used by main to initialize/deintialize the OS + // functions used by main to initialize/deinitialize the OS protected: virtual int get_video_driver_count() const; virtual int get_current_video_driver() const; diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h index 09572a15f4..da1cffe8f0 100644 --- a/platform/uwp/power_uwp.h +++ b/platform/uwp/power_uwp.h @@ -31,9 +31,9 @@ #ifndef PLATFORM_UWP_POWER_UWP_H_ #define PLATFORM_UWP_POWER_UWP_H_ -#include "os/dir_access.h" -#include "os/file_access.h" -#include "os/os.h" +#include "core/os/dir_access.h" +#include "core/os/file_access.h" +#include "core/os/os.h" class PowerUWP { diff --git a/platform/uwp/thread_uwp.cpp b/platform/uwp/thread_uwp.cpp index 25cd29190f..c755204ec4 100644 --- a/platform/uwp/thread_uwp.cpp +++ b/platform/uwp/thread_uwp.cpp @@ -30,7 +30,7 @@ #include "thread_uwp.h" -#include "os/memory.h" +#include "core/os/memory.h" Thread *ThreadUWP::create_func_uwp(ThreadCreateCallback p_callback, void *p_user, const Settings &) { diff --git a/platform/uwp/thread_uwp.h b/platform/uwp/thread_uwp.h index 89081f3b2b..16e7efb60b 100644 --- a/platform/uwp/thread_uwp.h +++ b/platform/uwp/thread_uwp.h @@ -33,7 +33,7 @@ #ifdef UWP_ENABLED -#include "os/thread.h" +#include "core/os/thread.h" #include <thread> |