Skip to content

Comments

Implement Disabling of Pipelines#1959

Open
60k41p wants to merge 1 commit intoSanderMertens:masterfrom
VerdantInteractive:pipeline-disabling-cherry-picked
Open

Implement Disabling of Pipelines#1959
60k41p wants to merge 1 commit intoSanderMertens:masterfrom
VerdantInteractive:pipeline-disabling-cherry-picked

Conversation

@60k41p
Copy link

@60k41p 60k41p commented Feb 21, 2026

Changes

  • Early return in ecs_run_pipeline when a pipeline is disabled.
  • Simplifiy ecs_progress() by delegating thread management and pipeline execution to ecs_run_pipeline().
  • Add tests to verify that the systems in disabled default or custom pipelines don't execute

Reproducer

#include <iostream>
#include <flecs.h>

int main() {
    // Create a Flecs world
    flecs::world world;

    // Create a simple system that prints whenever it runs
    world.system<>()
        .run([](flecs::iter &it) {
            std::cout << "[system] executed" << std::endl;
        });

    // Get pipeline entity and print its initial state
    flecs::entity pipeline = world.get_pipeline();
    std::cout << "pipeline id: " << pipeline.id() << ", valid: " << pipeline.is_valid()
              << ", enabled: " << pipeline.enabled() << std::endl;

    // First progress call: system should run
    std::cout << "--- First progress() ---" << std::endl;
    world.progress();

    // Disable the pipeline entity
    std::cout << "Disabling pipeline (pipeline.disable())" << std::endl;
    pipeline.disable();

    std::cout << "pipeline enabled after disable(): " << pipeline.enabled() << std::endl;

    // Subsequent progress calls: check whether system still runs
    std::cout << "--- Second progress() ---" << std::endl;
    world.progress();

    std::cout << "--- Third progress() ---" << std::endl;
    world.progress();

    std::cout << "Done." << std::endl;
    return 0;
}

Before

pipeline id: 400, valid: 1, enabled: 1
--- First progress() ---
[system] executed
Disabling pipeline (pipeline.disable())
pipeline enabled after disable(): 0
--- Second progress() ---
[system] executed
--- Third progress() ---
[system] executed
Done.

After

pipeline id: 400, valid: 1, enabled: 1
--- First progress() ---
[system] executed
Disabling pipeline (pipeline.disable())
pipeline enabled after disable(): 0
--- Second progress() ---
--- Third progress() ---
Done.

* Early return in ecs_run_pipeline when a pipeline is disabled. Simplifiy ecs_progress() by delegating thread management and pipeline execution to ecs_run_pipeline().

* Remove the error label that's no longer used after the refactoring

* Add tests

* Update the amalgamated flecs.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant