This commit addresses multiple issues with `Variant`s that point to an `Object`
which is later released, when it's tried to be accessed again.
Formerly, **while running on the debugger the system would check if the instance id was
still valid** to print warnings or return special values. Some cases weren't being
warned about whatsoever.
Also, a newly allocated `Object` could happen to be allocated at the same memory
address of an old one, making cases of use hard to find and having **`Variant`s pointing
to the old one magically reassigned to the new**.
This commit makes the engine realize all these situations **under debugging**
so you can detect and fix them. Running without a debugger attached will still
behave as it always did.
Also the warning messages have been extended and made clearer.
All that said, in the name of performance there's still one possible case of undefined
behavior: in multithreaded scripts there would be a race condition between a thread freeing
an `Object` and another one trying to operate on it. The latter may not realize the
`Object` has been freed soon enough. But that's a case of bad scripting that was never
supported anyway.
Joining items across z_indices can interfere with light culling for lights which only affect certain z ranges. This PR disables joining across z_indices when lights are present, except specifically for lights with both z_min set to the global minimum (-4096) and z_max set to the global maximum (4096).
In addition, the z_index is now stored on the joined_item for accurate light culling. The z_index is also displayed in frame diagnostics.
Needed for the next commit. That's the only place in all the Godot code base
where that's attempted and it's not needed because Objects are not meant to
be copied that way.
- Include PDB files in exported games.
- Release export templates also allow debugging now.
Right now the only way to enable debugging in exported games is with the environment variables, which may be cumbersome or not even possible on some platforms.
(cherry picked from commit 71fc87e101)
The issue was caused by PR #36906 which changes prevented the generated shared libraries from being stripped.
Since the change is only needed for development (debugging) purposes, it's commented out by default.
(cherry picked from commit 2f38cfd9ab)
In rare circumstances default batches were being joined incorrectly, causing visual regressions. This logic has been fixed.
In addition slightly more output information has been added to frame diagnosis mode.
This also replaces a non-breaking space that was accidentally added in
the EditorFeatureProfile documentation.
This closes#31393.
(cherry picked from commit 2f46f1e7b1)
Batching across z_index layers was not preserving the batch_break flag, which determines whether to not join the previous item. This is fixed by storing the flag in RenderItemState and preserving it across canvas_render_items calls.
- Replaces BuildPoly with Build2DFaces, which creates faces as each
pair of face intersections are processed, instead of trying to create
them after all the intersections are processed. Ensures that faces are
merged when possible, and removes degenerate triangles.
- Treats the child as inside the parent when faces are coplanar.
- General clean up of csg.h and csg.cpp.
New contributors added to AUTHORS:
@dreamsComeTrue, @kuruk-mm, @lawnjelly, @ThakeeNathees
Thanks to all contributors and donors for making Godot possible!
(cherry picked from commit 74d60328f8)