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

OpenGL: Fix uninitialized memory usage for GPUParticles interp_to_end #84189

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/classes/GPUParticles2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</member>
<member name="interp_to_end" type="float" setter="set_interp_to_end" getter="get_interp_to_end" default="0.0">
Causes all the particles in this node to interpolate towards the end of their lifetime.
[b]Note[/b]: This only works when used with a [ParticleProcessMaterial]. It needs to be manually implemented for custom process shaders.
[b]Note:[/b] This only works when used with a [ParticleProcessMaterial]. It needs to be manually implemented for custom process shaders.
</member>
<member name="interpolate" type="bool" setter="set_interpolate" getter="get_interpolate" default="true">
Enables particle interpolation, which makes the particle movement smoother when their [member fixed_fps] is lower than the screen refresh rate.
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/GPUParticles3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
</member>
<member name="interp_to_end" type="float" setter="set_interp_to_end" getter="get_interp_to_end" default="0.0">
Causes all the particles in this node to interpolate towards the end of their lifetime.
[b]Note[/b]: This only works when used with a [ParticleProcessMaterial]. It needs to be manually implemented for custom process shaders.
[b]Note:[/b] This only works when used with a [ParticleProcessMaterial]. It needs to be manually implemented for custom process shaders.
</member>
<member name="interpolate" type="bool" setter="set_interpolate" getter="get_interpolate" default="true">
Enables particle interpolation, which makes the particle movement smoother when their [member fixed_fps] is lower than the screen refresh rate.
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/storage/particles_storage.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving a comment in there that ParticlesFrameParams doesn't initialize any scalar members at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParticlesFramesParams initializes everything when it is used

ParticlesFrameParams frame_params;
Since every property is always set, it would be wasteful to default initialize as well

Copy link
Member Author

@akien-mga akien-mga Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we forget to set one new member added to the struct ;)

But I guess in that case we might prefer a bug than a safe default value that hides not properly respecting the configuration.

Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class ParticlesStorage : public RendererParticlesStorage {

Transform3D emission_transform;
Vector3 emitter_velocity;
float interp_to_end;
float interp_to_end = 0.0;

HashSet<RID> collisions;

Expand Down
Loading