-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Fix crash GPU particles on ios #89072
Conversation
Thank you very much for investigating this and confirming that this change was all thats needed to get particles working on iOS. The same code is in #88816 which is a very similar PR with the goal of getting particles working on Adreno 3XX devices (old Android devices basically). So it seems the two of you struck upon the same issue! #88816 Is still a work in progress, so it may be worthwhile to merge your PR first to get the fix in ASAP. But if #88816 is almost finished, I think it makes sense just to merge #88816 and close this PR. |
Ok, i got it. Thank you |
@Arthas92t For GPUParticles3D, Is your code fixing a crash, or is it fixing the particles not appearing? If it's fixing a crash, then I have no idea what is going on, but if it is fixing the particles just not appearing, then I have some theories we can discuss further if you want |
@clayjohn this commit only fix crash issue. |
I agree that there is probably a better fix. I wonder if what is happening is that velocity flags isn't getting cleared correctly, so Could you try testing with a custom Particles Process material where you replace the following lines with something constant?
with
This should result in a particle that slowly moves up. My theory is that If my code replacement works above, then we need to investigate why godot/drivers/gles3/shaders/particles.glsl Lines 207 to 222 in 7d2ca2d
|
Sorry, maybe my code make you confuse. xform[3].xyz += out_velocity_flags.xyz *0.0001; //or some thing but i choose a small out_velocity_flags value but there is an exception in case velocity == 0.0 too so i need to add another code to check that case. |
@clayjohn, i just make a test with particles_process_material.cpp and change godot/scene/resources/particle_process_material.cpp Lines 604 to 610 in 7d2ca2d
to : code += "vec3 calculate_initial_position(inout uint alt_seed) {\n";
code += " float pi = 3.14159;\n";
code += " float degree_to_rad = pi / 180.0;\n";
code += " vec3 pos = vec3(0.0, 0.001, 0.0);\n";
if (emission_shape == EMISSION_SHAPE_POINT) {
code += " pos = vec3(0.0, 0.001, 0.0);\n";
} then it work. But i dont like to change that file cause old particles shader saved file won't have update permanently. And i still dont understand why xform[3] == vec3(0.) cause this issues |
This will fix crash engine when use GPU particles on ios, tested on 4.0.x, 4.1.x, 4.2.x (issue #72469). With this fix both 3D and 2D GPU particles won't crash on ios but only 2D particles work (on 4.1.2 and 4.2.1 require this #88745 which merged to master branch or it won't show anything).

For 3D GPU particles on ios don't show anything, seem like there is another bug when core run into restart state of particles.glsl and code won't run if xform[3].xyz and out_velocity_flags.xyz == vec3(0.0). So if you add a simple code to prevent it become zero then 3D GPU particles will work on ios
but I don't fully understand all those shader code in particles.glsl so may need someone else who fully understand it to make a better fix