-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Incorrect compilation of shaders in Forward Mobile causes it + D3D12 crash Godot #93249
Comments
I followed the steps to reproduce the bug but in my case the crash happens after set the rendering device to d3d12 and restart the editor so i'm not sure if my crash is exactly the same cause, also if i start using --rendering-driver d3d12 imediatly crash the engine even if i don't try open any project. Here the errors + backtrace:
If my case is a different bug please inform me and i'll open a separated issue |
@matheusmdx Yeah, I forgot to mention that as well. The editor also crashes after setting the rendering device to d3d12 and restarting the editor (though in your case, I see you are using the Forward+ method. Using Forward+ doesn't crash on my end). |
Also, it (could) be a separate issue. I can open any project, it's only when it tries to load it and the shaders that the crash occurs. |
Same as @matheusmdx: Changing |
Same thing here, the crash append when we edit the project
|
@matheusmdx's and @Noiros' crashes are due to D3D12 not being able to initialize. The way the situation is reported is cryptic indeed. We need to improve that. You may get further info with Regarding the MRP, I can open it successfully with the editor running on D3D12. I can also edit the shader and see it working. The only thing I need to change is the vertex function body to |
This is what Godot returns to me with
|
@RandomShaper As said previously, with Forward+ method and D3D12 the MRP works just fine (and also applying the position fix). The crash occurs when you switch the method to Mobile while the driver is D3D12. It'll crash as soon as the engine tries to load the scene with the shader applied (and sometimes, the crash is before the scene loads). |
And here is the log loading the MRP before the crash using ./windows_editor_x86_64_console.exe --path "E:\Repos\Github\moebius_shader" --rendering-method "mobile" --verbose --rendering-driver "d3d12" --editor >> log.txt
|
Moved the issue about failing to initialized D3D12 to #93670. |
I will update the title of this issue to be more precise after my findings. |
After compiling with #93707 I can't reproduce this crash. In master, I also couldn't reproduce this crash as I was getting the same crash at startup as reported in #93249 (comment) @MBCX Can you try testing with #93707 and see if it fixes the crash for you? It fixes an issue with reading textures back from the GPU. The editor uses this to display resource previews. So that could explain why you didn't get the crash until you selected the shader. For more context. The project manager doesn't read back any textures, so that explains why it didn't crash in the project manager for you (but did crash in editor). Also, many of the texture readbacks that the editor does get cached to disk. Which might explain why it crashed on startup for many of us, but not for you (as presumably you were working on this project before the crash was introduced and so you had a cached local file). Since the shader can change each frame, the resource preview isn't cached, so it reliably led to the crash. Anyway, that's my theory. Please test and confirm! |
Regarding the shader compilation crash itself, I've been able to reproduce it and I'm working on a fix. |
The mobile shader turned out to trigger the usage of a SPIR-V opcode that was left as a to do in the patch for SPIR-V-to-DXIL dependency. godotengine/godot-nir-static#14 should do the trick. |
I made a test build using the fixed mesa-nir library from godotengine/godot-nir-static#14 https://downloads.tuxfamily.org/godotengine/testing/Godot_v4.3-beta-nir-pr14_win64.exe.zip @MBCX @RandomShaper Could you confirm this official build solves it? That would confirm 4.3-beta3 will be properly fixed too. |
@akien-mga Yup, with that build the MRP now opens with D3D12 + Mobile without crashing! (and after applying the fixes for 4.3) |
Tested versions
System information
Godot v4.3.beta (e5b8ba7f2) - Windows 10.0.22631 - Vulkan (Mobile) - dedicated Radeon RX 580 Series (Advanced Micro Devices, Inc.; 31.0.21912.14) - Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (6 Threads)
Issue description
I was working on a game of mine, and I picked the
Forward Mobile
backend. In this project, I have incorporated 2 complex shaders, A Moebius art-style shader, and a beautiful distance-based pointillism (with depth).When I change the driver to use D3D12 instead of Vulkan, initially nothing happens. However, when Godot tries to either compile the aforementioned shaders or (in my testing) even double clicking on the shader file to open it, makes the editor crash. When I try to open the project (with the setting set) it crashes silently, and the project cannot be open unless the
rendering_device/driver.windows
property is set back tovulkan
.It also gives me a backtrace that doesn't look useful, but here it is anyway.
I will have to test this further because not all complex shaders make Godot crash. This one for example has a lot of stuff going yet it doesn't crash in my testing, even after converting it to 3D.
Steps to reproduce
Driver.windows
to D3D12.moebius.gdshader
hint_normal_roughness_texture is only available when using the Forward+ backend.
remove that feature.Minimal reproduction project (MRP)
Moebius art-style shader project
The text was updated successfully, but these errors were encountered: