-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
[4.0] iOS shader validation crash #42516
Comments
Update: this seems to be happening only when application is launched in debug mode through Xcode |
Indeed, @bruvzg mentioned that issue on the PR too: #41810 (comment) |
@akien-mga yeah, I've seen same errors running Godot Editor by Xcode, but it wasn't crashing. |
It's definitely not crashing on macOS, just printing errors and features related to the failing sharer are broken. And the errors are different, but similar unused variables errors do pop up on macOS too, but only when using MoltenVK debug build (see #40833). Also, I was messing with the shaders that failing on macOS, and following patch seems to fix compilation and runtime errors in particle and SDFGI shaders (not the debug unused variable errors), but I'm not sure what effect it will have on performance, and if it's correct at all (also not tested it with latest MoltenVK release, some errors might be already fixed, or will be when Metal 3 is fully used): diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index 958d8eac1f..494cc7006b 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -317,9 +317,9 @@ void RasterizerSceneRD::sdfgi_update(RID p_render_buffers, RID p_environment, co
}
RD::TextureFormat tf_occlusion = tf_sdf;
- tf_occlusion.format = RD::DATA_FORMAT_R16_UINT;
- tf_occlusion.shareable_formats.push_back(RD::DATA_FORMAT_R16_UINT);
- tf_occlusion.shareable_formats.push_back(RD::DATA_FORMAT_R4G4B4A4_UNORM_PACK16);
+ tf_occlusion.format = RD::DATA_FORMAT_R32_UINT;
+ tf_occlusion.shareable_formats.push_back(RD::DATA_FORMAT_R32_UINT);
+ tf_occlusion.shareable_formats.push_back(RD::DATA_FORMAT_A8B8G8R8_UNORM_PACK32);
tf_occlusion.depth *= sdfgi->cascades.size(); //use depth for occlusion slices
tf_occlusion.width *= 2; //use width for the other half
@@ -389,7 +389,7 @@ void RasterizerSceneRD::sdfgi_update(RID p_render_buffers, RID p_environment, co
sdfgi->occlusion_data = RD::get_singleton()->texture_create(tf_occlusion, RD::TextureView());
{
RD::TextureView tv;
- tv.format_override = RD::DATA_FORMAT_R4G4B4A4_UNORM_PACK16;
+ tv.format_override = RD::DATA_FORMAT_A8B8G8R8_UNORM_PACK32;
sdfgi->occlusion_texture = RD::get_singleton()->texture_create_shared(tv, sdfgi->occlusion_data);
}
diff --git a/servers/rendering/rasterizer_rd/shaders/particles.glsl b/servers/rendering/rasterizer_rd/shaders/particles.glsl
index a924509771..2cadb387a1 100644
--- a/servers/rendering/rasterizer_rd/shaders/particles.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/particles.glsl
@@ -80,7 +80,7 @@ struct ParticleEmission {
vec4 custom;
};
-layout(set = 1, binding = 2, std430) restrict volatile coherent buffer SourceEmission {
+layout(set = 1, binding = 2, std430) restrict buffer SourceEmission {
int particle_count;
uint pad0;
uint pad1;
diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
index e11f3983c5..42f89b0f55 100644
--- a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
@@ -2580,7 +2580,7 @@ FRAGMENT_SHADER_CODE
}
}
- imageAtomicOr(geom_facing_grid, grid_pos, facing_bits); //store facing bits
+ imageStore(geom_facing_grid, grid_pos, imageLoad(geom_facing_grid, grid_pos) | facing_bits); //store facing bits
if (length(emission) > 0.001) {
float lumas[6]; |
Applying this patch doesn't fix the crash, but it seems like there are a lot less errors with it. |
Not sure if related, but I got this error when running Godot. Please note that I'm still able to open Godot. Also, it very likely could be a setup issue 🙃
|
@megalobyte Able to repro as well on mac. It seems to originate from the volumetric_fog.glsl shader (commit 1b2cd9f), specifically failing on the imageAtomicAdd and friends. I'm no expert, but wondering if the molten rewrite is causing an issue in that it doesn't support a vec3 for pos? Seems valid glsl otherwise... |
@N0hbdy See #53353 (comment). |
Godot version:
master
branch.Bisected the issue down to this commit: d0bddf5
OS/device including version:
iOS device with Vulkan renderer
Issue description:
Important note: crashes only on debug mode with
Metal API Validation
enabled. DisablingMetal API Validation
in schema allows to run application and doesn't result in a crash.Crash on application startup after specific shader compiles:
Crash log:
Steps to reproduce:
master
The text was updated successfully, but these errors were encountered: