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

Saving a previously invalid compute shader from an external editor crashes the Godot editor #102205

Closed
woldendans opened this issue Jan 30, 2025 · 3 comments · Fixed by #102237
Closed

Comments

@woldendans
Copy link

woldendans commented Jan 30, 2025

Tested versions

  • Reproducible in: v4.4.beta2.official.a013481b0
  • Not reproducible in: v4.3.stable.official.77dcf97d8

System information

Godot v4.4.beta2 - Windows 11 (build 26100) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4060 (NVIDIA; 32.0.15.6636) - AMD Ryzen 5 5600X 6-Core Processor (12 threads)

Issue description

Saving a .glsl file containing a compute shader in an external editor after said compute shader failed to compile once results in a crash of the Godot editor.

The following error appears in the console:

Godot Engine v4.4.beta2.official.a013481b0 - https://godotengine.org
OpenGL API 3.3.0 NVIDIA 566.36 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 4060

Editing project: [...]/test-cellular-automaton
Godot Engine v4.4.beta2.official.a013481b0 - https://godotengine.org
Vulkan 1.3.289 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 4060

ERROR: Parameter "p_parent" is null.
   at: reparent (scene/main/node.cpp:1958)

================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.4.beta2.official (a013481b0911e59cc3f3dea7ebb732450c3e1460)
Dumping the backtrace. Please include this when reporting the bug to the project developer.

Here is the compute shader I use:

#[compute]
#version 450

// Invocations in the (x, y, z) dimension
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;

layout(set = 0, binding = 0, std140) uniform Parameters {
    vec4 p; // p.x -> height
}
parameters;

// Input buffer
layout(set = 0, binding = 1, std430) restrict readonly buffer Previous {
    int data[];
}
previous;

// Output buffer
layout(set = 0, binding = 2, std430) restrict writeonly buffer Next {
    int data[];
}
next;

// The code we want to execute in each invocation
void main() {
    uint idx = gl_GlobalInvocationID.x * uint(parameters.p.x) + gl_GlobalInvocationID.y;
    next.data[idx] *= previous.data[idx];
}

Steps to reproduce

Starting from an new empty project.

  • Open the Godot project folder in an external editor (VS Code).
  • Add a new test.glsl compute shader with probably any content. Mine is provided below.
  • Save, go in godot, it is correctly imported.
  • Make a valid modification, save, go to Godot, it is re-imported and everything works fine.
  • Go back to the external editor and make an invalid modification resulting in a failed compilation.
  • Go back to Godot, you are notified of the issue with your shader.
  • Now go back to the external editor and do any modification (valid or not) and save. Going back to Godot, the editor will simply crash.

Minimal reproduction project (MRP)

test-cellular-automaton-4.4.zip

@hilloftheking
Copy link

hilloftheking commented Jan 31, 2025

I can reproduce this. Here is a backtrace (on 9ee1873):

Thread 1 "godot.linuxbsd." received signal SIGSEGV, Segmentation fault.
Viewport::is_input_disabled (this=this@entry=0x0) at scene/main/viewport.cpp:3417
3417		return disable_input;

 0 in Viewport::is_input_disabled of scene/main/viewport.cpp:3417
 1 in ProgressDialog::_popup of editor/progress_dialog.cpp:173
 2 in ProgressDialog::add_task of editor/progress_dialog.cpp:208
 3 in EditorProgress::EditorProgress of editor/editor_node.cpp:191
 4 in EditorFileSystem::reimport_files of editor/editor_file_system.cpp:3073
 5 in EditorFileSystem::_update_scan_actions of editor/editor_file_system.cpp:962
 6 in EditorFileSystem::_notification of editor/editor_file_system.cpp:1691
 7 in Object::notification of core/object/object.cpp:911
 8 in SceneTree::_process_group of scene/main/scene_tree.cpp:1060
 9 in SceneTree::_process of scene/main/scene_tree.cpp:1137
10 in SceneTree::process of scene/main/scene_tree.cpp:578
11 in Main::iteration of main/main.cpp:4473
12 in OS_LinuxBSD::run of platform/linuxbsd/os_linuxbsd.cpp:962
13 in main of platform/linuxbsd/godot_linuxbsd.cpp:85

Also, I noticed that the ProgressDialog is not inside the tree when _popup() is called. So get_last_exclusive_window() returns nullptr.

@matheusmdx
Copy link
Contributor

Seems a regression between 4.4 beta 1 and 4.4 beta 2, i'll bisect.

@matheusmdx
Copy link
Contributor

matheusmdx commented Jan 31, 2025

Bisected to #101933, @KoBeWi

Image


Using part of the old code as fallback seems to fix the issue:

Image

But im not sure if this is the correct approach so i'll let Kobewi take a look on this first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bad
Development

Successfully merging a pull request may close this issue.

5 participants