diff options
-rw-r--r-- | .mailmap | 2 | ||||
-rw-r--r-- | .travis.yml | 15 | ||||
-rw-r--r-- | AUTHORS.md | 1 | ||||
-rw-r--r-- | DONORS.md | 135 | ||||
-rw-r--r-- | core/debugger/engine_debugger.cpp | 6 | ||||
-rw-r--r-- | core/os/mutex.cpp | 4 | ||||
-rw-r--r-- | core/os/mutex.h | 26 | ||||
-rw-r--r-- | drivers/SCsub | 2 | ||||
-rw-r--r-- | drivers/dummy/rasterizer_dummy.h | 259 | ||||
-rw-r--r-- | drivers/vulkan/vulkan_context.cpp | 36 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/debugger_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 16 | ||||
-rw-r--r-- | modules/websocket/emws_peer.cpp | 5 | ||||
-rw-r--r-- | platform/javascript/http_client.h.inc | 2 | ||||
-rw-r--r-- | platform/javascript/http_client_javascript.cpp | 23 | ||||
-rw-r--r-- | platform/javascript/javascript_eval.cpp | 10 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 30 | ||||
-rw-r--r-- | platform/osx/detect.py | 6 | ||||
-rw-r--r-- | platform/x11/detect_prime.cpp | 1 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 14 | ||||
-rw-r--r-- | thirdparty/README.md | 3 | ||||
-rw-r--r-- | thirdparty/mbedtls/include/mbedtls/config.h | 4 | ||||
-rw-r--r-- | thirdparty/mbedtls/patches/padlock.diff | 13 |
24 files changed, 381 insertions, 244 deletions
@@ -24,7 +24,9 @@ Chris Bradfield <chris@kidscancode.org> <cb@scribe.net> Clay John <claynjohn@gmail.com> Clay John <claynjohn@gmail.com> <clayjohn@shaw.ca> Dana Olson <dana@shineuponthee.com> <adolson@gmail.com> +dankan1890 <mewuidev2@gmail.com> Daniel J. Ramirez <djrmuv@gmail.com> +Emmanuel Barroga <emmanuelbarroga@gmail.com> Erik Selecký <35656626+rxlecky@users.noreply.github.com> Erik Selecký <35656626+rxlecky@users.noreply.github.com> <35656626+SeleckyErik@users.noreply.github.com> Fabian <supagu@gmail.com> diff --git a/.travis.yml b/.travis.yml index 80191423c1..1434447409 100644 --- a/.travis.yml +++ b/.travis.yml @@ -117,6 +117,16 @@ matrix: packages: - *linux_deps + - name: Javascript export template (release, emscripten latest) + stage: build + env: PLATFORM=javascript TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-emcc-latest EXTRA_ARGS="module_glslang_enabled=no" + os: linux + compiler: clang + addons: + apt: + packages: + - *linux_deps + before_install: - eval "${MATRIX_EVAL}" - if [ "$STATIC_CHECKS" = "yes" ]; then @@ -135,6 +145,11 @@ install: java -version; misc/travis/android-tools-linux.sh; fi + - if [ "$PLATFORM" = "javascript" ]; then + git clone --depth 1 "https://github.com/emscripten-core/emsdk.git"; + ./emsdk/emsdk install latest; + ./emsdk/emsdk activate latest; + fi before_script: - if [ "$PLATFORM" = "android" ]; then diff --git a/AUTHORS.md b/AUTHORS.md index 8be2d05455..a3269a73f7 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -124,6 +124,7 @@ name is available. Michael Alexsander (YeldhamDev) MichiRecRoom (LikeLakers2) mrezai + muiroc Nathan Warden (NathanWarden) Nils André-Chang (NilsIrl) Nuno Donato (nunodonato) @@ -28,8 +28,11 @@ generous deed immortalized in the next stable release of Godot Engine. Andres Hernandez Andrew Dunai Brandon Lamb + Christian Baune Christopher Montesano Darkhan Baimyrza + Darrin Massena + Dov Zimring Edward Flick Gamechuck GameDev.net @@ -42,13 +45,12 @@ generous deed immortalized in the next stable release of Godot Engine. Justin Arnold Justo Delgado Baudí Kyle Szklenski - Leonard Meagher - Mariano Suligoy Matthieu Huvé Maxim Karsten Mike King Nathan Warden Neal Gompa (Conan Kudo) + Péter Magyar Slobodan Milnovic Stephan Lanfermann Steve @@ -77,32 +79,31 @@ generous deed immortalized in the next stable release of Godot Engine. Austen McRae Bernhard Werner beVR - Brian van der Stel Carlo Cabanilla Daniel James David Giardi Default Name + eggs + Felix Bohmann Florian Breisch Gamejunkey Javier Roman Jay Horton - Joel Höglund Jon Woodward - Jose Fernando Alexandre Karl Werf + Keinan Powers Klavdij Voncina Lex Steers Luke Maciej Pendolski Matthew Hillier Mohamed Ikbel Boulabiar - Mored1984 - Péter Magyar + Mored4u Rob Messick Ryan Badour + Sandro Jenny Scott Wadden Sergey - Shawn Yu thechris Tom Langwaldt tukon @@ -115,6 +116,7 @@ generous deed immortalized in the next stable release of Godot Engine. Conrad Curry Craig Smith Darrian Little + Horváth Péter Ivan Trombley Jakub Dering Joan Fons @@ -128,6 +130,7 @@ generous deed immortalized in the next stable release of Godot Engine. Rob Robert Willes Ronnie Ashlock + SKison Thomas Bjarnelöf Unseen Domains Valryia @@ -135,49 +138,59 @@ generous deed immortalized in the next stable release of Godot Engine. Wojciech Chojnacki Xavier PATRICELLI + Adam Nakonieczny Adam Neumann Alexander J Maynard Alexey Dyadchenko + Alex Z Andreas Funke André Frélicot - Andrew Bowen aoshiwik + Ben Powell Carlos de Sousa Marques + Charlie Whitfield Chase Taranto Chris Petrich Christian Leth Jeppesen Christoph Schröder Cody Parker + Coldragon Craig Ostrin D Daniel Eichler David White + Denis Janßen + Easypete Eric Monson + ethan ball Eugenio Hugo Salgüero Jáñez Fain flesk + Gary Hulst gavlig GGGames.org + Green Fox Guilherme Felipe de C. G. da Silva + Halom Vered Heath Hayes - Hysteria Idzard Kwadijk + Isaac Clausman Jared White Jeff Nyte Jeremy Sims Jerry Ling Joe Flood + John G Gentzel + Jon Hermansen Jose Malheiro Joshua Lesperance Juan Velandia Juraj Móza - Kasper Jeppesen kinfox Marcelo Dornbusch Lopes Markus Fehr Markus Wiesner Martin Eigel - Marvin Matt Eunson Max Bulai MuffinManKen @@ -190,19 +203,23 @@ generous deed immortalized in the next stable release of Godot Engine. pl Ranoller Robert Larnach - Robin Arys Rocknight Studios Romildo Franco - Ryan Samuel Judd Scott Pilet + Sean Morgan + SleepCircle spilldata + Steve Hyatt Stoned Xander TheLevelOfDetail . Thomas Krampl Thomas Kurz Tobias Bocanegra + Tricky Fat Cat Urho + William Foster + Zhou Tuizhi Zie Weaver 蕭惟允 @@ -214,7 +231,7 @@ generous deed immortalized in the next stable release of Godot Engine. Adam Brunnmeier Adam Carr Adam Long - Adam Nakonieczny + Adam McCurdy Adam N Webber Adam Smeltzer Adam Szymański @@ -223,21 +240,23 @@ generous deed immortalized in the next stable release of Godot Engine. Agustinus Arya Aidan O'Flannagain Aki Mimoto + Alan Mervitz + Alan Stice Albin Jonasson Svärdsby Alder Stefano Alessandro Senese + Alexander Erlemann alex clavelle - Alex Davies-Moore + Allan Davis Allen Schade Andreas Evers Andreas Krampitz André Simões Andrew Thomas - Andrzej Skalski - Angelos Arnaoutis Anthony Staunton AP Condomines Arda Erol + Armin Preiml Arseniy M Arthur S. Muszynski Asger @@ -253,28 +272,29 @@ generous deed immortalized in the next stable release of Godot Engine. Black Block Blair Allen Bobby CC Wong - Bryan Stevenson + brian + bugcaptor + Burney Waring + Cameron Meyer Carl van der Geest Carwyn Edwards - Casey M. + Cassidy James Chris Brown Chris Chapin - Christian Baune Christian Winter Christoffer Sundbom + Christoph Brodmann Christopher Schmitt Christoph Woinke Clay Heaton - Collin Shooltz + Curt King + Dancin Liao Daniel Johnson Daniel Kimblad - DanielMaximiano Daniel Pontillo - Daniel Reed David May - David Rapisarda David Woodard - Dennis Idzikowsky + DiCola Jamn Dominic Cooney Dominik Wetzel Donn Eddy @@ -286,51 +306,61 @@ generous deed immortalized in the next stable release of Godot Engine. Dylan Todd Eduardo Teixeira Edward Herbert + Edward Moulsdale + Edward Swartz Egon Elbre + Elias Nykrem Elmeri '- Duy Kevin Nguyen + Ephemeral Eric Ellingson + Eric Rogers Eric Williams Erkki Seppälä Evan Rose Fancy Ants Studios Fekinox Felix Kollmann - fengjiongmax Flaredown Forty Doubleu FuDiggity - G3Dev sàrl Gadzhi Kharkharov gamedev by Celio - Gary Hulst + Gary Thomas George Marques GiulianoB + Gordian Arragon Greg Olson GREGORY C FEIN Greg P Greyson Richey + Grid Guldoman Hal A Heribert Hirth + Hudson Thorpe-Doubble Hunter Jones Hylpher + Ichiro Dohi Iiari + iKlem IndustrialRobot - Isaac Morton Jaiden Gerig Jaime Ruiz-Borau Vizárraga Jako Danar James A F Manley + Janders Jannik Gröger - Jax + JARKKO PARVIAINEN + Jarrod Davis Jeff Hungerford Jennifer Graves Jeremy Kahn Jesse Dubay - Joe Alden Joel Fivat + Joel Höglund Joel Setterberg Johannes Wuensch + John Gabriel Jomei Jackson Jonas Rudlang Jonas Yamazaki @@ -338,6 +368,7 @@ generous deed immortalized in the next stable release of Godot Engine. Jonathon Jon Bonazza Jon Sully + Jorge Caballero Jose Aleman Jose C. Rubio Joseph Catrambone @@ -346,9 +377,8 @@ generous deed immortalized in the next stable release of Godot Engine. Julian Murgia JungleRobba Justin Spedding - Kaiser Bald0 + KaDokta Kauzig - KC Chan Keedong Park Keith Bradner Kevin McPhillips @@ -356,40 +386,44 @@ generous deed immortalized in the next stable release of Godot Engine. Kiyohiro Kawamura (kyorohiro) Kjetil Haugland Klagsam - Klassix KR McGinley KsyTek Games Kuan Cheang kycho + Kyle Appelgate + Laurent Tréguier Leonardo Dimano Levi Lindsey Linus Lind Lundgren Lionel Gaillard + Luigi Renna LunaticInAHat Lurkars Major Haul Malcolm Malik Ahmed Malik Nejer - Marcus Richter Markus Michael Egger Martin Holas Martin Liška + Marvin + Mathieu Rimelen + Matt Edwards Matthew Little Matti Pohjanvirta Maxime Blade Maxwell medecau + Megasploot Melissa Mears - M H + mewin mhilbrunner - Michael Dürwald - Michael Gringauz Michael Haney Michael Labbe Mikael Olsson Mikayla Mike Birkhead + Mike Cunningham Mitchell J. Wagner MoM Nathan Fish @@ -399,8 +433,8 @@ generous deed immortalized in the next stable release of Godot Engine. Neil Wang Nerdforge Nicholas + Nicholas Girga Nick Macholl - Niclas Eriksen Nicolás Montaña Nicolas SAN AGUSTIN Nima Farid @@ -418,10 +452,7 @@ generous deed immortalized in the next stable release of Godot Engine. Penguin Petrus Prinsloo Philip Cohoe - Pierre-Igor Berthet - Pitsanu Tongprasin Point08 - Poryg Rad Cat Rafa Laguna rainerLinux @@ -431,13 +462,13 @@ generous deed immortalized in the next stable release of Godot Engine. Ricardo Alcantara Richard Diss Richard Ivánek - Richard Patching Robert Farr (Larington) Robert Hernandez - Rodrigo Loli + Roberto Sánchez Roger Smith Roland Rząsa Roman Tinkov + Ronald Ho Hip (CrimsonZA) Ronan Ryan Groom Ryan Hentz @@ -446,27 +477,29 @@ generous deed immortalized in the next stable release of Godot Engine. Samuele Zolfanelli Sasori Olkof Scott D. Yelich + Scott Longley Sebastian Michailidis + Sergio Mello-Grand sgnsajgon Shane Shane Sicienski Shane Spoor + Siim Raidma Simon Wenner SK smbe19 - Stonepyre + smo1704 Svenne Krap + Terry tezuvholovdr thomas Thomas Bechtold + Thomas Detoy Thomas Kelly - tiansheng li Tim Drumheller Timothy B. MacDonald - tinyBigGames LLC Tobbun - Tom Fulp - Tom Glenn + Torgeir Lilleskog Torsten Crass Travis O'Brien Trent Skinner @@ -476,7 +509,6 @@ generous deed immortalized in the next stable release of Godot Engine. Tyler Compton Tyler Stafos UltyX - Vaiktorg Vaughan Ling Victor Vigilant Watch @@ -487,7 +519,6 @@ generous deed immortalized in the next stable release of Godot Engine. Wiley Thompson Will William Hogben - Wout Standaert Wyatt Goodin Yegor Yuri Sizov diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp index 305802e5f2..c64d886800 100644 --- a/core/debugger/engine_debugger.cpp +++ b/core/debugger/engine_debugger.cpp @@ -146,8 +146,8 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Ve return; // There is a debugger, parse breakpoints. - ScriptDebugger *script_debugger = singleton->get_script_debugger(); - script_debugger->set_skip_breakpoints(p_skip_breakpoints); + ScriptDebugger *singleton_script_debugger = singleton->get_script_debugger(); + singleton_script_debugger->set_skip_breakpoints(p_skip_breakpoints); for (int i = 0; i < p_breakpoints.size(); i++) { @@ -155,7 +155,7 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Ve int sp = bp.find_last(":"); ERR_CONTINUE_MSG(sp == -1, "Invalid breakpoint: '" + bp + "', expected file:line format."); - script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp)); + singleton_script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp)); } } diff --git a/core/os/mutex.cpp b/core/os/mutex.cpp index 74c308f646..97297dca28 100644 --- a/core/os/mutex.cpp +++ b/core/os/mutex.cpp @@ -40,7 +40,11 @@ void _global_unlock() { _global_mutex.unlock(); } +#ifndef NO_THREADS + template class MutexImpl<std::recursive_mutex>; template class MutexImpl<std::mutex>; template class MutexLock<MutexImpl<std::recursive_mutex> >; template class MutexLock<MutexImpl<std::mutex> >; + +#endif diff --git a/core/os/mutex.h b/core/os/mutex.h index 8d7b378d60..9033f0cb06 100644 --- a/core/os/mutex.h +++ b/core/os/mutex.h @@ -71,9 +71,22 @@ public: } }; +using Mutex = MutexImpl<std::recursive_mutex>; // Recursive, for general use +using BinaryMutex = MutexImpl<std::mutex>; // Non-recursive, handle with care + +extern template class MutexImpl<std::recursive_mutex>; +extern template class MutexImpl<std::mutex>; +extern template class MutexLock<MutexImpl<std::recursive_mutex> >; +extern template class MutexLock<MutexImpl<std::mutex> >; + #else -template <class StdMutexType> +class FakeMutex { + + FakeMutex(){}; +}; + +template <class MutexT> class MutexImpl { public: _ALWAYS_INLINE_ void lock() const {} @@ -87,14 +100,9 @@ public: explicit MutexLock(const MutexT &p_mutex) {} }; -#endif // !NO_THREADS - -using Mutex = MutexImpl<std::recursive_mutex>; // Recursive, for general use -using BinaryMutex = MutexImpl<std::mutex>; // Non-recursive, handle with care +using Mutex = MutexImpl<FakeMutex>; +using BinaryMutex = MutexImpl<FakeMutex>; // Non-recursive, handle with care -extern template class MutexImpl<std::recursive_mutex>; -extern template class MutexImpl<std::mutex>; -extern template class MutexLock<MutexImpl<std::recursive_mutex> >; -extern template class MutexLock<MutexImpl<std::mutex> >; +#endif // !NO_THREADS #endif diff --git a/drivers/SCsub b/drivers/SCsub index 932014b540..41c20d81ad 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -23,7 +23,7 @@ SConscript('coremidi/SCsub') SConscript('winmidi/SCsub') # Graphics drivers -if (env["platform"] != "server"): +if (env["platform"] != "server" and env["platform"] != "javascript"): # SConscript('gles2/SCsub') SConscript('vulkan/SCsub') SConscript('gl_context/SCsub') diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index fb23370863..4df28e3ea4 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -47,9 +47,18 @@ public: void shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision) {} bool shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version) { return false; } + void directional_shadow_atlas_set_size(int p_size) {} int get_directional_light_shadow_size(RID p_light_intance) { return 0; } void set_directional_shadow_count(int p_count) {} + /* SKY API */ + + RID sky_create() { return RID(); } + void sky_set_radiance_size(RID p_sky, int p_radiance_size) {} + void sky_set_mode(RID p_sky, VS::SkyMode p_samples) {} + void sky_set_texture(RID p_sky, RID p_panorama) {} + void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) {} + /* ENVIRONMENT API */ RID environment_create() { return RID(); } @@ -61,17 +70,19 @@ public: void environment_set_bg_color(RID p_env, const Color &p_color) {} void environment_set_bg_energy(RID p_env, float p_energy) {} void environment_set_canvas_max_layer(RID p_env, int p_max_layer) {} - void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) {} - void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id){}; + void environment_set_ambient_light(RID p_env, const Color &p_color, VS::EnvironmentAmbientSource p_ambient = VS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, VS::EnvironmentReflectionSource p_reflection_source = VS::ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color()) {} +// FIXME: Disabled during Vulkan refactoring, should be ported. +#if 0 + void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) {} +#endif - void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) {} - void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) {} - void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {} + void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {} void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {} void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) {} - void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {} + virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {} + virtual void environment_set_ssao_quality(VS::EnvironmentSSAOQuality p_quality, bool p_half_size) {} void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {} @@ -81,9 +92,17 @@ public: void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve) {} void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) {} - bool is_environment(RID p_env) { return false; } - VS::EnvironmentBG environment_get_background(RID p_env) { return VS::ENV_BG_KEEP; } - int environment_get_canvas_max_layer(RID p_env) { return 0; } + bool is_environment(RID p_env) const { return false; } + VS::EnvironmentBG environment_get_background(RID p_env) const { return VS::ENV_BG_KEEP; } + int environment_get_canvas_max_layer(RID p_env) const { return 0; } + + virtual RID camera_effects_create() { return RID(); } + + virtual void camera_effects_set_dof_blur_quality(VS::DOFBlurQuality p_quality, bool p_use_jitter) {} + virtual void camera_effects_set_dof_blur_bokeh_shape(VS::DOFBokehShape p_shape) {} + + virtual void camera_effects_set_dof_blur(RID p_camera_effects, bool p_far_enable, float p_far_distance, float p_far_transition, bool p_near_enable, float p_near_distance, float p_near_transition, float p_amount) {} + virtual void camera_effects_set_custom_exposure(RID p_camera_effects, bool p_enable, float p_exposure) {} RID light_instance_create(RID p_light) { return RID(); } void light_instance_set_transform(RID p_light_instance, const Transform &p_transform) {} @@ -91,8 +110,7 @@ public: void light_instance_mark_visible(RID p_light_instance) {} RID reflection_atlas_create() { return RID(); } - void reflection_atlas_set_size(RID p_ref_atlas, int p_size) {} - void reflection_atlas_set_subdivision(RID p_ref_atlas, int p_subdiv) {} + virtual void reflection_atlas_set_size(RID p_ref_atlas, int p_reflection_size, int p_reflection_count) {} RID reflection_probe_instance_create(RID p_probe) { return RID(); } void reflection_probe_instance_set_transform(RID p_instance, const Transform &p_transform) {} @@ -102,18 +120,28 @@ public: bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) { return false; } bool reflection_probe_instance_postprocess_step(RID p_instance) { return true; } - RID gi_probe_instance_create() { return RID(); } + virtual RID gi_probe_instance_create(RID p_gi_probe) { return RID(); } void gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data) {} void gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) {} - void gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds) {} + virtual bool gi_probe_needs_update(RID p_probe) const { return false; } + virtual void gi_probe_update(RID p_probe, bool p_update_light_instances, const Vector<RID> &p_light_instances, int p_dynamic_object_count, InstanceBase **p_dynamic_objects) {} - void render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {} + virtual void render_scene(RID p_render_buffers, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID *p_gi_probe_cull_result, int p_gi_probe_cull_count, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {} void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {} + virtual void render_material(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID p_framebuffer, const Rect2i &p_region) {} void set_scene_pass(uint64_t p_pass) {} + virtual void set_time(double p_time, double p_step) {} void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) {} + virtual RID render_buffers_create() { return RID(); } + virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, VS::ViewportMSAA p_msaa) {} + + virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_curve) {} + virtual bool screen_space_roughness_limiter_is_active() const { return false; } + bool free(RID p_rid) { return true; } + virtual void update() {} RasterizerSceneDummy() {} ~RasterizerSceneDummy() {} @@ -152,6 +180,43 @@ public: mutable RID_PtrOwner<DummyTexture> texture_owner; mutable RID_PtrOwner<DummyMesh> mesh_owner; + virtual RID texture_2d_create(const Ref<Image> &p_image) { return RID(); } + virtual RID texture_2d_layered_create(const Vector<Ref<Image> > &p_layers, VS::TextureLayeredType p_layered_type) { return RID(); } + virtual RID texture_3d_create(const Vector<Ref<Image> > &p_slices) { return RID(); } + virtual RID texture_proxy_create(RID p_base) { return RID(); } + + virtual void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) {} + virtual void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) {} + virtual void texture_3d_update(RID p_texture, const Ref<Image> &p_image, int p_depth, int p_mipmap) {} + virtual void texture_proxy_update(RID p_proxy, RID p_base) {} + + virtual RID texture_2d_placeholder_create() { return RID(); } + virtual RID texture_2d_layered_placeholder_create() { return RID(); } + virtual RID texture_3d_placeholder_create() { return RID(); } + + virtual Ref<Image> texture_2d_get(RID p_texture) const { return Ref<Image>(); } + virtual Ref<Image> texture_2d_layer_get(RID p_texture, int p_layer) const { return Ref<Image>(); } + virtual Ref<Image> texture_3d_slice_get(RID p_texture, int p_depth, int p_mipmap) const { return Ref<Image>(); } + + virtual void texture_replace(RID p_texture, RID p_by_texture) {} + virtual void texture_set_size_override(RID p_texture, int p_width, int p_height) {} +// FIXME: Disabled during Vulkan refactoring, should be ported. +#if 0 + virtual void texture_bind(RID p_texture, uint32_t p_texture_no) = 0; +#endif + + virtual void texture_set_path(RID p_texture, const String &p_path) {} + virtual String texture_get_path(RID p_texture) const { return String(); } + + virtual void texture_set_detect_3d_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) {} + virtual void texture_set_detect_normal_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) {} + virtual void texture_set_detect_roughness_callback(RID p_texture, VS::TextureDetectRoughnessCallback p_callback, void *p_userdata) {} + + virtual void texture_debug_usage(List<VS::TextureInfo> *r_info) {} + virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {} + virtual Size2 texture_size_with_proxy(RID p_proxy) { return Size2(); } + +#if 0 RID texture_create() { DummyTexture *texture = memnew(DummyTexture); @@ -246,11 +311,7 @@ public: void texture_set_proxy(RID p_proxy, RID p_base) {} virtual Size2 texture_size_with_proxy(RID p_texture) const { return Size2(); } void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {} - - /* SKY API */ - - RID sky_create() { return RID(); } - void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) {} +#endif /* SHADER API */ @@ -262,6 +323,7 @@ public: void shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture) {} RID shader_get_default_texture_param(RID p_shader, const StringName &p_name) const { return RID(); } + virtual Variant shader_get_param_default(RID p_material, const StringName &p_param) const { return Variant(); } /* COMMON MATERIAL API */ @@ -269,21 +331,15 @@ public: void material_set_render_priority(RID p_material, int priority) {} void material_set_shader(RID p_shader_material, RID p_shader) {} - RID material_get_shader(RID p_shader_material) const { return RID(); } void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) {} Variant material_get_param(RID p_material, const StringName &p_param) const { return Variant(); } - Variant material_get_param_default(RID p_material, const StringName &p_param) const { return Variant(); } - - void material_set_line_width(RID p_material, float p_width) {} void material_set_next_pass(RID p_material, RID p_next_material) {} bool material_is_animated(RID p_material) { return false; } bool material_casts_shadows(RID p_material) { return false; } - - void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {} - void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {} + void material_update_dependency(RID p_material, RasterizerScene::InstanceBase *p_instance) {} /* MESH API */ @@ -295,6 +351,9 @@ public: return mesh_owner.make_rid(mesh); } + void mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_surface) {} + +#if 0 void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes = Vector<Vector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) { DummyMesh *m = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!m); @@ -317,6 +376,8 @@ public: ERR_FAIL_COND(!m); m->blend_shape_count = p_amount; } +#endif + int mesh_get_blend_shape_count(RID p_mesh) const { DummyMesh *m = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!m, 0); @@ -339,6 +400,7 @@ public: void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {} RID mesh_surface_get_material(RID p_mesh, int p_surface) const { return RID(); } +#if 0 int mesh_surface_get_array_len(RID p_mesh, int p_surface) const { DummyMesh *m = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!m, 0); @@ -404,6 +466,9 @@ public: m->surfaces.remove(p_index); } +#endif + + VS::SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const { return VS::SurfaceData(); } int mesh_get_surface_count(RID p_mesh) const { DummyMesh *m = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!m, 0); @@ -413,14 +478,14 @@ public: void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {} AABB mesh_get_custom_aabb(RID p_mesh) const { return AABB(); } - AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const { return AABB(); } + AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) { return AABB(); } void mesh_clear(RID p_mesh) {} /* MULTIMESH API */ virtual RID multimesh_create() { return RID(); } - void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format, VS::MultimeshCustomDataFormat p_data = VS::MULTIMESH_CUSTOM_DATA_NONE) {} + virtual void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, bool p_use_colors = false, bool p_use_custom_data = false) {} int multimesh_get_instance_count(RID p_multimesh) const { return 0; } void multimesh_set_mesh(RID p_multimesh, RID p_mesh) {} @@ -430,19 +495,18 @@ public: void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) {} RID multimesh_get_mesh(RID p_multimesh) const { return RID(); } + AABB multimesh_get_aabb(RID p_multimesh) const { return AABB(); } Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const { return Transform(); } Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const { return Transform2D(); } Color multimesh_instance_get_color(RID p_multimesh, int p_index) const { return Color(); } Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const { return Color(); } - - void multimesh_set_as_bulk_array(RID p_multimesh, const Vector<float> &p_array) {} + virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) {} + virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const { return Vector<float>(); } void multimesh_set_visible_instances(RID p_multimesh, int p_visible) {} int multimesh_get_visible_instances(RID p_multimesh) const { return 0; } - AABB multimesh_get_aabb(RID p_multimesh) const { return AABB(); } - /* IMMEDIATE API */ RID immediate_create() { return RID(); } @@ -490,7 +554,6 @@ public: void light_set_use_gi(RID p_light, bool p_enabled) {} void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {} - void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {} void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode) {} void light_directional_set_blend_splits(RID p_light, bool p_enable) {} @@ -536,57 +599,55 @@ public: float reflection_probe_get_origin_max_distance(RID p_probe) const { return 0.0; } bool reflection_probe_renders_shadows(RID p_probe) const { return false; } - void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {} - void instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {} - - void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {} - void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {} + virtual void base_update_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {} + virtual void skeleton_update_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {} /* GI PROBE API */ RID gi_probe_create() { return RID(); } - void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) {} - AABB gi_probe_get_bounds(RID p_probe) const { return AABB(); } + virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) {} - void gi_probe_set_cell_size(RID p_probe, float p_range) {} - float gi_probe_get_cell_size(RID p_probe) const { return 0.0; } + virtual AABB gi_probe_get_bounds(RID p_gi_probe) const { return AABB(); } + virtual Vector3i gi_probe_get_octree_size(RID p_gi_probe) const { return Vector3i(); } + virtual Vector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const { return Vector<uint8_t>(); } + virtual Vector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const { return Vector<uint8_t>(); } + virtual Vector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const { return Vector<uint8_t>(); } - void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) {} - Transform gi_probe_get_to_cell_xform(RID p_probe) const { return Transform(); } + virtual Vector<int> gi_probe_get_level_counts(RID p_gi_probe) const { return Vector<int>(); } + virtual Transform gi_probe_get_to_cell_xform(RID p_gi_probe) const { return Transform(); } - void gi_probe_set_dynamic_data(RID p_probe, const Vector<int> &p_data) {} - Vector<int> gi_probe_get_dynamic_data(RID p_probe) const { - Vector<int> p; - return p; - } + virtual void gi_probe_set_dynamic_range(RID p_gi_probe, float p_range) {} + virtual float gi_probe_get_dynamic_range(RID p_gi_probe) const { return 0; } + + virtual void gi_probe_set_propagation(RID p_gi_probe, float p_range) {} + virtual float gi_probe_get_propagation(RID p_gi_probe) const { return 0; } - void gi_probe_set_dynamic_range(RID p_probe, int p_range) {} - int gi_probe_get_dynamic_range(RID p_probe) const { return 0; } + void gi_probe_set_energy(RID p_gi_probe, float p_range) {} + float gi_probe_get_energy(RID p_gi_probe) const { return 0.0; } - void gi_probe_set_energy(RID p_probe, float p_range) {} - float gi_probe_get_energy(RID p_probe) const { return 0.0; } + virtual void gi_probe_set_ao(RID p_gi_probe, float p_ao) {} + virtual float gi_probe_get_ao(RID p_gi_probe) const { return 0; } - void gi_probe_set_bias(RID p_probe, float p_range) {} - float gi_probe_get_bias(RID p_probe) const { return 0.0; } + virtual void gi_probe_set_ao_size(RID p_gi_probe, float p_strength) {} + virtual float gi_probe_get_ao_size(RID p_gi_probe) const { return 0; } - void gi_probe_set_normal_bias(RID p_probe, float p_range) {} - float gi_probe_get_normal_bias(RID p_probe) const { return 0.0; } + void gi_probe_set_bias(RID p_gi_probe, float p_range) {} + float gi_probe_get_bias(RID p_gi_probe) const { return 0.0; } - void gi_probe_set_propagation(RID p_probe, float p_range) {} - float gi_probe_get_propagation(RID p_probe) const { return 0.0; } + void gi_probe_set_normal_bias(RID p_gi_probe, float p_range) {} + float gi_probe_get_normal_bias(RID p_gi_probe) const { return 0.0; } - void gi_probe_set_interior(RID p_probe, bool p_enable) {} - bool gi_probe_is_interior(RID p_probe) const { return false; } + void gi_probe_set_interior(RID p_gi_probe, bool p_enable) {} + bool gi_probe_is_interior(RID p_gi_probe) const { return false; } - void gi_probe_set_compress(RID p_probe, bool p_enable) {} - bool gi_probe_is_compressed(RID p_probe) const { return false; } + virtual void gi_probe_set_use_two_bounces(RID p_gi_probe, bool p_enable) {} + virtual bool gi_probe_is_using_two_bounces(RID p_gi_probe) const { return false; } - uint32_t gi_probe_get_version(RID p_probe) { return 0; } + virtual void gi_probe_set_anisotropy_strength(RID p_gi_probe, float p_strength) {} + virtual float gi_probe_get_anisotropy_strength(RID p_gi_probe) const { return 0; } - GIProbeCompression gi_probe_get_dynamic_data_get_preferred_compression() const { return GI_PROBE_UNCOMPRESSED; } - RID gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression) { return RID(); } - void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {} + uint32_t gi_probe_get_version(RID p_gi_probe) { return 0; } /* LIGHTMAP CAPTURE */ struct Instantiable { @@ -598,7 +659,7 @@ public: SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first(); while (instances) { - instances->self()->base_changed(p_aabb, p_materials); + //instances->self()->base_changed(p_aabb, p_materials); instances = instances->next(); } } @@ -608,7 +669,7 @@ public: while (instances) { SelfList<RasterizerScene::InstanceBase> *next = instances->next(); - instances->self()->base_removed(); + //instances->self()->base_removed(); instances = next; } } @@ -697,21 +758,17 @@ public: RID render_target_create() { return RID(); } void render_target_set_position(RID p_render_target, int p_x, int p_y) {} void render_target_set_size(RID p_render_target, int p_width, int p_height) {} - RID render_target_get_texture(RID p_render_target) const { return RID(); } + RID render_target_get_texture(RID p_render_target) { return RID(); } void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) {} void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) {} bool render_target_was_used(RID p_render_target) { return false; } void render_target_set_as_unused(RID p_render_target) {} - void render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa) {} - - /* CANVAS SHADOW */ - - RID canvas_light_shadow_buffer_create(int p_width) { return RID(); } - /* LIGHT SHADOW MAPPING */ - - RID canvas_light_occluder_create() { return RID(); } - void canvas_light_occluder_set_polylines(RID p_occluder, const Vector<Vector2> &p_lines) {} + virtual void render_target_request_clear(RID p_render_target, const Color &p_clear_color) {} + virtual bool render_target_is_clear_requested(RID p_render_target) { return false; } + virtual Color render_target_get_clear_request_color(RID p_render_target) { return Color(); } + virtual void render_target_disable_clear_request(RID p_render_target) {} + virtual void render_target_do_clear_request(RID p_render_target) {} VS::InstanceType get_base_type(RID p_rid) const { if (mesh_owner.owns(p_rid)) { @@ -748,28 +805,43 @@ public: static RasterizerStorage *base_singleton; - RasterizerStorageDummy(){}; + virtual void capture_timestamps_begin() {} + virtual void capture_timestamp(const String &p_name) {} + virtual uint32_t get_captured_timestamps_count() const { return 0; } + virtual uint64_t get_captured_timestamps_frame() const { return 0; } + virtual uint64_t get_captured_timestamp_gpu_time(uint32_t p_index) const { return 0; } + virtual uint64_t get_captured_timestamp_cpu_time(uint32_t p_index) const { return 0; } + virtual String get_captured_timestamp_name(uint32_t p_index) const { return String(); } + + RasterizerStorageDummy() {} ~RasterizerStorageDummy() {} }; class RasterizerCanvasDummy : public RasterizerCanvas { public: - RID light_internal_create() { return RID(); } - void light_internal_update(RID p_rid, Light *p_light) {} - void light_internal_free(RID p_rid) {} + virtual TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, VS::CanvasItemTextureFilter p_filter, VS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) { return 0; } + virtual void free_texture_binding(TextureBindingID p_binding) {} - void canvas_begin(){}; - void canvas_end(){}; + virtual PolygonID request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>()) { return 0; } + virtual void free_polygon(PolygonID p_polygon) {} - void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_transform){}; - void canvas_debug_viewport_shadows(Light *p_lights_with_shadow){}; + virtual void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform) {} + virtual void canvas_debug_viewport_shadows(Light *p_lights_with_shadow) {} - void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache) {} + virtual RID light_create() { return RID(); } + virtual void light_set_texture(RID p_rid, RID p_texture) {} + virtual void light_set_use_shadow(RID p_rid, bool p_enable, int p_resolution) {} + virtual void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) {} - void reset_canvas() {} + virtual RID occluder_polygon_create() { return RID(); } + virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) {} + virtual void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode) {} void draw_window_margins(int *p_margins, RID *p_margin_textures) {} + virtual bool free(RID p_rid) { return true; } + virtual void update() {} + RasterizerCanvasDummy() {} ~RasterizerCanvasDummy() {} }; @@ -789,11 +861,10 @@ public: void initialize() {} void begin_frame(double frame_step) {} - void set_current_render_target(RID p_render_target) {} - void restore_render_target(bool p_3d_was_drawn) {} - void clear_render_target(const Color &p_color) {} - void blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen = 0) {} - void output_lens_distorted_to_screen(RID p_render_target, const Rect2 &p_screen_rect, float p_k1, float p_k2, const Vector2 &p_eye_center, float p_oversample) {} + + virtual void prepare_for_blitting_render_targets() {} + virtual void blit_render_targets_to_screen(int p_screen, const BlitToScreen *p_render_targets, int p_amount) {} + void end_frame(bool p_swap_buffers) { OS::get_singleton()->swap_buffers(); } void finalize() {} diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 038cae7f96..c8ff342713 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -356,39 +356,8 @@ Error VulkanContext::_create_physical_device() { free(physical_devices); ERR_FAIL_V(ERR_CANT_CREATE); } - - /*Find the first discrete GPU with the most VRAM.*/ - { - print_line("Selecting primary GPU."); - VkPhysicalDeviceProperties device_properties; - VkPhysicalDeviceMemoryProperties memory_properties; - gpu = physical_devices[0]; - uint32_t largest_vram_size = 0; - VkPhysicalDeviceType gpu_type = VK_PHYSICAL_DEVICE_TYPE_OTHER; - for (uint32_t i = 0; i < gpu_count; i++) { - vkGetPhysicalDeviceProperties(physical_devices[i], &device_properties); - - /*Skip virtual and CPU devices for now.*/ - if (device_properties.deviceType > VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) { - continue; - } - - vkGetPhysicalDeviceMemoryProperties(physical_devices[i], &memory_properties); - - /*Total all heaps in case of 3GB+1GB configurations and similar.*/ - uint32_t memory_size = 0; - for (uint32_t j = 0; j < memory_properties.memoryHeapCount; j++) { - memory_size += memory_properties.memoryHeaps[j].size; - } - - if ((device_properties.deviceType >= gpu_type) || (device_properties.deviceType == gpu_type && memory_size > largest_vram_size)) { - gpu = physical_devices[i]; - gpu_type = device_properties.deviceType; - largest_vram_size = memory_size; - print_line(device_properties.deviceName); - } - } - } + /* for now, just grab the first physical device */ + gpu = physical_devices[0]; free(physical_devices); /* Look for device extensions */ @@ -1514,6 +1483,7 @@ VkPhysicalDeviceLimits VulkanContext::get_device_limits() const { } VulkanContext::VulkanContext() { + queue_props = NULL; command_buffer_count = 0; instance_validation_layers = NULL; use_validation_layers = true; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4bfe633494..5629e3854d 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -462,7 +462,15 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig } float CanvasItemEditor::snap_angle(float p_target, float p_start) const { - return (((smart_snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) && snap_rotation_step != 0) ? Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset : p_target; + if (((smart_snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) && snap_rotation_step != 0) { + if (snap_relative) { + return Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset + (p_start - (int)(p_start / snap_rotation_step) * snap_rotation_step); + } else { + return Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset; + } + } else { + return p_target; + } } void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp index b195609fb0..c4069ac2ab 100644 --- a/editor/plugins/debugger_editor_plugin.cpp +++ b/editor/plugins/debugger_editor_plugin.cpp @@ -122,6 +122,7 @@ void DebuggerEditorPlugin::_menu_option(int p_option) { debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER), !ischecked); EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked); + } break; case RUN_LIVE_DEBUG: { @@ -136,6 +137,7 @@ void DebuggerEditorPlugin::_menu_option(int p_option) { bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG)); debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked); + EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked); } break; case RUN_DEBUG_COLLISONS: { diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 0382944efd..353c79d6bb 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3102,18 +3102,18 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { Vector<Node *> args; Vector<double> constants; - bool constant = false; + bool constant = true; for (int i = 1; i < op->arguments.size(); i++) { args.push_back(op->arguments[i]); - if (constant && op->arguments[i]->type == Node::TYPE_CONSTANT) { + if (op->arguments[i]->type == Node::TYPE_CONSTANT) { ConstantNode *c = static_cast<ConstantNode *>(op->arguments[i]); if (c->value.get_type() == Variant::FLOAT || c->value.get_type() == Variant::INT) { constants.push_back(c->value); - constant = true; } } else { constant = false; + break; } } @@ -3809,6 +3809,12 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { } StringName argname = tokenizer->get_token_identifier(); + for (int i = 0; i < arguments.size(); i++) { + if (arguments[i] == argname) { + _set_error("The argument name \"" + String(argname) + "\" is defined multiple times."); + return; + } + } arguments.push_back(argname); #ifdef DEBUG_ENABLED arguments_usage.push_back(0); @@ -5227,6 +5233,10 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { } } break; + case GDScriptTokenizer::TK_CF_PASS: { + tokenizer->advance(); + } break; + default: { _set_error(String() + "Unexpected token: " + tokenizer->get_token_name(tokenizer->get_token()) + ":" + tokenizer->get_token_identifier()); diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp index f396a1c812..9472daa620 100644 --- a/modules/websocket/emws_peer.cpp +++ b/modules/websocket/emws_peer.cpp @@ -90,12 +90,11 @@ Error EMWSPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { if (_in_buffer.packets_left() == 0) return ERR_UNAVAILABLE; - uint8_t *rw = _packet_buffer.ptrw(); int read = 0; - Error err = _in_buffer.read_packet(rw.ptr(), _packet_buffer.size(), &_is_string, read); + Error err = _in_buffer.read_packet(_packet_buffer.ptrw(), _packet_buffer.size(), &_is_string, read); ERR_FAIL_COND_V(err != OK, err); - *r_buffer = rw.ptr(); + *r_buffer = _packet_buffer.ptr(); r_buffer_size = read; return OK; diff --git a/platform/javascript/http_client.h.inc b/platform/javascript/http_client.h.inc index 03e2ce8b8a..ac275aadbc 100644 --- a/platform/javascript/http_client.h.inc +++ b/platform/javascript/http_client.h.inc @@ -45,7 +45,7 @@ String password; int polled_response_code; String polled_response_header; -PoolByteArray polled_response; +PackedByteArray polled_response; #ifdef DEBUG_ENABLED bool has_polled; diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index d7796cc4f4..472384cf30 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -108,8 +108,7 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector Error err = prepare_request(p_method, p_url, p_headers); if (err != OK) return err; - const uint8_t *read = p_body.ptr(); - godot_xhr_send_data(xhr_id, read.ptr(), p_body.size()); + godot_xhr_send_data(xhr_id, p_body.ptr(), p_body.size()); return OK; } @@ -180,11 +179,7 @@ PackedByteArray HTTPClient::read_response_body_chunk() { int to_read = MIN(read_limit, polled_response.size() - response_read_offset); PackedByteArray chunk; chunk.resize(to_read); - uint8_t *write = chunk.ptrw(); - const uint8_t *read = polled_response.ptr(); - memcpy(write.ptr(), read.ptr() + response_read_offset, to_read); - write = uint8_t * (); - read = const uint8_t * (); + memcpy(chunk.ptrw(), polled_response.ptr() + response_read_offset, to_read); response_read_offset += to_read; if (response_read_offset == polled_response.size()) { @@ -267,19 +262,13 @@ Error HTTPClient::poll() { int len = godot_xhr_get_response_headers_length(xhr_id); bytes.resize(len + 1); - uint8_t *write = bytes.ptrw(); - godot_xhr_get_response_headers(xhr_id, reinterpret_cast<char *>(write.ptr()), len); - write[len] = 0; - write = uint8_t * (); + godot_xhr_get_response_headers(xhr_id, reinterpret_cast<char *>(bytes.ptrw()), len); + bytes.ptrw()[len] = 0; - const uint8_t *read = bytes.ptr(); - polled_response_header = String::utf8(reinterpret_cast<const char *>(read.ptr())); - read = const uint8_t * (); + polled_response_header = String::utf8(reinterpret_cast<const char *>(bytes.ptr())); polled_response.resize(godot_xhr_get_response_length(xhr_id)); - write = polled_response.ptrw(); - godot_xhr_get_response(xhr_id, write.ptr(), polled_response.size()); - write = uint8_t * (); + godot_xhr_get_response(xhr_id, polled_response.ptrw(), polled_response.size()); break; } diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp index 44cce28d57..db8050b90e 100644 --- a/platform/javascript/javascript_eval.cpp +++ b/platform/javascript/javascript_eval.cpp @@ -33,11 +33,11 @@ #include "api/javascript_eval.h" #include "emscripten.h" -extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_PackedByteArray_and_open_write(PackedByteArray *p_arr, uint8_t **r_write, int p_len) { +extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_PackedByteArray_and_open_write(PackedByteArray *p_arr, VectorWriteProxy<uint8_t> *r_write, int p_len) { p_arr->resize(p_len); - *r_write = p_arr->write(); - return r_write->ptr(); + *r_write = p_arr->write; + return p_arr->ptrw(); } Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { @@ -49,7 +49,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { } js_data; PackedByteArray arr; - uint8_t *arr_write; + VectorWriteProxy<uint8_t> arr_write; /* clang-format off */ Variant::Type return_type = static_cast<Variant::Type>(EM_ASM_INT({ @@ -138,7 +138,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { return str; } case Variant::PACKED_BYTE_ARRAY: - arr_write = uint8_t * (); + arr_write = VectorWriteProxy<uint8_t>(); return arr; default: return Variant(); diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 037f78c7af..9ba0223387 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -31,7 +31,8 @@ #include "os_javascript.h" #include "core/io/file_access_buffered_fa.h" -#include "drivers/gles2/rasterizer_gles2.h" +//#include "drivers/gles2/rasterizer_gles2.h" +#include "drivers/dummy/rasterizer_dummy.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" #include "main/main.h" @@ -539,15 +540,11 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s PackedByteArray png; size_t len; - const uint8_t *r = image->get_data().ptr(); - ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL)); + PackedByteArray data = image->get_data(); + ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, NULL)); png.resize(len); - uint8_t *w = png.ptrw(); - ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL)); - w = uint8_t * (); - - r = png.ptr(); + ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, NULL)); char *object_url; /* clang-format off */ @@ -562,9 +559,8 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s var string_on_wasm_heap = _malloc(length_bytes); setValue(PTR, string_on_wasm_heap, '*'); stringToUTF8(url, string_on_wasm_heap, length_bytes); - }, r.ptr(), len, &object_url); + }, png.ptr(), len, &object_url); /* clang-format on */ - r = const uint8_t * (); String url = String::utf8(object_url) + "?" + itos(p_hotspot.x) + " " + itos(p_hotspot.y); @@ -896,6 +892,7 @@ void OS_JavaScript::initialize_core() { Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { +#if 0 EmscriptenWebGLContextAttributes attributes; emscripten_webgl_init_context_attributes(&attributes); attributes.alpha = GLOBAL_GET("display/window/per_pixel_transparency/allowed"); @@ -952,6 +949,8 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, } else { set_window_size(get_window_size()); } +#endif + RasterizerDummy::make_current(); // TODO GLES2 in Godot 4.0... or webgpu? char locale_ptr[16]; /* clang-format off */ @@ -1181,15 +1180,12 @@ void OS_JavaScript::set_icon(const Ref<Image> &p_icon) { PackedByteArray png; size_t len; - const uint8_t *r = icon->get_data().ptr(); - ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL)); + PackedByteArray data = icon->get_data(); + ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, NULL)); png.resize(len); - uint8_t *w = png.ptrw(); - ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL)); - w = uint8_t * (); + ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, NULL)); - r = png.ptr(); /* clang-format off */ EM_ASM_ARGS({ var PNG_PTR = $0; @@ -1205,7 +1201,7 @@ void OS_JavaScript::set_icon(const Ref<Image> &p_icon) { document.head.appendChild(link); } link.href = url; - }, r.ptr(), len); + }, png.ptr(), len); /* clang-format on */ } diff --git a/platform/osx/detect.py b/platform/osx/detect.py index b2f4032f66..12ca5c10dc 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -151,13 +151,13 @@ def configure(env): env.Prepend(CPPPATH=['#platform/osx']) env.Append(CPPDEFINES=['OSX_ENABLED', 'UNIX_ENABLED', 'APPLE_STYLE_KEYS', 'COREAUDIO_ENABLED', 'COREMIDI_ENABLED']) - env.AppendUnique(FRAMEWORKS=['Cocoa', 'Carbon', 'AudioUnit', 'CoreAudio', 'CoreMIDI', 'IOKit', 'ForceFeedback', 'CoreVideo', 'AVFoundation', 'CoreMedia']) + env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo', '-framework', 'AVFoundation', '-framework', 'CoreMedia']) env.Append(LIBS=['pthread', 'z']) env.Append(CPPDEFINES=['VULKAN_ENABLED']) - env.AppendUnique(FRAMEWORKS=['Metal', 'QuartzCore', 'IOSurface']) + env.Append(LINKFLAGS=['-framework', 'Metal', '-framework', 'QuartzCore', '-framework', 'IOSurface']) if (env['use_static_mvk']): - env.AppendUnique(FRAMEWORKS=['MoltenVK']) + env.Append(LINKFLAGS=['-framework', 'MoltenVK']) env['builtin_vulkan'] = False elif not env['builtin_vulkan']: env.Append(LIBS=['vulkan']) diff --git a/platform/x11/detect_prime.cpp b/platform/x11/detect_prime.cpp index 98a51ff27c..a0e5f835c0 100644 --- a/platform/x11/detect_prime.cpp +++ b/platform/x11/detect_prime.cpp @@ -62,6 +62,7 @@ vendor vendormap[] = { { "NVIDIA Corporation", 30 }, { "X.Org", 30 }, { "Intel Open Source Technology Center", 20 }, + { "Intel", 20 }, { "nouveau", 10 }, { "Mesa Project", 0 }, { NULL, 0 } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5e925bf37f..784a6afc7b 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1856,6 +1856,7 @@ void TextEdit::_consume_pair_symbol(CharType ch) { bool in_single_quote = false; bool in_double_quote = false; + bool found_comment = false; int c = 0; while (c < line.length()) { @@ -1865,6 +1866,9 @@ void TextEdit::_consume_pair_symbol(CharType ch) { if (cursor.column == c) { break; } + } else if (!in_single_quote && !in_double_quote && line[c] == '#') { + found_comment = true; + break; } else { if (line[c] == '\'' && !in_double_quote) { in_single_quote = !in_single_quote; @@ -1880,7 +1884,15 @@ void TextEdit::_consume_pair_symbol(CharType ch) { } } - // Disallow inserting duplicated quotes while already in string + // Do not need to duplicate quotes while in comments + if (found_comment) { + insert_text_at_cursor(ch_single); + cursor_set_column(cursor_position_to_move); + + return; + } + + // Disallow inserting duplicated quotes while already in string if ((in_single_quote || in_double_quote) && (ch == '"' || ch == '\'')) { insert_text_at_cursor(ch_single); cursor_set_column(cursor_position_to_move); diff --git a/thirdparty/README.md b/thirdparty/README.md index 0602d2a1d1..5c9c114ad1 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -312,6 +312,9 @@ File extracted from upstream release tarball (`-apache.tgz` variant): - LICENSE and apache-2.0.txt files - Applied the patch in `thirdparty/mbedtls/patches/1453.diff` (PR 1453). Soon to be merged upstream. Check it out at next update. +- Applied the patch in `thirdparty/mbedtls/patches/padlock.diff`. This disables + VIA padlock support which defines a symbol `unsupported` which clashes with + a pre-defined symbol. - Added 2 files `godot_core_mbedtls_platform.{c,h}` providing configuration for light bundling with core. diff --git a/thirdparty/mbedtls/include/mbedtls/config.h b/thirdparty/mbedtls/include/mbedtls/config.h index 834cced87f..8d9c31a504 100644 --- a/thirdparty/mbedtls/include/mbedtls/config.h +++ b/thirdparty/mbedtls/include/mbedtls/config.h @@ -2542,7 +2542,9 @@ * * This modules adds support for the VIA PadLock on x86. */ -#define MBEDTLS_PADLOCK_C +// -- GODOT start -- +// #define MBEDTLS_PADLOCK_C +// -- GODOT end -- /** * \def MBEDTLS_PEM_PARSE_C diff --git a/thirdparty/mbedtls/patches/padlock.diff b/thirdparty/mbedtls/patches/padlock.diff new file mode 100644 index 0000000000..6ace48891c --- /dev/null +++ b/thirdparty/mbedtls/patches/padlock.diff @@ -0,0 +1,13 @@ +--- a/thirdparty/mbedtls/include/mbedtls/config.h ++++ b/thirdparty/mbedtls/include/mbedtls/config.h +@@ -2477,7 +2477,9 @@ + * + * This modules adds support for the VIA PadLock on x86. + */ +-#define MBEDTLS_PADLOCK_C ++// -- GODOT start -- ++// #define MBEDTLS_PADLOCK_C ++// -- GODOT end -- + + /** + * \def MBEDTLS_PEM_PARSE_C |