Commit Graph

7979 Commits (fe84b84b51df1ff6db658f521d1040aa563cedd0)

Author SHA1 Message Date
MJacred e98f3a6bf0 Apply feedback 2025-01-13 16:23:55 +07:00
Lukas Tenbrink 2e600789dd Optimize `String` `==`, `ends_with` and `begins_with` by using `memcmp`. 2025-01-13 15:23:08 +07:00
MJacred f7c6a8659a Apply feedback + Remove unused variable `uid` in parse_mapping() 2025-01-13 11:43:25 +07:00
Marc Gilleron c7a9d64eaf Add color channel filter to editor texture previews 2025-01-11 23:27:48 +07:00
David Snopek 696285f23a Use `MethodInfo::get_compatibility_hash()` to generate the hash for `MethodBind::get_hash()` and other GDExtension hash clean up 2025-01-11 15:57:42 +07:00
Rémi Verschelde 5b52b4b5c4 Merge pull request #101446 from KoBeWi/path_ensuring_never_ends
Fix UID path remap
2025-01-11 22:30:25 +07:00
Rémi Verschelde 7c6d0d81c2 Merge pull request #101441 from KoBeWi/what_happened_to_your_uid,_why_is_it_so_invalid
Improve missing UID errors
2025-01-11 22:30:18 +07:00
Rémi Verschelde 65af5ae981 Merge pull request #101386 from Ivorforce/vector-append-array-memorysafe
Revert regression of memory unsafe `append_array` (same vector into same vector).
2025-01-11 22:30:05 +07:00
Rémi Verschelde 6a8ca81789 Merge pull request #100674 from dsnopek/gdextension-virtual-method-compat
GDExtension: Add compatibility system for virtual methods
2025-01-11 22:29:38 +07:00
kobewi 9ad34ecc3e Fix UID path remap 2025-01-11 22:15:59 +07:00
kobewi d3d874e0d1 Improve missing UID errors 2025-01-11 21:30:25 +07:00
Rémi Verschelde ad74e337b9 Merge pull request #100954 from Bromeon/bugfix/nodepath-slice
Fix `NodePath::slice()` incorrect behavior for subname indexing
2025-01-10 23:05:56 +07:00
David Snopek 39f16e70f8 GDExtension: Add compatibility system for virtual methods 2025-01-10 16:00:05 +07:00
Lukas Tenbrink cf145de21e Revert regression (GH-31736) of memory unsafe append_array (append vector to itself). Add comments to prevent future regressions. 2025-01-10 15:30:36 +07:00
Rémi Verschelde 2db8f8837e Merge pull request #101125 from axunes/master
macOS: Allow running unpacked game files from .app bundle resources
2025-01-09 11:17:20 +07:00
Rémi Verschelde a7052a2bd0 Merge pull request #101033 from Ivorforce/string-count-avoid-copy
Optimize `_count` by replacing a full copy with a CoW copy for the full-string count case.
2025-01-09 11:17:17 +07:00
Rémi Verschelde 7fe0609118 Linux: Relax interdependency between freetype, libpng, and zlib for unvendored builds
This restriction was added to fix #7373 back then, which was a symbol conflict
between FreeType's bundled copy of gzip/zlib, and distro packages.

But we also unbundled FreeType's zlib in #69395 so this is no longer an issue.

On the other hand recent issues pointed out that using system-provided icu4c
or harfbuzz can cause issues (#91401, #100301). We still allow it for now but
raise a warning.
2025-01-09 00:28:46 +07:00
Rémi Verschelde 76c8e76560 Merge pull request #101284 from akx/tyops
A handful of typo fixes
2025-01-08 15:53:33 +07:00
Rémi Verschelde b857c2f3e6 Merge pull request #101016 from kiroxas/AddVariantStaticAssert
Add static assert checks in `Variant` constructors
2025-01-08 15:53:23 +07:00
Aarni Koskela f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +07:00
axunes 50b90604af macOS: search for project file in .app resources 2025-01-08 01:59:00 +07:00
Synzorasize b0845da37d Fix parsing Resource type as value type of a Dictionary 2025-01-07 18:37:31 +07:00
Rémi Verschelde 0fee2724f0 Merge pull request #100751 from YYF233333/force_regex_with_editor
Force build editor with regex module, remove checking code
2025-01-07 23:17:35 +07:00
Yufeng Ying 34d8255947 Force build editor with regex module, remove checking code.
Fix include.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-07 19:43:23 +07:00
Rémi Verschelde d9535301ab
Merge pull request #101001 from adamscott/fix-metadata-script
Fix Script metadata usage
2025-01-07 10:14:46 +07:00
Rémi Verschelde 91fda4ecaf
Merge pull request #101055 from Ivorforce/variant-to-number-consolidate
Consolidate `Variant` int and float conversion functions to reduce duplicate logic.
2025-01-06 22:48:24 +07:00
Rémi Verschelde 653f5a9613
Merge pull request #100976 from AThousandShips/uid_fixes
[Core] Fix UID encoding
2025-01-06 22:48:13 +07:00
Rémi Verschelde e06cac212b
Merge pull request #99893 from kiroxas/avoidUTF8ParsingWhenNotNecessary
Avoid duplicated `utf8()` calls
2025-01-06 22:47:12 +07:00
Rémi Verschelde be4678b836
Merge pull request #95750 from mosquitochang/fix-input-event-get-index
Fix `InputMap::event_get_index` to handle unmatched events correctly
2025-01-06 22:46:37 +07:00
Rémi Verschelde 4319d380d1
Merge pull request #94507 from akien-mga/variantparser-improve-error-reporting
VariantParser: Ensure all parse errors have an explanation
2025-01-06 22:46:31 +07:00
Rémi Verschelde 1aaf20b1f1
Merge pull request #98488 from RandomShaper/lockless_rid_fetch_pro
Fix `RID_Owner` synchronization
2025-01-06 08:38:14 +07:00
Rémi Verschelde da4f9339ea
Merge pull request #101072 from hpvb/thread-id-optimization
Optimize `Thread::get_caller_id()`
2025-01-05 14:52:18 +07:00
Lukas Tenbrink 0e72967244 Consolidate `Variant` int and float conversion functions to reduce duplicate logic. 2025-01-03 20:16:43 +07:00
HP van Braam 873eb21ce8 Optimize Thread::get_caller_id()
By making sure that Thread always has a valid caller_id we can remove the
check making the function a straightforward getter instead.

In some quick tests we see a repeatable performance improvement of
somewhere around 0.32 mspf in TPS demo.

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2025-01-03 17:33:10 +07:00
Rémi Verschelde c049d07121
VariantParser: Ensure all parse errors have an explanation
Likewise in ResourceFormatText and JSON.
2025-01-03 17:17:37 +07:00
Adam Scott 6db599232e
Fix Script metadata usage 2025-01-03 11:12:37 +07:00
Pedro J. Estébanez de7e4efef8 Fix RID_Owner synchronization 2025-01-03 17:05:36 +07:00
Ricardo Subtil b77aa473a1 Implement a "Recovery Mode" for recovering crashing/hanging projects during initialization 2025-01-03 10:50:15 +07:00
Rémi Verschelde a17a0bc808
Merge pull request #100717 from KoBeWi/icon_uncache
Fix icon UIDs in Project Manager
2025-01-03 02:01:24 +07:00
Rémi Verschelde b34adf29dc
Remove unused OS `_display_driver_id` member 2025-01-03 01:52:25 +07:00
Rémi Verschelde d47fef15b8
Merge pull request #100991 from TokageItLab/180deg-arc
Fix looking at with 180 degree arc
2025-01-03 00:49:59 +07:00
Rémi Verschelde 21e6671740
Merge pull request #100937 from Repiteo/style/clang-format-sync
Style: Enforce `AllowShortFunctionsOnASingleLine`
2025-01-03 00:49:44 +07:00
Rémi Verschelde 5ff616736a
Merge pull request #100825 from KoBeWi/colored_eight
Add `Color.from_rgba8` and deprecate Color8
2025-01-03 00:49:18 +07:00
Rémi Verschelde e9da833e6c
Merge pull request #100795 from hpvb/optimize-variant-clear
Don't set `Variant::Type` in destructor
2025-01-03 00:49:10 +07:00
Rémi Verschelde dd7d36e803
Merge pull request #100770 from hpvb/command-queue-mt
Core: Refactor CommandQueueMT to use vararg templates for performance and maintainability
2025-01-03 00:49:02 +07:00
Rémi Verschelde 0d710da96c
Merge pull request #98554 from Calinou/add-property-hint-ranges
Add more property hint ranges for project settings
2025-01-03 00:47:59 +07:00
Lukas Tenbrink b2d881a73a Optimize `_count` by replacing a full copy with a CoW copy for the full-string count case. 2025-01-02 18:16:06 +07:00
Thaddeus Crews e06d83860d
Style: Enforce `AllowShortFunctionsOnASingleLine` 2025-01-02 10:09:41 +07:00
HP van Braam cccd2432c3 Refactor CommandQueueMT to use vararg templates
In order to make CommandQueueMT more maintainable this PR changes the
previous macro hell with variadic templates instead. This makes the
class far more explicit and will allow us to more easily change the way
the class functions in the future.

Furthermore this refactoring has allowed for some optimizations. In
particular by using std::forward to delay the decision of decaying the
type to as late as possible we are able to move the data from the
callsite into our Command buffer and later move it to the call.

In practice what this means is that compared to the old version instead
of copying values 3 times, we can now get away with 1 copy, and 1 move
for lvalues, and just 2 moves for rvalues. This saves quite a few
operations in a hot codepath.

We also now test to make sure that the amount of copies and moves are
what we expect. This way we can spot performance regressions in this
code easily.

Somewhat unscientifically, running TPS-demo by pressing enter and not
touching the controls average mspf, repeatable across many runs:

before: 6.467
after : 6.202
2025-01-02 15:35:08 +07:00
Kiro 176e5f42b2 add Static assert checks 2025-01-02 09:02:43 +07:00
Silc Lizard (Tokage) Renew d0c421976c Fix looking at with 180 degree arc
Co-authored-by: Fruitsalad <949631+fruitsalad@users.noreply.github.com>
2025-01-02 15:47:01 +07:00
Rémi Verschelde f2d4dac92e
Thread: Re-add `<new>` include for `std::hardware_destructive_interference_size`
Somehow it would still build fine, but would crash when compiled with GCC 12.2
on Debian 12.

Also re-add wrongly removed Mutex include from `thread_safe.h`, where it's used
in macros.

Add IWYU pragma comments to prevent it from mistakenly flagging those as unused.
2025-01-01 22:43:42 +07:00
AThousandShips 25ecf5ec83
[Core] Fix UID encoding
Fixes edge case where `0` encoded as `uid://` instead of `uid://a`, and
fixes the size of the temporary buffer storing encoded UID strings.
2024-12-31 15:20:09 +07:00
Jan Haller df66ea74d7 Fix `NodePath::slice()` incorrect behavior for subname indexing
Adjust slice boundaries in `NodePath` logic to correctly handle subnames.
Update test cases to reflect these changes.
2024-12-30 21:22:26 +07:00
Kiro 52ee437d7e try Fixing Variant workaround 2024-12-29 16:35:10 +07:00
kobewi 4e48b19e1f Add Color.from_rgba8 and deprecate Color8 2024-12-27 11:26:59 +07:00
kobewi 81b1138a7f Fix icon UIDs in Project Manager 2024-12-26 14:54:09 +07:00
HP van Braam 46c23e1758 Don't set Variant::Type in destructor
When profiling Dome Keeper, I found that in physics_process a HashMap
gets cleared a lot, which ends up calling the Variant destructor.
Calling Variant::clear() dominates this operation.

By not uselessly setting the Type to NIL on destruction we save about
50% of time. This is likely because if there is a simple type in the
Variant that doesn't need destructing, but now we write when we should
just drop the Variant altogether.

Since the value of Variant::type should be unobservable after
destruction this doesn't change any outward behavior.
2024-12-25 23:40:19 +07:00
Hugo Locurcio 62c17911ea Add more property hint ranges for project settings
- Tweak property hint ranges for some networking settings to ensure
  the minimum values don't break the debugger entirely.
- Ensure shader time rollover is set to at least 1, as 0 causes a division by
  zero to occur.

All relevant project settings are now covered by a range hint.
2024-12-23 18:22:32 +07:00
Thaddeus Crews 08d4dd7fd8
Merge pull request #100694 from Ivorforce/cowdata-destruct-graciously
Destruct `CowData` more graciously by avoiding accidentally exposing a half-destructed buffer.
2024-12-23 11:15:18 +07:00
Thaddeus Crews b97c8b37f6
Merge pull request #98441 from Yelloween10/fix-modifier-mask
Fix incorrect `KEY_MODIFIER_MASK` value
2024-12-23 11:15:17 +07:00
Thaddeus Crews 3c304ab7cc
Merge pull request #96076 from AThousandShips/improve_null_check_core_drivers
[Core,Drivers] Improve use of `Ref.is_null/valid`
2024-12-23 11:14:58 +07:00
Yufeng Ying 73d85f46c9 Remove unused headers in scene.
Co-authored-by: Thaddeus Crews <repiteo@outlook.com>

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-24 00:40:09 +07:00
Rémi Verschelde 31c07776f4
Merge pull request #100683 from Ivorforce/localvector-vector-conversion-typesafe-copy
Make `LocalVector` -> `Vector` automatic conversion safe for non-trivial types.
2024-12-22 00:10:19 +07:00
Lukas Tenbrink 25cd923ea1 Destruct `CowData` more graciously by avoiding accidentally exposing a half-destructed buffer. This can avoid problems if any of the destructed objects tries to access the data while it's being destructed. 2024-12-21 20:01:03 +07:00
Lukas Tenbrink 0e32f3b957 Make `LocalVector` -> `Vector` automatic conversion safe for non-trivial types. 2024-12-21 10:28:57 +07:00
Rémi Verschelde dac0b67c4d
Merge pull request #100659 from clayjohn/color-srgb-precision
Increase precision in `linear_to_srgb()` and `srgb_to_linear()`
2024-12-20 23:57:35 +07:00
Rémi Verschelde c9e99291c1
Merge pull request #100622 from dsnopek/gdextension-compat-hashes
Rename `GDExtensionCompatHashes` to make it clear it's only for exceptional situations
2024-12-20 23:57:02 +07:00
Rémi Verschelde 119c99a8d0
Merge pull request #100193 from raulsntos/gdextension/set_class_icon
GDExtension: Add method to set the class icon
2024-12-20 23:56:48 +07:00
Rémi Verschelde a11364d1e6
Merge pull request #99010 from Hilderin/embedding-game-process
Embed game process in editor
2024-12-20 23:56:43 +07:00
clayjohn 46ce499b6f Increase precision in linear_to_srgb and srgb_to_linear
This avoids the situation where white stops being white after conversion. While maintaining as much floating point ops as possible
2024-12-20 10:49:43 +07:00
Thaddeus Crews 151e7fc687
Merge pull request #100477 from Ivorforce/cowdata-move-insert-n-remove
Optimize `CowData` and `LocalVector` functions `.insert` and `.remove_at` by using move semantics.
2024-12-19 20:00:20 +07:00
Thaddeus Crews 1b8a2d930f
Merge pull request #100474 from Ivorforce/cowdata-abstract-realloc
Abstract `CowData`'s reallocations into `_realloc` to consolidate duplicate logic.
2024-12-19 20:00:19 +07:00
Thaddeus Crews fb8d2ee044
Merge pull request #100582 from bruvzg/fix_in_ops
[GDScript] Fix `Packed*Array` `OP_IN` using low precision int and float as input.
2024-12-19 20:00:06 +07:00
Thaddeus Crews 416a86f47c
Merge pull request #100434 from Ivorforce/string-copy-from-rename
Rename `String::copy_from` functions to their respective encodings (`parse_latin1`, `parse_wstring`, `parse_utf32`).
2024-12-19 19:59:57 +07:00
Thaddeus Crews bf9ef5f8a5
Merge pull request #100564 from YYF233333/iwyu
Remove unused headers in core
2024-12-19 19:59:55 +07:00
Thaddeus Crews 92615f24e7
Merge pull request #100563 from Ivorforce/move-semantics-list
Add move semantics (constructor, operator=) to `List`.
2024-12-19 19:59:54 +07:00
Thaddeus Crews 0b01f3cc14
Merge pull request #100560 from Ivorforce/localvector-move-semantics
Add `LocalVector` move semantics (constructor and operator=).
2024-12-19 19:59:51 +07:00
Thaddeus Crews eaa447135c
Merge pull request #95920 from Repiteo/core/initializer-list-templates
Core: Expand `std::initializer_list` support in container templates
2024-12-19 19:59:42 +07:00
Thaddeus Crews a94b559f9b
Merge pull request #100483 from Ivorforce/string-name-move-semantics
Add move semantics (constructor, assignment) to `StringName`.
2024-12-19 19:59:34 +07:00
David Snopek 506600a560 Rename `GDExtensionCompatHashes` to make it clear it's only for exceptional situations 2024-12-19 18:08:42 +07:00
Lukas Tenbrink 8483d794ff Abstract `CowData`'s reallocations into `_realloc` to consolidate duplicate logic. 2024-12-19 17:27:16 +07:00
Lukas Tenbrink 3564e7c231 Add `LocalVector` move semantics (constructor and operator=). 2024-12-19 15:05:05 +07:00
Lukas Tenbrink 19992e3284 Add move semantics (constructor, operator=) to `List`. 2024-12-19 15:04:15 +07:00
Kiro 06efe84bca Remove duplicate `utf8()` calls 2024-12-19 10:15:46 +07:00
Thaddeus Crews 361e3b4fe8
Core: Expand `std::initializer_list` support 2024-12-18 18:46:59 +07:00
Hilderin 9d2a4c03be Embedding game process in editor 2024-12-18 17:52:42 +07:00
Pāvels Nadtočajevs eaf2d7c5b0 [GDScript] Fix `Packed*Array` `OP_IN` using low precision int and float as input. 2024-12-18 23:41:27 +07:00
Yufeng Ying be86ce3103 Apply iwyu suggestion in core. 2024-12-19 00:43:47 +07:00
Rémi Verschelde 851d8e49e8
Merge pull request #100386 from hpvb/core-ubsan
Core: Fix UBSAN reports
2024-12-18 17:23:32 +07:00
HP van Braam 240f510fa7 Core ubsan fixes
This fixes UBSAN errors reported by running our testsuite, importing the
TPS demo, and running the TPS demo. I have tried, wherever possible, to
fix issues related to reported issues but not directly reported by UBSAN
because thse code paths just happened to not have been exercised in
these cases.

These fixes apply only to errors reported, and caused by, core/

The following things have been changed:

* Make sure there are no implicit sign changing casts in core.
* Explicitly type enums that are part of a public API such that users of
  the API cannot pass in wrongly-sized values leading to potential stack
  corruption.
* Ensure that memcpy is never called with invalid or null pointers as
  this is undefined behavior, and when the engine is built with
  optimizations turned on leads to memory corruption and hard to debug
  crashes.
* Replace enum values only used as static values with constexpr static
  const values instead. This has no runtime overhead. This makes it so
  that the size of the enums is explicit.
* Make sure that nan and inf is handled consistently in String.
* Implement a _to_int template to ensure that all of the paths use the
  same algorhithm, and correct the negative integer case.
* Changed the way the json serializer precision work, and added tests to
  verify the new behavior. The behavior doesn't quite match master in
  particulary for negative doubles as the original code tried to cast -inf
  to an int. This then led to negative doubles losing all but one of
  their decimal points when serializing. Behavior in GDScript remains
  unchanged.
2024-12-18 14:31:12 +07:00
Rémi Verschelde d328c00ad3
Merge pull request #99667 from RandomShaper/res_load_verb
ResourceLoader: Print load message only when actually loading
2024-12-18 09:53:06 +07:00
Pedro J. Estébanez 6740823e40 ResourceLoader: Print load message only when actually loading 2024-12-18 09:36:16 +07:00
Yelloween 0153cb8c16 Fix incorrect MODIFIER_MASK value
Updated key modifier mask and documented API change

Changed the old value

Changed the old value inside the .expected file

Resolved Conflicts

Moved changes to the end
2024-12-18 02:59:29 +07:00
Hugo Locurcio 7a04d85ec3
Only allow valid types in Decal, Light3D projector, PointLight2D texture and CSGMesh3D mesh
If an invalid type is supplied (which can still be done from a script),
a warning is printed (along with a workaround for ViewportTexture).

This also adds support for "negative" resource hints such as
"Texture2D,-ViewportTexture" to exclude one or more subclasses
from a class hint.

Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
2024-12-17 20:41:12 +07:00
Lukas Tenbrink a636c04244 Optimize `CowData` and `LocalVector` functions `.insert` and `.remove_at` by using move semantics. 2024-12-17 14:10:10 +07:00
Raul Santos 69f1cc10b6
GDExtension: Add icon path to class creation info
Allows GDExtensions to set the icon of a class programmatically, which is useful for extensions that don't use a `.gdextension` file.
2024-12-17 08:43:12 +07:00
MJacred 40832387ce Fix Input::remove_joy_mapping
Erasing a joypad mapping can invalidate other attached joypads and the fallback mapping guid
2024-12-16 20:27:33 +07:00
Thaddeus Crews 24a8c05cbd
Merge pull request #100335 from kiroxas/Improve`ResourceUID--id_to_text`Performance
Improve `ResourceUID::id_to_text` performance
2024-12-16 12:10:05 +07:00
Thaddeus Crews e42c22f359
Merge pull request #100426 from Ivorforce/variant-move-constructor
Add move assignment and move constructor to Variant.
2024-12-16 12:09:52 +07:00