Skip to content
Open
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 crates/bevy_dev_tools/src/infinite_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ fn queue_infinite_grids(
if !plane_check(transform, view.world_from_view.translation()) {
continue;
}
phase.add(Transparent3d {
phase.add_retained(Transparent3d {
pipeline: pipeline_id,
entity: (*render_entity, *main_entity),
draw_function: draw_function_id,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ pub fn queue_material_meshes(
else {
continue;
};
transmissive_phase.add(Transmissive3d {
transmissive_phase.add_retained(Transmissive3d {
sorting_info: TransparentSortingInfo3d::Sorted {
mesh_center: get_mesh_instance_world_from_local(
*visible_entity,
Expand Down Expand Up @@ -1389,7 +1389,7 @@ pub fn queue_material_meshes(
else {
continue;
};
transparent_phase.add(Transparent3d {
transparent_phase.add_retained(Transparent3d {
sorting_info: TransparentSortingInfo3d::Sorted {
mesh_center: get_mesh_instance_world_from_local(
*visible_entity,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_phase/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ where
{
/// Adds a [`PhaseItem`] to this render phase.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps add a comment here to explain what "retained" means, vs. add_transient?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For this data structure specifically it doesn't mean much except that the item is not automatically removed. I don't know enough about the change list machinery to give a succinct explanation here, and in principle you could use it in other ways as well.

I guess I could add a "Unlike add_transient, the item is not removed by the end of the frame and needs to be updated by an external system"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess I could add a "Unlike add_transient, the item is not removed by the end of the frame and needs to be updated by an external system"?

Right, though I just meant the bare minimum to explain what "retained" means :). Wording it positively, it could be Adds a [PhaseItem] to this render phase, which will persist between frames until removed.

Then the add_transient doc -- which I see is a bit odd to read, could also be reworded to Adds a [PhaseItem] to this render phase, which will be removed automatically after this frame.

#[inline]
pub fn add(&mut self, item: I) {
pub fn add_retained(&mut self, item: I) {
self.items.insert((item.entity(), item.main_entity()), item);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_sprite_render/src/mesh2d/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ pub fn queue_material2d_meshes<M: Material2d>(
// entity field here entirely, but we currently can't do so
// because UI creates multiple render entities for each main
// entity in its sorted phases.
transparent_phase.add(Transparent2d {
transparent_phase.add_retained(Transparent2d {
entity: (Entity::PLACEHOLDER, *visible_entity),
draw_function: material_2d.properties.draw_function_id,
pipeline: pipeline_id,
Expand Down
2 changes: 1 addition & 1 deletion examples/2d/mesh2d_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pub fn queue_colored_mesh2d(
pipelines.specialize(&pipeline_cache, &colored_mesh2d_pipeline, mesh2d_key);

let mesh_z = mesh2d_transforms.world_from_local.translation.z;
transparent_phase.add(Transparent2d {
transparent_phase.add_retained(Transparent2d {
entity: (*render_entity, *visible_entity),
draw_function: draw_colored_mesh2d,
pipeline: pipeline_id,
Expand Down
2 changes: 1 addition & 1 deletion examples/shader_advanced/custom_render_phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ fn queue_custom_meshes(
};
// At this point we have all the data we need to create a phase item and add it to our
// phase
custom_phase.add(Stencil3d {
custom_phase.add_retained(Stencil3d {
sorting_info: TransparentSortingInfo3d::Sorted {
mesh_center: pbr::get_mesh_instance_world_from_local(
*visible_entity,
Expand Down
2 changes: 1 addition & 1 deletion examples/shader_advanced/custom_shader_instancing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fn queue_custom(
let pipeline = pipelines
.specialize(&pipeline_cache, &custom_pipeline, key, &mesh.layout)
.unwrap();
transparent_phase.add(Transparent3d {
transparent_phase.add_retained(Transparent3d {
sorting_info: TransparentSortingInfo3d::Sorted {
mesh_center: pbr::get_mesh_instance_world_from_local(
*main_entity,
Expand Down
Loading