Open SirTodd opened 1 year ago
Without any information about the nature of the project that is crashing I'm not sure anything can be done, unless there's some hardware specific error that can be pinned down
I will try to gather more information. All I know for now is that it happens when the game runs get_tree().reload_current_scene()
Possibly related to:
Actually, it is not related to reload_current_scene(), the crashes were happening as soon as any GPUParticles2D played. Weirdly enough, it was working before a game update, and this update did not change the engine version nor did make changes to the particles, so I don't know what is going on there. Maybe some shader cache issue?
Actually, it is not related to reload_current_scene(), the crashes were happening as soon as any GPUParticles2D played. Weirdly enough, it was working before a game update, and this update did not change the engine version nor did make changes to the particles, so I don't know what is going on there. Maybe some shader cache issue?
Likely not a shader cache issue if you can reproduce in 4.0.3. Shader caching was implemented in 4.1.
The stack trace doesn't appear to be anything related to rendering, but its impossible to say with the limited amount of information.
What changes did you make in the update that introduced the crash?
Actually, it is not related to reload_current_scene(), the crashes were happening as soon as any GPUParticles2D played. Weirdly enough, it was working before a game update, and this update did not change the engine version nor did make changes to the particles, so I don't know what is going on there. Maybe some shader cache issue?
Likely not a shader cache issue if you can reproduce in 4.0.3. Shader caching was implemented in 4.1.
The stack trace doesn't appear to be anything related to rendering, but its impossible to say with the limited amount of information.
What changes did you make in the update that introduced the crash?
There were many new content in this update, but all done in gdscript and no plugins updates, I don't see how that could affect just specific phones. At this point I don't even know what is the cause, it seems completely random, although it is always after reloading the scene. I can't even debug it myself, since I don't have any of these phones, so I have to rely on user reports and stack trace.
Here is another crash from one of my users
Actually, it is not related to reload_current_scene(), the crashes were happening as soon as any GPUParticles2D played. Weirdly enough, it was working before a game update, and this update did not change the engine version nor did make changes to the particles, so I don't know what is going on there. Maybe some shader cache issue?
Likely not a shader cache issue if you can reproduce in 4.0.3. Shader caching was implemented in 4.1.
The stack trace doesn't appear to be anything related to rendering, but its impossible to say with the limited amount of information.
What changes did you make in the update that introduced the crash?
After making some reworks to the game code and avoiding reload_current_scene(), all the issues were gone. However, I added a new scene to the game that is only instantiated when clicking on a button. Inside this scene it contains a GpuParticles2D. It also uses an animation material. The same users started reporting crashes when opening this same scene, but only after the second time opening it. There is nothing in this scene that could be causing crashes, and since it only crashes the second time opening it, I suspect it is related to shader caching.
This crash only affects older phones, and just some of them, so most likely bad opengl implementation by manufacturers. But there should be a workaround for this. I am using cpu particles everywhere in the project now, but cpu particles don't support ring emission shape, which is exactly why I used gpu particles.
I am using cpu particles everywhere in the project now, but cpu particles don't support ring emission shape, which is exactly why I used gpu particles.
According to https://github.com/godotengine/godot/pull/50370, ring emission shape is supported in CPUParticles3D.
I have the same problem and it happens only for particles using a texture. If I remove my texture (a 64x64 png) my game stop crashing.
Here is the content added to my scene from the git diff that introduces the crash:
[ext_resource type="Texture2D" uid="uid://dw2pg51ck2t17" path="res://sprites/particles/leaf.png" id="10_a34ho"]
[node name="Leaves" type="GPUParticles2D" parent="."]
position = Vector2(119, 325)
amount = 4
process_material = SubResource("ParticleProcessMaterial_dospk")
texture = ExtResource("10_a34ho")
lifetime = 5.0
trail_lifetime = 0.4
trail_sections = 4
[sub_resource type="Gradient" id="Gradient_tlwpa"]
offsets = PackedFloat32Array(0.0114943, 0.273381, 0.71223, 1)
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_k68vj"]
gradient = SubResource("Gradient_tlwpa")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_dospk"]
lifetime_randomness = 0.5
emission_shape = 3
emission_box_extents = Vector3(300, 150, 1)
particle_flag_disable_z = true
gravity = Vector3(50, 10, 0)
initial_velocity_min = 20.0
initial_velocity_max = 50.0
angular_velocity_min = 500.0
angular_velocity_max = 500.0
orbit_velocity_min = -0.03
orbit_velocity_max = 0.03
linear_accel_min = 10.0
linear_accel_max = 500.0
scale_min = 0.3
scale_max = 0.8
color = Color(0.85098, 0.521569, 0.607843, 1)
color_ramp = SubResource("GradientTexture1D_k68vj")
turbulence_enabled = true
turbulence_noise_speed_random = 0.5
I am having a similar issue the build is crashing on some low end android devices, and I can confirm that it is due to a shader. I have a shader to slightly tilt a card, once I take out a build without this shader the crash is gone. I am very new at shader programming so I am not sure if there is something wrong with my shader.
Here is my shader code:
shader_type canvas_item;
uniform float fov : hint_range(0, 359) = 90;
uniform bool cull_back = true;
uniform float y_rot : hint_range(-360, 360) = 0.0;
uniform float x_rot : hint_range(-360, 360) = 0.0;
uniform float inset : hint_range(-100, 100) = 0.0;
uniform vec4 tint_color : source_color;
varying flat vec2 o;
varying vec3 p;
void vertex() {
float sin_b = sin(y_rot / 180.0 * PI);
float cos_b = cos(y_rot / 180.0 * PI);
float sin_c = sin(x_rot / 180.0 * PI);
float cos_c = cos(x_rot / 180.0 * PI);
mat3 inv_rot_mat;
inv_rot_mat[0][0] = cos_b;
inv_rot_mat[0][1] = 0.0;
inv_rot_mat[0][2] = -sin_b;
inv_rot_mat[1][0] = sin_b * sin_c;
inv_rot_mat[1][1] = cos_c;
inv_rot_mat[1][2] = cos_b * sin_c;
inv_rot_mat[2][0] = sin_b * cos_c;
inv_rot_mat[2][1] = -sin_c;
inv_rot_mat[2][2] = cos_b * cos_c;
float t = tan(fov / 360.0 * PI);
p = inv_rot_mat * vec3((UV - 0.5), 0.5 / t);
float v = (0.5 / t) + 0.5;
p.xy *= v * inv_rot_mat[2].z;
o = v * inv_rot_mat[2].xy;
VERTEX += (UV - 0.5) / TEXTURE_PIXEL_SIZE * t * (1.0 - inset);
}
void fragment() {
if (cull_back && p.z <= 0.0) discard;
vec2 uv = (p.xy / p.z).xy - o;
vec4 texture_color = texture(TEXTURE, uv + 0.5);
// Apply tint color
texture_color *= tint_color;
// Apply alpha mask
texture_color.a *= step(max(abs(uv.x), abs(uv.y)), 0.5);
COLOR = texture_color;
}
@Ayush-Agarwal123 This is an unrelated issue, as this issue is about particles. That said, you may want to check that your shader will never perform a division by zero, which may crash graphics drivers on certain devices.
This issue may be fixed by https://github.com/godotengine/godot/pull/88816
We just encountered the same issue. I can say the issue did not get fixed by #88816 We are on 4.3 and have it. Will try to switch renderers and see if it has an impact.
Godot version
4.1.1 stable
System information
Android, GLES3
Issue description
I have been getting constant reports of crashes coming from very specific devices. All devices are low-end, having a Mediatek MT6769/MT6833V or some other variations of chipsets, as well as a few Samsung Exynos 850. They also have between 2GB-4GB ram. I have thousands of players, and all the reports come from these specific devices, even clearing the app data and uninstalling does not solve it.
All stack trace look very similar
This issue persist with 4.0.3 as well.
Steps to reproduce
Cannot provide.
Minimal reproduction project
Cannot provide.