1
0
Fork 0
Commit Graph

293 Commits

Author SHA1 Message Date
Yufeng Ying 3bf400ffae Move bisect to Span and deduplicate code.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-05-14 18:19:09 +08:00
Yufeng Ying 0babb2ab02 Optimize HashMap size for zero-sized Allocators. 2025-05-13 21:44:39 +08:00
Rémi Verschelde 4c62c8aceb
Merge pull request #106020 from Ivorforce/hashmap-duplicate-hash
Optimize `HashMap` insertion by removing duplicate computation of hash and position
2025-05-13 01:04:57 +02:00
Rémi Verschelde 2b037e8989
Merge pull request #93276 from mashumafi/avoid-vec-copy
Avoid unnecessary copy-on-write Vector/Array
2025-05-13 01:04:16 +02:00
mashumafi b73346ef19 Avoid copy-on-write when reading vectors 2025-05-12 16:08:05 +02:00
Yufeng Ying 2db0a44519 Remove vmap.h 2025-05-09 19:05:28 +08:00
Lukas Tenbrink 1d49a557b6 Optimize away duplicate hash and position computation in `HashMap` on insert.
Co-authored-by: Nazarii <nazarii.yablonskyi.pp.2022@lpnu.ua>
2025-05-02 19:02:03 +02:00
Thaddeus Crews 01fc9aee6c
Core: Modernize C headers with C++ equivalents 2025-05-02 08:23:01 -05:00
Lukas Tenbrink 1b1ab76a14 Add `FixedVector` template.
This is a high performance `Vector`-like object that can be used if the maximum number of objects is small and known, and the objects are needed only temporarily.
2025-04-30 19:14:08 +02:00
Thaddeus Crews 44d20b2dc6
Merge pull request #100619 from Ivorforce/cowdata-resize-direct
Optimize / refactor `CowData`, combining resize and fork to avoid unnecessary reallocations.
2025-04-28 18:45:54 -05:00
lawnjelly ae04a3a5dd Physics Interpolation - Move 3D FTI to `SceneTree`
Moves 3D interpolation from server to the client code (`SceneTree`).
Complete rework of 3D physics interpolation, but using the same user API.
2025-04-26 14:13:30 +01:00
Lukas Tenbrink d74ef8cb01 Rename `LocalVector.invert()` -> `LocalVector.reverse()` to match the `Vector`, `String` and `List` APIs. 2025-04-24 22:36:32 +02:00
Lukas Tenbrink 7c37188ca1 Smoke test: In collections, log an error if `reserve()` is called with a number smaller than the current size. Don't log an error if it is called with a number smaller than the current capacity. 2025-04-23 16:47:47 +02:00
Thaddeus Crews 2ffd5a3913
Merge pull request #104738 from YYF233333/cleanup_rid_owner
Use `LocalVector` in `RID_Owner::get_owned_list`
2025-04-22 10:44:25 -05:00
Thaddeus Crews c0e695d5e8
Merge pull request #100944 from Nazarwadim/LocalVector_use_1.5x_growth_factor
Use 1.5x growth factor for LocalVector
2025-04-21 08:24:22 -05:00
Yyf2333 1a70a06a43 Change RID_Owner::get_owned_list. 2025-04-21 01:04:27 +08:00
clayjohn c6c06a966a Allow chunk validator to wrap around in RID_Alloc so that we do not need to crash once we have made 2^31 allocations 2025-04-18 00:06:53 -07:00
Lukas Tenbrink 015a3b0434 Optimize / refactor `CowData`, combining `resize` and `fork` to avoid unnecessary reallocations. 2025-04-15 17:01:26 +02:00
Thaddeus Crews addab4f001
Merge pull request #95916 from Repiteo/core/bit-field
Core: Add dedicated `BitField` template
2025-04-11 13:29:13 -05:00
Thaddeus Crews 0d267e7b1e
Core: Add dedicated `BitField` template 2025-04-11 11:53:26 -05:00
Lukas Tenbrink b711d72e8f Remove unnecessary `friend class` declarations of `CowData`.
Use default implementations for various containers.
2025-04-11 18:26:08 +02:00
Thaddeus Crews 94282d88f9
Core: Use `Math` namespace for constants 2025-04-10 16:29:30 -05:00
Thaddeus Crews 5edb235018
CI: Bump various pre-commit hooks 2025-04-07 08:23:35 -05:00
Thaddeus Crews 207a2b6472
Core: Integrate warning suppression macro helpers 2025-04-03 10:13:46 -05:00
Lukas Tenbrink ccdc5862e9 Add `LocalVector.erase_unordered`, mimicking `erase` but with `remove_at_unordered`, to remove duplicate logic.
`erase_unordered` should be preferred over `erase` where order is not important, for its performance benefits.

Co-authored-by: smix8 <smix8@users.noreply.github.com>
2025-03-31 13:31:53 +02:00
Rémi Verschelde afc7398c2b
Merge pull request #104616 from ibrahn/init-cmd-q-pending-and-gles3-skymatdata
Fix uninitialized member vars in CommandQueueMT and RasterizerSceneGLES3
2025-03-28 17:30:37 +01:00
Rémi Verschelde 4a31936bc1
Merge pull request #104693 from mihe/local-vector-move
Optimize `LocalVector::push_back` for non-trivial objects
2025-03-28 14:34:49 +01:00
Rémi Verschelde 76c30189fa
Merge pull request #103923 from Ivorforce/span-array-init
Add C array constructor to `Span`.
2025-03-28 14:32:14 +01:00
Mikael Hermansson 5c5b9847da Optimize `LocalVector::push_back` for non-trivial objects 2025-03-27 14:22:30 +01:00
Ibrahn Sahir c9352f06f7 Fix uninitialised member vars in CommandQueueMT and RasterizerSceneGLES3 2025-03-25 17:19:16 +00:00
Thaddeus Crews 8f16b86d7e
Core: Include `intrin.h` for MSVC 2025-03-24 15:19:49 -05:00
Thaddeus Crews 4c9086312d
Merge pull request #103698 from AThousandShips/fix_a_hash_map_construct
[Core] Fix `AHashMap` constructors reserving too few elements
2025-03-23 19:03:59 -05:00
Thaddeus Crews f09ee0171a
Style: Begin integrating simple `.clangd` fixes 2025-03-22 13:24:35 -05:00
Rémi Verschelde 64bd03269f
Merge pull request #104286 from Ivorforce/localvector-find
Harmonize `String`, `Vector` and `LocalVector` `find` and `rfind`.
2025-03-19 12:27:27 +01:00
Lukas Tenbrink fde71e0382 Harmonize `String`, `Vector` and `LocalVector` `find` and `rfind`.
Use `Span::find` for `LocalVector::find`, accepting negative `p_from`.
Return `-1` for invalid `p_from` values in `rfind`.
Accept negative values for `p_from` in `find`, starting from the back.
2025-03-18 12:37:36 +01:00
Thaddeus Crews 4320800621
Core: Expand `is_zero_constructible` coverage 2025-03-17 11:45:26 -05:00
Lukas Tenbrink 49e860159a Move `CowData` `find`, `rfind` and `count` to `Span`. 2025-03-16 03:31:11 +01:00
Lukas Tenbrink 78221946cc Add C array constructor to `Span`. [skip ci] 2025-03-12 16:48:16 +01:00
Thaddeus Crews 74907876d3
Merge pull request #103759 from Ivorforce/zero-constructible
Optimize `Array.resize` by using `memset` (through new `is_zero_constructible` type trait)
2025-03-12 10:31:55 -05:00
Lukas Tenbrink 75bc471965 Add `is_zero_constructible` to denote if a type can be semi-trivially constructed with all 0 bytes.
Optimize `CowData` and `LocalVector` resize for zero constructible types.
Mark several compatible types as `is_zero_constructible`.
2025-03-12 09:49:24 +01:00
Lukas Tenbrink 55a7de93c7 Add iteration to `Span`. 2025-03-11 23:46:25 +01:00
Lukas Tenbrink f5cb739a18 Add `Span` conversion to `LocalVector`. 2025-03-10 22:30:39 +01:00
Thaddeus Crews a13067e61f
Merge pull request #97553 from AThousandShips/semantic_equal
[Core] Add `is_same` to types that have float components
2025-03-10 10:01:05 -05:00
Lukas Tenbrink 605b62cd29 Add `Span` struct (replacing `StrRange`). Spans represent read-only access to a contiguous array, resembling `std::span`. 2025-03-09 18:19:51 +01:00
Thaddeus Crews 324512e11c
Style: Replace header guards with `#pragma once` 2025-03-07 17:33:47 -06:00
A Thousand Ships fad8134dca
[Core] Fix `AHashMap` constructors reserving too few elements 2025-03-06 15:28:37 +01:00
Pāvels Nadtočajevs bdb5d522d1 Use atomic flag to prevent `flush_if_pending` from reading unlocked `command_mem`. 2025-02-25 23:26:43 +02:00
A Thousand Ships e825085978
[Core] Add `is_same` to types that have float components
Compares `NaN` as equal.

Added to:
* `AABB`
* `Basis`
* `Color`
* `Plane`
* `Projection`
* `Quaternion`
* `Rect2`
* `Transform2D`
* `Transform3D`
* `Vector2`
* `Vector3`
* `Vector4`

And added as a method in `Math`
2025-02-03 19:25:50 +01:00
Matias N. Goldberg 7b2f1e1d09 Fix union order to simplify empty initializers
This is a followup to PR #101344 (commit
0e06eb80bc).

Some of them were not an issue because Godot was initializing all
members, but they were "fixed" just in case since it could become a
problem in the future.

Valgrind was specifically complaining about HashMapData &
GlobalPipelineData.
2025-01-14 19:05:01 -03: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 +01:00