confused with auto sync points #1883
-
|
Hello there great library! #include <cstdio>
#include <flecs.h>
struct SceneA {};
struct SceneB {};
struct SceneC {};
flecs::entity sa, sb, sc;
void system_a(flecs::iter &it, size_t row) {
auto world = it.world();
printf("world:%p, System A run\n", &world);
sa.mut(it).destruct();
sb = world.entity("B").add<SceneB>();
}
void system_b(flecs::iter &it, size_t row) {
auto world = it.world();
printf("world:%p, System B run\n", &world);
sb.mut(it).destruct();
sc = world.entity("C").add<SceneC>();
}
void system_c(flecs::iter &it, size_t row) {
auto world = it.world();
printf("world:%p, System C run\n", &world);
sc.mut(it).destruct();
sa= it.world().entity("A").add<SceneA>();
}
int main() {
flecs::world world;
sa = world.entity("A").add<SceneA>();
world.set_target_fps(0.5);
// the following will call A,B,C system on first world.progress (automatically add sync points)
// and then on the 2nd world.progress it will only call A system
// and then on the 3rd world.progress it will only call B system
// and then on the 4th world.progress it will only call C system
world.system().with<SceneA>().each(system_a);
world.system().with<SceneB>().each(system_b);
world.system().with<SceneC>().each(system_c);
while(true) {
world.progress();
printf("--->\n");
}
return 0;
}the question.. if i modify it to world.system().write<SceneA>().each(system_a);
world.system().write<SceneB>().each(system_b);
world.system().write<SceneC>().each(system_c);now it prints A, B, C on each world.progress thank you very much in advance |
Beta Was this translation helpful? Give feedback.
Answered by
SanderMertens
Dec 1, 2025
Replies: 1 comment
-
|
Sync points are only inserted when:
To see which sync points got inserted, do: flecs::log::set_level(1); // will print pipeline changes, "merge" is a sync pointor connect your application to the explorer by doing this in the code: world.set(flecs::Rest{});and then going to https://www.flecs.dev/explorer |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
yohanip
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sync points are only inserted when:
To see which sync points got inserted, do:
or connect your application to the explorer by doing this in the code:
world.set(flecs::Rest{});and then going to https://www.flecs.dev/explorer