Closed shiki-saiki closed 3 months ago
Prepare systems are expected to be called every frame. Creating bind groups is not particularly expensive and in bevy itself a lot of bind groups can change dynamically so it's easier to just always recreate them. Also, if a bind group is on an entity instead of a resource, since the render world recreates all entities every frame we need to recreate the bind groups every frame or store them somewhere else.
The code in examples is only the minimal code required to make something work. You could add code to control whether or not you want to create a bind group, that's completely up to you.
Thank you for the explanation!
Bevy version
main branch (d659a1f)
What you did
In compute_shader_game_of_life example, I added
println!("prepare_bind_group");
inprepare_bind_group
function.What went wrong
It was printed every frame.
I think we only need to create bind groups once before any frames begin.
Is it correct that systems in
RenderSet::PrepareBindGroups
are called every frame?I'm relatively new to Bevy, so I apologize if there are any mistakes.