Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make push_error and push_warning print name of calling function #93648

Open
wants to merge 81 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
1aaa831
Allow constructing `List`s from `initializer_list`s
TV4Fun Jun 27, 2024
1a75580
Make `push_error` and `push_warning` print name of calling function
TV4Fun Jun 27, 2024
60b85b5
Fix code style issues
TV4Fun Jun 27, 2024
ebdcbb8
Move C++ code line discovery to its own function
TV4Fun Jun 27, 2024
0b950f5
Move platform dependent code into `OS` class and fix stacktrace from …
TV4Fun Jun 28, 2024
1e21798
Try fix for Linux builds
TV4Fun Jun 28, 2024
b40173e
Actual fix for Linux builds
TV4Fun Jun 28, 2024
0fa4ac1
Fix Android and Web builds
TV4Fun Jun 28, 2024
db30f65
Fix hashing context example
dmipeck May 14, 2024
afa0169
Update import dock when select resource in resource panel
jsjtxietian Jun 24, 2024
10f467e
Update the github Android builds config
m4gr3d Jun 24, 2024
48ae4ee
Improve viewport rotation gizmo drawing
passivestar Jun 26, 2024
35168f0
Fix support for environment blend modes on `WebXRInterface`
dsnopek Jun 27, 2024
75abfad
Remove useless instantiation in RDShaderFile::parse_versions_from_text
ze2j Jun 27, 2024
63a6ec0
Fix AudioStreamPlayer icons, improve audio resource picker styling
ckaiser May 29, 2024
21678c5
CodeEdit Fix move lines up/down viewport and selection issues
kitbdev Jun 25, 2024
7981b4a
Center the label in overview of script editor
passivestar Jun 27, 2024
26b1d32
Document AudioEffectSpectrumAnalyzerInstance, clarify relationship wi…
bpseudopod Apr 22, 2024
7437f4b
Fix find highlight when switching scripts
kitbdev Jun 11, 2024
69e4ba6
fix animation bezier keys not showing in inspector after selection
CookieBadger Jun 20, 2024
573aa0c
Reset when disabling override pose in BoneAttachment3D
TokageItLab Jun 22, 2024
f5f322b
Fix default collision shape on imported rigidbody
BastiaanOlij Jun 23, 2024
c608485
Fix TileSet property painter popup showing clear color
passivestar Jun 25, 2024
aaacafa
Remove warning when project setting requests a larger global shader u…
clayjohn Jun 26, 2024
e706d96
ThorVG: Update to 0.14.0
capnm Jun 27, 2024
a3ee0bc
add missing punctuation to the default list
vgezer Jun 27, 2024
6cc94d2
Fix duplicating nodes with Array properties
KoBeWi Jun 27, 2024
3e996cd
Fix find result current match count
kitbdev Jun 27, 2024
dda22b0
[OpenXR] Fix LOCAL_FLOOR emulation on HTC Vive XR Elite
dsnopek Jun 27, 2024
b6d725a
Wayland: minimize surface commits and limit them to the main thread
Riteo Jun 27, 2024
10acfc9
GDScript: Add `CONFUSABLE_CAPTURE_REASSIGNMENT` warning
dalexeev Jun 28, 2024
86f1be8
Fix text editor stealing focus from "Find in Files" dialog on X11
dsnopek Jun 27, 2024
80b1c7a
Fix clear_custom_color on invalid tree_item_inspected
AeioMuch Jun 24, 2024
de62c27
Fix synchronization of global class name
Hilderin May 24, 2024
8de1190
GDScript: partially allow some functions on invalid scripts
rune-scape Jun 2, 2024
7bcb187
WorkerThreadPool: Refactor deadlock prevention collaboration into a g…
RandomShaper Jun 19, 2024
8b9a662
GDScript: Avoid deadlock possibility in multi-threaded load
RandomShaper Jun 19, 2024
c222ee9
Windows: Fix arch detection via VCTOOLSINSTALLDIR
mhilbrunner Jun 25, 2024
b00b555
Use `PackedVector4Array` instead of float array for vec4 array uniform
Chaosus Jun 26, 2024
32fb747
ResourceLoader: Support polling and get-before-complete on the main t…
RandomShaper Jun 28, 2024
9752b0b
Revert the default InterpolationType with angle property to Linear
TokageItLab Jun 28, 2024
f1780fe
GDScript: Fix false positive `CONFUSABLE_CAPTURE_REASSIGNMENT` warnings
dalexeev Jun 28, 2024
9af1a9d
Allow selecting TileMapLayers by clicking them
KoBeWi May 16, 2024
9ea9161
Add alternative shortcut for Align Transform to View in the 3D editor
Calinou Jun 27, 2024
5d9cecc
Fix tile polygon editor grid and missing update
groud Jun 11, 2024
a6cad24
Fix snapping lines don't disappearing after drag anchors
matheusmdx Jun 24, 2024
9f73e5f
Update note regarding 3D MSAA and foveated rendering
decacis Jun 27, 2024
d34ea4e
Improve handling of rendering startup errors
RandomShaper Jun 28, 2024
9150172
WorkerThreadPool: Fix wrong pointer used in the case of BinaryMutex
RandomShaper Jun 28, 2024
ec7bbd4
X11: Fix creating RenderingDevice after #93706
akien-mga Jun 29, 2024
01e3df5
NavigationServer3D.map_get_closest_point_to_segment - add an addition…
oshman99 Jun 24, 2024
c4aeb02
Use Hermite instead of Bezier for glTF spline interpolation
Gurvan Jun 25, 2024
ba3f66c
Fix unnecessary overbright modulates used in a few editors
MewPurPur Jun 28, 2024
d8a84a6
[GraphEdit] Add a note about the behavior of get_children()
Geometror Jun 29, 2024
e9d945d
Make the frame time and info boxes have same margins
passivestar Jun 29, 2024
5f0e6d7
Add alternative pixel rounding
markdibarry Jun 29, 2024
8c20c12
Fix: set max_width for icons in the quick open popup
poga Jun 29, 2024
aad12fb
[Tests] Fix unit tests in template builds
AThousandShips Jun 29, 2024
7136d1e
Fix some TileMapLayer editing problems
KoBeWi Jun 29, 2024
6fcdfbd
Clarify word separator docs about shortcuts
kitbdev Jun 30, 2024
8fa0e8e
Fix "icon" parameter in EditorPlugin.add_custom_type is not optional,…
ashish0kumar Jun 30, 2024
3e03ee2
Fix Bezier track init value on caching
TokageItLab Jun 30, 2024
91f70dc
[macOS] Change the distraction-free mode shortcut
passivestar Jun 30, 2024
fb30b9c
Prevent shader crash when doing invalid operation on boolean vector
Chaosus Jun 30, 2024
cc33f6e
Add input event callback to `DisplayServerHeadless`
mihe Jun 5, 2024
5c5fe99
Prevent selecting when a CanvasItem is selected
KoBeWi Jun 27, 2024
6b91aef
Fix assignations to non-existing keys and clean-up
adamscott Jun 29, 2024
cd91a78
fixed the y-sorting description having higher and lower inverted (oops!)
AdriaandeJongh Jul 1, 2024
eea7c7f
Revert "Make freed object different than null in comparison operators"
akien-mga Jul 1, 2024
e3630fa
D3D12: Use the right state for resources in certain heap types
RandomShaper Jun 28, 2024
f15f513
Fix asset pipeline coordinate systems doc url
Trinovantes Jun 30, 2024
57b7dd6
Fix Info about Global library on add_animation_library method in doc/…
ashish0kumar Jul 1, 2024
dd88086
Fix AtlasTexture::draw_rect flipping for non-zero margin
kleonc Jul 1, 2024
f61ca88
fix animation bezier crash on undo
CookieBadger Jun 22, 2024
90f7319
Fix orphan StringName's in ShaderLanguage
Chaosus Jul 2, 2024
3643ea7
Fix RMB erasing of tiles
KoBeWi Jul 2, 2024
99932ce
Physics Interpolation - Fix `interpolated_transform_2d`
lawnjelly Jul 2, 2024
07c8d9a
Fix: AnimationMixer Example Code
ayanchavand Jul 2, 2024
57c00fd
GDScript: Invalidate cached parser chain when reloading
rune-scape May 16, 2024
487c81d
Enable usage of asan-enabled versions of prebuilt libraries
RandomShaper Jun 14, 2024
da8edac
[Web] Remove unnecessary EMCC_FORCE_STDLIBS in dlink builds
Faless Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 40 additions & 14 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,30 @@ concurrency:
cancel-in-progress: true

jobs:
android-template:
build-android:
runs-on: "ubuntu-20.04"
name: Template (target=template_release)
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Editor (target=editor)
cache-name: android-editor
target: editor
tests: false
sconsflags: arch=arm64 production=yes

- name: Template arm32 (target=template_release, arch=arm32)
cache-name: android-template-arm32
target: template_release
tests: false
sconsflags: arch=arm32

- name: Template arm64 (target=template_release, arch=arm64)
cache-name: android-template-arm64
target: template_release
tests: false
sconsflags: arch=arm64

steps:
- uses: actions/checkout@v4
Expand All @@ -30,33 +51,38 @@ jobs:

- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Compilation (arm32)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm32
platform: android
target: template_release
tests: false

- name: Compilation (arm64)
- name: Compilation
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: android
target: template_release
tests: false
target: ${{ matrix.target }}
tests: ${{ matrix.tests }}

- name: Generate Godot templates
if: matrix.target == 'template_release'
run: |
cd platform/android/java
./gradlew generateGodotTemplates
cd ../../..
ls -l bin/

- name: Generate Godot editor
if: matrix.target == 'editor'
run: |
cd platform/android/java
./gradlew generateGodotEditor
cd ../../..
ls -l bin/android_editor_builds/

- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}
62 changes: 62 additions & 0 deletions core/error/error_macros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "error_macros.h"

#include "core/io/logger.h"
#include "core/object/script_language.h"
#include "core/os/os.h"
#include "core/string/ustring.h"

Expand Down Expand Up @@ -125,6 +126,67 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
_err_print_index_error(p_function, p_file, p_line, p_index, p_size, p_index_str, p_size_str, p_message.utf8().get_data(), p_editor_notify, p_fatal);
}

void _err_print_callstack(const String &p_error, bool p_editor_notify, ErrorHandlerType p_type) {
// Print detailed call stack information from everywhere available. It is recommended to only
// use this for debugging, as it has a fairly high overhead.
String callstack;

// Print script stack frames, if available.
Vector<ScriptLanguage::StackInfo> si;
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
si = ScriptServer::get_language(i)->debug_get_current_stack_info();
if (si.size()) {
callstack += "Callstack from " + ScriptServer::get_language(i)->get_name() + ":\n";
for (int j = 0; j < si.size(); ++j) {
callstack += si[i].file + ':' + itos(si[i].line) + " @ " + si[i].func + '\n';
}
callstack += '\n';
}
}

// Print C++ call stack.
Vector<OS::StackInfo> cpp_stack = OS::get_singleton()->get_cpp_stack_info();
callstack += "C++ call stack:\n";
for (int i = 0; i < cpp_stack.size(); ++i) {
String descriptor = OS::get_singleton()->get_debug_descriptor(cpp_stack[i]);
callstack += descriptor + " (" + cpp_stack[i].file + ":0x" + String::num_uint64(cpp_stack[i].offset, 16) + " @ " + cpp_stack[i].function + ")\n";
}

_err_print_error(__FUNCTION__, __FILE__, __LINE__, p_error + '\n' + callstack, p_editor_notify, p_type);
}

void _err_print_error_backtrace(const char *filter, const String &p_error, bool p_editor_notify, ErrorHandlerType p_type) {
// Print script stack frame, if available.
Vector<ScriptLanguage::StackInfo> si;
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
si = ScriptServer::get_language(i)->debug_get_current_stack_info();
if (si.size()) {
_err_print_error(si[0].func.utf8(), si[0].file.utf8(), si[0].line, p_error, p_editor_notify, p_type);
return;
}
}

// If there is not a script stack frame, use the C++ stack frame.
Vector<OS::StackInfo> cpp_stack = OS::get_singleton()->get_cpp_stack_info();

for (int i = 1; i < cpp_stack.size(); ++i) {
if (!cpp_stack[i].function.contains(filter)) {
String descriptor = OS::get_singleton()->get_debug_descriptor(cpp_stack[i]);
if (descriptor.is_empty()) {
// If we can't get debug info, just print binary file name and address.
_err_print_error(cpp_stack[i].function.utf8(), cpp_stack[i].file.utf8(), cpp_stack[i].offset, p_error, p_editor_notify, p_type);
} else {
// Expect debug descriptor to replace file and line info.
_err_print_error(cpp_stack[i].function.utf8(), cpp_stack[i].file.utf8(), cpp_stack[i].offset, "", descriptor + ": " + p_error, p_editor_notify, p_type);
}
return;
}
}

// If there is no usable stack frame (this should basically never happen), fall back to using the current stack frame.
_err_print_error(__FUNCTION__, __FILE__, __LINE__, p_error, p_editor_notify, p_type);
}

void _err_flush_stdout() {
fflush(stdout);
}
2 changes: 2 additions & 0 deletions core/error/error_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message = "", bool p_editor_notify = false, bool fatal = false);
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool p_editor_notify = false, bool fatal = false);
void _err_print_callstack(const String &p_error, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
void _err_print_error_backtrace(const char *filter, const String &p_error, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
void _err_flush_stdout();

#ifdef __GNUC__
Expand Down
37 changes: 37 additions & 0 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "core/string/print_string.h"
#include "core/string/translation.h"
#include "core/variant/variant_parser.h"
#include "servers/rendering_server.h"

#ifdef DEBUG_LOAD_THREADED
#define print_lt(m_text) print_line(m_text)
Expand Down Expand Up @@ -585,6 +586,16 @@ ResourceLoader::ThreadLoadStatus ResourceLoader::load_threaded_get_status(const
*r_progress = _dependency_get_progress(local_path);
}

// Support userland polling in a loop on the main thread.
if (Thread::is_main_thread() && status == THREAD_LOAD_IN_PROGRESS) {
uint64_t frame = Engine::get_singleton()->get_process_frames();
if (frame == load_task.last_progress_check_main_thread_frame) {
_ensure_load_progress();
} else {
load_task.last_progress_check_main_thread_frame = frame;
}
}

return status;
}

Expand Down Expand Up @@ -613,6 +624,21 @@ Ref<Resource> ResourceLoader::load_threaded_get(const String &p_path, Error *r_e
}
return Ref<Resource>();
}

// Support userland requesting on the main thread before the load is reported to be complete.
if (Thread::is_main_thread() && !load_token->local_path.is_empty()) {
const ThreadLoadTask &load_task = thread_load_tasks[load_token->local_path];
while (load_task.status == THREAD_LOAD_IN_PROGRESS) {
if (!_ensure_load_progress()) {
// This local poll loop is not needed.
break;
}
thread_load_lock.~MutexLock();
OS::get_singleton()->delay_usec(1000);
new (&thread_load_lock) MutexLock(thread_load_mutex);
}
}

res = _load_complete_inner(*load_token, r_error, thread_load_lock);
if (load_token->unreference()) {
memdelete(load_token);
Expand Down Expand Up @@ -731,6 +757,17 @@ Ref<Resource> ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro
}
}

bool ResourceLoader::_ensure_load_progress() {
// Some servers may need a new engine iteration to allow the load to progress.
// Since the only known one is the rendering server (in single thread mode), let's keep it simple and just sync it.
// This may be refactored in the future to support other servers and have less coupling.
if (OS::get_singleton()->get_render_thread_mode() == OS::RENDER_SEPARATE_THREAD) {
return false; // Not needed.
}
RenderingServer::get_singleton()->sync();
return true;
}

Ref<Resource> ResourceLoader::ensure_resource_ref_override_for_outer_load(const String &p_path, const String &p_res_type) {
ERR_FAIL_COND_V(load_nesting == 0, Ref<Resource>()); // It makes no sense to use this from nesting level 0.
const String &local_path = _validate_local_path(p_path);
Expand Down
3 changes: 3 additions & 0 deletions core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class ResourceLoader {
String type_hint;
float progress = 0.0f;
float max_reported_progress = 0.0f;
uint64_t last_progress_check_main_thread_frame = UINT64_MAX;
ThreadLoadStatus status = THREAD_LOAD_IN_PROGRESS;
ResourceFormatLoader::CacheMode cache_mode = ResourceFormatLoader::CACHE_MODE_REUSE;
Error error = OK;
Expand All @@ -197,6 +198,8 @@ class ResourceLoader {

static float _dependency_get_progress(const String &p_path);

static bool _ensure_load_progress();

public:
static Error load_threaded_request(const String &p_path, const String &p_type_hint = "", bool p_use_sub_threads = false, ResourceFormatLoader::CacheMode p_cache_mode = ResourceFormatLoader::CACHE_MODE_REUSE);
static ThreadLoadStatus load_threaded_get_status(const String &p_path, float *r_progress = nullptr);
Expand Down
34 changes: 2 additions & 32 deletions core/math/transform_interpolator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,44 +33,14 @@
#include "core/math/transform_2d.h"

void TransformInterpolator::interpolate_transform_2d(const Transform2D &p_prev, const Transform2D &p_curr, Transform2D &r_result, real_t p_fraction) {
// Extract parameters.
Vector2 p1 = p_prev.get_origin();
Vector2 p2 = p_curr.get_origin();

// Special case for physics interpolation, if flipping, don't interpolate basis.
// If the determinant polarity changes, the handedness of the coordinate system changes.
if (_sign(p_prev.determinant()) != _sign(p_curr.determinant())) {
r_result.columns[0] = p_curr.columns[0];
r_result.columns[1] = p_curr.columns[1];
r_result.set_origin(p1.lerp(p2, p_fraction));
r_result.set_origin(p_prev.get_origin().lerp(p_curr.get_origin(), p_fraction));
return;
}

real_t r1 = p_prev.get_rotation();
real_t r2 = p_curr.get_rotation();

Size2 s1 = p_prev.get_scale();
Size2 s2 = p_curr.get_scale();

// Slerp rotation.
Vector2 v1(Math::cos(r1), Math::sin(r1));
Vector2 v2(Math::cos(r2), Math::sin(r2));

real_t dot = v1.dot(v2);

dot = CLAMP(dot, -1, 1);

Vector2 v;

if (dot > 0.9995f) {
v = v1.lerp(v2, p_fraction).normalized(); // Linearly interpolate to avoid numerical precision issues.
} else {
real_t angle = p_fraction * Math::acos(dot);
Vector2 v3 = (v2 - v1 * dot).normalized();
v = v1 * Math::cos(angle) + v3 * Math::sin(angle);
}

// Construct matrix.
r_result = Transform2D(Math::atan2(v.y, v.x), p1.lerp(p2, p_fraction));
r_result.scale_basis(s1.lerp(s2, p_fraction));
r_result = p_prev.interpolate_with(p_curr, p_fraction);
}
Loading