diff --git a/.bazelversion b/.bazelversion index 1502020..815da58 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.3.0 +7.4.1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a99624f..261ee61 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: greut/eclint-action@v0 - uses: jidicula/clang-format-action@v4.11.0 - with: { clang-format-version: "18" } + with: { clang-format-version: "19" } test-windows: if: >- diff --git a/BUILD.bazel b/BUILD.bazel index f59fa55..2cee87e 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,6 +4,8 @@ load("//bazel:copts.bzl", "copts") package(default_visibility = ["//visibility:public"]) +raw_url = "https://raw.githubusercontent.com" + filegroup( name = "headers", srcs = glob(["ecsact/**/*.hh"]), @@ -49,106 +51,106 @@ ecsact_build_recipe( }, fetch_srcs = { "include/entt": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entt.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entt.hpp", ], "include/entt/graph": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/graph/adjacency_matrix.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/graph/flow.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/graph/dot.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/graph/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/graph/adjacency_matrix.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/graph/flow.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/graph/dot.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/graph/fwd.hpp", ], "include/entt/locator": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/locator/locator.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/locator/locator.hpp", ], "include/entt/poly": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/poly/fwd.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/poly/poly.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/poly/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/poly/poly.hpp", ], "include/entt/process": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/process/fwd.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/process/process.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/process/scheduler.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/process/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/process/process.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/process/scheduler.hpp", ], "include/entt/resource": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/resource/cache.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/resource/fwd.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/resource/loader.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/resource/resource.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/resource/cache.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/resource/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/resource/loader.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/resource/resource.hpp", ], "include/entt/entity": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/registry.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/storage.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/entity.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/group.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/fwd.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/sparse_set.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/component.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/mixin.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/view.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/handle.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/helper.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/observer.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/organizer.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/runtime_view.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/entity/snapshot.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/registry.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/storage.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/entity.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/group.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/sparse_set.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/component.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/mixin.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/view.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/handle.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/helper.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/observer.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/organizer.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/runtime_view.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/entity/snapshot.hpp", ], "include/entt/meta": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/adl_pointer.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/container.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/context.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/factory.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/fwd.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/meta.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/node.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/pointer.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/policy.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/range.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/resolve.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/template.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/type_traits.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/meta/utility.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/adl_pointer.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/container.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/context.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/factory.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/meta.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/node.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/pointer.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/policy.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/range.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/resolve.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/template.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/type_traits.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/meta/utility.hpp", ], "include/entt/platform": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/platform/android-ndk-r17.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/platform/android-ndk-r17.hpp", ], "include/entt/signal": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/signal/sigh.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/signal/delegate.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/signal/dispatcher.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/signal/emitter.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/signal/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/signal/sigh.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/signal/delegate.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/signal/dispatcher.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/signal/emitter.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/signal/fwd.hpp", ], "include/entt/config": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/config/version.h", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/config/macro.h", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/config/config.h", + raw_url + "/skypjack/entt/v3.12.2/src/entt/config/version.h", + raw_url + "/skypjack/entt/v3.12.2/src/entt/config/macro.h", + raw_url + "/skypjack/entt/v3.12.2/src/entt/config/config.h", ], "include/entt/container": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/container/dense_map.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/container/fwd.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/container/dense_set.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/container/dense_map.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/container/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/container/dense_set.hpp", ], "include/entt/core": [ - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/compressed_pair.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/type_traits.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/fwd.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/iterator.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/memory.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/algorithm.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/utility.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/any.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/type_info.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/attribute.h", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/hashed_string.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/enum.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/family.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/ident.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/monostate.hpp", - "https://raw.githubusercontent.com/skypjack/entt/v3.12.2/src/entt/core/tuple.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/compressed_pair.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/type_traits.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/fwd.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/iterator.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/memory.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/algorithm.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/utility.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/any.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/type_info.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/attribute.h", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/hashed_string.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/enum.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/family.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/ident.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/monostate.hpp", + raw_url + "/skypjack/entt/v3.12.2/src/entt/core/tuple.hpp", ], "include": [ - "https://raw.githubusercontent.com/Cyan4973/xxHash/v0.8.2/xxhash.h", - "https://raw.githubusercontent.com/Cyan4973/xxHash/v0.8.2/xxhash.c", + raw_url + "/Cyan4973/xxHash/v0.8.2/xxhash.h", + raw_url + "/Cyan4973/xxHash/v0.8.2/xxhash.c", ], }, exports = [ diff --git a/MODULE.bazel b/MODULE.bazel index 79c3419..8a01f87 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,7 +4,7 @@ module( compatibility_level = 3, ) -bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_cc", version = "0.0.17") bazel_dep(name = "bazel_skylib", version = "1.6.1") bazel_dep(name = "rules_ecsact", version = "0.5.8") bazel_dep(name = "ecsact_runtime", version = "0.7.0") @@ -17,6 +17,7 @@ bazel_dep(name = "xxhash", version = "0.8.2") bazel_dep(name = "googletest", version = "1.14.0.bcr.1") bazel_dep(name = "boost.dll", version = "1.83.0.bzl.2") bazel_dep(name = "boost.process", version = "1.83.0.bzl.2") +bazel_dep(name = "tracy", version = "0.11.1") bazel_dep(name = "toolchains_llvm", version = "1.0.0", dev_dependency = True) bazel_dep(name = "hedron_compile_commands", dev_dependency = True) @@ -33,6 +34,12 @@ git_override( remote = "https://github.com/zaucy/libarchive.git", ) +git_override( + module_name = "tracy", + commit = "b75f30a3823bc290b4d2359234d10ff69855d046", + remote = "https://github.com/seaube/tracy.git", +) + ecsact = use_extension("@rules_ecsact//ecsact:extensions.bzl", "ecsact", dev_dependency = True) ecsact.toolchain(use_ecsact_cli = True) use_repo(ecsact, "ecsact_toolchain") diff --git a/ecsact/entt/wrapper/core.hh b/ecsact/entt/wrapper/core.hh index 3879dc1..d9805b1 100644 --- a/ecsact/entt/wrapper/core.hh +++ b/ecsact/entt/wrapper/core.hh @@ -12,6 +12,10 @@ #include "ecsact/entt/detail/execution_events_collector.hh" #include "ecsact/entt/detail/globals.hh" +#ifdef TRACY_ENABLE +# include "tracy/Tracy.hpp" +#endif + namespace ecsact::entt::wrapper::core { template @@ -21,6 +25,9 @@ inline auto has_component( // [[maybe_unused]] ecsact_component_id component_id, const void* indexed_fields ) -> bool { +#ifdef TRACY_ENABLE + ZoneScopedN("core has_component"); +#endif static_assert( !C::has_assoc_fields, "Ecsact RT EnTT doesn't support indexed fields (yet)" @@ -39,6 +46,9 @@ inline auto get_component( [[maybe_unused]] ecsact_component_id component_id, const void* indexed_fields ) -> const void* { +#ifdef TRACY_ENABLE + ZoneScopedN("core get_component"); +#endif static_assert( !C::has_assoc_fields, "Ecsact RT EnTT doesn't support indexed fields (yet)" @@ -63,6 +73,9 @@ inline auto add_component( // [[maybe_unused]] ecsact_component_id component_id, const void* component_data ) -> ecsact_add_error { +#ifdef TRACY_ENABLE + ZoneScopedN("core add_component"); +#endif auto& reg = ecsact::entt::get_registry(registry_id); auto entity = ecsact::entt::entity_id{entity_id}; assert(C::id == component_id); @@ -99,6 +112,9 @@ inline auto add_component_exec_options( // [[maybe_unused]] ecsact_component_id component_id, const void* component_data ) -> ecsact_add_error { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif auto& reg = ecsact::entt::get_registry(registry_id); auto entity = ecsact::entt::entity_id{entity_id}; assert(C::id == component_id); @@ -137,6 +153,9 @@ inline auto update_component( // const void* component_data, const void* indexed_fields ) -> ecsact_update_error { +#ifdef TRACY_ENABLE + ZoneScopedN("core update_component"); +#endif using ecsact::entt::detail::exec_beforechange_storage; static_assert( @@ -175,6 +194,9 @@ inline auto update_component_exec_options( // const void* component_data, const void* indexed_fields ) -> ecsact_update_error { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif using ecsact::entt::detail::exec_beforechange_storage; static_assert( @@ -217,6 +239,9 @@ auto remove_component( [[maybe_unused]] ecsact_component_id component_id, const void* indexed_fields ) -> void { +#ifdef TRACY_ENABLE + ZoneScopedN("core remove_component"); +#endif static_assert( !C::has_assoc_fields, "Ecsact RT EnTT doesn't support indexed fields (yet)" @@ -242,6 +267,9 @@ auto remove_component_exec_options( [[maybe_unused]] ecsact_component_id component_id, const void* indexed_fields ) -> void { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif using ecsact::entt::detail::pending_remove; static_assert( @@ -275,6 +303,9 @@ inline auto _trigger_create_entity_events( ecsact_registry_id registry_id, ecsact::entt::detail::execution_events_collector& events_collector ) -> void { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif using ecsact::entt::detail::created_entity; auto& reg = ecsact::entt::get_registry(registry_id); @@ -299,6 +330,9 @@ inline auto _trigger_destroy_entity_events( ecsact_registry_id registry_id, ecsact::entt::detail::execution_events_collector& events_collector ) -> void { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif using ecsact::entt::detail::destroyed_entity; auto& reg = ecsact::entt::get_registry(registry_id); @@ -321,6 +355,9 @@ auto _trigger_init_component_event( ecsact_registry_id registry_id, ecsact::entt::detail::execution_events_collector& events_collector ) -> void { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif auto& reg = ecsact::entt::get_registry(registry_id); if(!events_collector.has_init_callback()) { @@ -353,6 +390,9 @@ auto _trigger_update_component_event( ecsact_registry_id registry_id, ecsact::entt::detail::execution_events_collector& events_collector ) -> void { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif using ecsact::entt::detail::beforeremove_storage; using ecsact::entt::detail::exec_beforechange_storage; @@ -386,6 +426,9 @@ auto _trigger_remove_component_event( ecsact_registry_id registry_id, ecsact::entt::detail::execution_events_collector& events_collector ) -> void { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif auto& reg = ecsact::entt::get_registry(registry_id); if(!events_collector.has_remove_callback()) { @@ -429,6 +472,9 @@ inline auto check_action_error( ecsact_registry_id registry_id, const void* action_data ) -> ecsact_execute_systems_error { +#ifdef TRACY_ENABLE + ZoneScoped; +#endif auto& reg = ecsact::entt::get_registry(registry_id); auto action = *static_cast(action_data); @@ -439,6 +485,9 @@ inline auto check_action_error( template inline auto clear_component(ecsact_registry_id registry_id) -> void { +#ifdef TRACY_ENABLE + ZoneScopedN("core clear_component"); +#endif auto& reg = ecsact::entt::get_registry(registry_id); reg.clear>(); @@ -447,6 +496,9 @@ inline auto clear_component(ecsact_registry_id registry_id) -> void { template inline auto clear_notify_component(ecsact_registry_id registry_id) -> void { +#ifdef TRACY_ENABLE + ZoneScopedN("core clear_notify_component"); +#endif auto& reg = ecsact::entt::get_registry(registry_id); reg.clear>(); @@ -481,6 +533,9 @@ inline auto prepare_system(::entt::registry& registry) -> void { template auto has_component_changed(entt::entity_id entity, V& view) -> bool { +#ifdef TRACY_ENABLE + ZoneScopedN("core has_component_changed"); +#endif using detail::exec_itr_beforechange_storage; const auto& current_comp = view.template get(entity); @@ -498,6 +553,9 @@ auto update_exec_itr_beforechange( entt::entity_id entity, ecsact::entt::registry_t& reg ) -> void { +#ifdef TRACY_ENABLE + ZoneScopedN("core update_beforechange_value"); +#endif auto comp = reg.get(entity); auto& beforechange_comp = reg.get>(entity); @@ -513,6 +571,9 @@ auto ecsact_stream( const void* component_data, const void* indexed_fields ) -> ecsact_stream_error { +#ifdef TRACY_ENABLE + ZoneScopedN("core ecsact_stream"); +#endif static_assert( !C::has_assoc_fields, "Ecsact RT EnTT doesn't support indexed fields (yet)" diff --git a/ecsact/entt/wrapper/dynamic.hh b/ecsact/entt/wrapper/dynamic.hh index 6d77b34..2242190 100644 --- a/ecsact/entt/wrapper/dynamic.hh +++ b/ecsact/entt/wrapper/dynamic.hh @@ -10,6 +10,10 @@ #include "ecsact/entt/event_markers.hh" #include "ecsact/entt/detail/system_execution_context.hh" +#ifdef TRACY_ENABLE +# include "tracy/Tracy.hpp" +#endif + namespace ecsact::entt::wrapper::dynamic { template @@ -18,6 +22,9 @@ auto context_add( [[maybe_unused]] ecsact_component_like_id component_id, const void* component_data ) -> void { +#ifdef TRACY_ENABLE + ZoneScopedC(tracy::Color::Teal); +#endif using ecsact::entt::component_added; using ecsact::entt::component_removed; using ecsact::entt::detail::beforeremove_storage; @@ -51,6 +58,9 @@ auto component_add_trivial( ecsact::entt::registry_t& registry, ecsact::entt::entity_id entity_id ) -> void { +#ifdef TRACY_ENABLE + ZoneScopedC(tracy::Color::Teal); +#endif using ecsact::entt::component_added; using ecsact::entt::component_removed; using ecsact::entt::detail::pending_add; @@ -73,6 +83,9 @@ auto context_remove( const void* indexed_field_values, auto& view ) -> void { +#ifdef TRACY_ENABLE + ZoneScopedC(tracy::Color::Orange); +#endif assert(ecsact_id_cast(C::id) == component_id); using ecsact::entt::component_removed; @@ -103,6 +116,9 @@ auto component_remove_trivial( ecsact::entt::entity_id entity_id, auto& view ) -> void { +#ifdef TRACY_ENABLE + ZoneScopedC(tracy::Color::Orange); +#endif using ecsact::entt::component_removed; using ecsact::entt::detail::beforeremove_storage; using ecsact::entt::detail::pending_remove; diff --git a/rt_entt_codegen/core/BUILD.bazel b/rt_entt_codegen/core/BUILD.bazel index c9ff17c..e501177 100644 --- a/rt_entt_codegen/core/BUILD.bazel +++ b/rt_entt_codegen/core/BUILD.bazel @@ -35,6 +35,7 @@ _CORE_CODEGEN_METHODS = { "//rt_entt_codegen/core/system_provider", "@entt//:entt", "@ecsact_rt_entt//:lib", + "@tracy", ], "check_error": [], "execution_options": [], diff --git a/rt_entt_codegen/core/execute_systems.cc b/rt_entt_codegen/core/execute_systems.cc index b78e4b0..498d392 100644 --- a/rt_entt_codegen/core/execute_systems.cc +++ b/rt_entt_codegen/core/execute_systems.cc @@ -56,6 +56,12 @@ auto ecsact::rt_entt_codegen::core::print_execute_systems( // .parameter("const ecsact_execution_events_collector*", "evc") .return_type("ecsact_execute_systems_error"); + ctx.write( + "#ifdef TRACY_ENABLE\n", + "\tZoneScopedN(\"execute_all_systems\");\n", + "#endif\n" + ); + ctx.write(METHOD_BODY_TOP); ctx.write("\n"); diff --git a/rt_entt_codegen/core/print_sys_exec.cc b/rt_entt_codegen/core/print_sys_exec.cc index b00b66a..8bc6c23 100644 --- a/rt_entt_codegen/core/print_sys_exec.cc +++ b/rt_entt_codegen/core/print_sys_exec.cc @@ -347,8 +347,8 @@ static auto print_system_execution_context( return context_type_name; } -static auto setup_system_providers(system_like_id_variant sys_like_id -) -> system_provider_t { +static auto setup_system_providers(system_like_id_variant sys_like_id) + -> system_provider_t { using ecsact::rt_entt_codegen::core::provider::association; using ecsact::rt_entt_codegen::core::provider::basic; using ecsact::rt_entt_codegen::core::provider::lazy; @@ -553,6 +553,14 @@ static auto print_trivial_system_like( .parameter("const ecsact::entt::actions_map&", "actions_map") .return_type("void"); + ctx.write( + "#ifdef TRACY_ENABLE\n", + "ZoneScopedNC(\"execute_system trivial ", + system_name, + "\", tracy::Color::SpringGreen);\n", + "#endif\n" + ); + ecsact::rt_entt_codegen::util::make_view(ctx, "view", "registry", details); block(ctx, "for(auto entity : view)", [&] { @@ -620,6 +628,14 @@ static auto print_execute_system_template_specialization( ctx.write("\n"); } + ctx.write( + "#ifdef TRACY_ENABLE\n", + "\tZoneScopedNC(\"execute_system ", + system_name, + "\", tracy::Color::DarkGreen);\n", + "#endif\n" + ); + print_execute_systems( ctx, system_id, diff --git a/rt_entt_codegen/core/system_provider/system_ctx_functions.cc b/rt_entt_codegen/core/system_provider/system_ctx_functions.cc index 6c9b041..8715a25 100644 --- a/rt_entt_codegen/core/system_provider/system_ctx_functions.cc +++ b/rt_entt_codegen/core/system_provider/system_ctx_functions.cc @@ -16,6 +16,13 @@ auto ecsact::rt_entt_codegen::core::provider::context_action_impl( ) -> void { if(sys_like_id.is_action()) { auto action_name = cpp_identifier(decl_full_name(sys_like_id)); + ctx.write( + "\t#ifdef TRACY_ENABLE\n", + "ZoneScopedNC(\"context_action ", + action_name, + "\", tracy::Color::Blue);\n", + "#endif\n" + ); ctx.write( "*static_cast<", @@ -48,7 +55,9 @@ auto ecsact::rt_entt_codegen::core::provider::context_add_impl( if(adds_comps.empty()) { // TODO(Kelwan): Handle unexpected behaviour return; - } else if(adds_comps.size() == 1) { + } + + if(adds_comps.size() == 1) { const auto& comp_id = adds_comps.front(); auto type_name = cpp_identifier(decl_full_name(comp_id)); ctx.write( @@ -61,6 +70,7 @@ auto ecsact::rt_entt_codegen::core::provider::context_add_impl( ); return; } + block( ctx, "static const auto add_fns = " @@ -109,6 +119,7 @@ auto ecsact::rt_entt_codegen::core::provider::context_remove_impl( // TODO(Kelwan): Handle unexpected behaviour return; } + if(remove_comps.size() == 1) { const auto& comp_id = remove_comps.front(); @@ -175,22 +186,31 @@ auto ecsact::rt_entt_codegen::core::provider::context_get_impl( if(get_components.size() == 0) { return; } + auto system_name = decl_full_name(sys_like_id); + ctx.write( + "#ifdef TRACY_ENABLE\n" + "\tZoneScopedNC(\"context_get ", + system_name, + "\", tracy::Color::Purple);\n", + "#endif\n" + ); // Shortcut - ignore component ID because we only have 1 if(details.get_comps.size() == 1 && details.readable_comps.size() == 1) { auto comp_id = *details.get_comps.begin(); - auto cpp_comp_full_name = cpp_identifier(decl_full_name(comp_id)); + auto comp_name = decl_full_name(comp_id); + auto type_name = cpp_identifier(comp_name); ctx.write( "assert(ecsact_id_cast(::", - cpp_comp_full_name, + type_name, "::id) == component_id);\n" ); ctx.write( "*static_cast<::", - cpp_comp_full_name, + type_name, "*>(out_component_data) = view->get<::", - cpp_comp_full_name, + type_name, ">(entity);" ); return; @@ -241,9 +261,20 @@ auto ecsact::rt_entt_codegen::core::provider::context_update_impl( return; } + auto system_name = decl_full_name(sys_like_id); + ctx.write( + "#ifdef TRACY_ENABLE\n", + "\tZoneScopedNC(\"context_update ", + system_name, + "\", tracy::Color::Red);\n", + "#endif\n" + ); + if(details.writable_comps.size() == 1) { const auto& comp_id = *details.writable_comps.begin(); - auto type_name = cpp_identifier(decl_full_name(comp_id)); + auto comp_name = decl_full_name(comp_id); + auto type_name = cpp_identifier(comp_name); + ctx.write( "wrapper::dynamic::context_update<::", type_name, @@ -299,9 +330,20 @@ auto ecsact::rt_entt_codegen::core::provider::context_has_impl( return; } + auto system_name = decl_full_name(sys_like_id); + ctx.write( + "#ifdef TRACY_ENABLE\n", + "\tZoneScopedNC(\"context_has ", + system_name, + "\", tracy::Color::Gray);\n", + "#endif\n" + ); + if(details.writable_comps.size() == 1) { const auto& comp_id = *details.writable_comps.begin(); auto type_name = cpp_identifier(decl_full_name(comp_id)); + auto comp_name = decl_full_name(comp_id); + ctx.write( "return wrapper::dynamic::context_has<::", type_name, @@ -342,6 +384,16 @@ auto ecsact::rt_entt_codegen::core::provider::context_generate_impl( // TODO (Kelwan): Handle undefined behaviour return; } + + auto system_name = decl_full_name(sys_like_id); + ctx.write( + "#ifdef TRACY_ENABLE\n", + "\tZoneScopedNC(\"context_generate ", + system_name, + "\", tracy::Color::Yellow);\n", + "#endif\n" + ); + block( ctx, "static const auto generate_fns = " @@ -351,7 +403,9 @@ auto ecsact::rt_entt_codegen::core::provider::context_generate_impl( [&] { for(const auto& component : details.generate_comps) { for(const auto& [comp_id, requirements] : component) { - auto type_name = cpp_identifier(decl_full_name(comp_id)); + auto comp_name = decl_full_name(comp_id); + auto type_name = cpp_identifier(comp_name); + ctx.write( "{", type_name, @@ -395,9 +449,21 @@ auto ecsact::rt_entt_codegen::core::provider::context_stream_toggle_impl( if(stream_comps.empty()) { // TODO(Kelwan): Handle unexpected behaviour return; - } else if(stream_comps.size() == 1) { + } + + auto system_name = decl_full_name(sys_like_id); + ctx.write( + "#ifdef TRACY_ENABLE\n", + "\tZoneScopedNC(\"context_stream_toggle ", + system_name, + "\", tracy::Color::Green);\n", + "#endif\n" + ); + + if(stream_comps.size() == 1) { const auto& comp_id = stream_comps.begin(); auto type_name = cpp_identifier(decl_full_name(*comp_id)); + ctx.write( "wrapper::dynamic::context_stream_toggle<::", type_name, @@ -407,6 +473,7 @@ auto ecsact::rt_entt_codegen::core::provider::context_stream_toggle_impl( ); return; } + block( ctx, "static const auto toggle_fns = " diff --git a/runtime/index.bzl b/runtime/index.bzl index 648fe05..c2c11a7 100644 --- a/runtime/index.bzl +++ b/runtime/index.bzl @@ -83,6 +83,7 @@ def ecsact_entt_runtime(name, srcs = [], deps = [], system_impls = [], tags = [] "@entt", "@xxhash", "%s__public_cc" % name, + "@tracy" ] cc_library( diff --git a/test/MODULE.bazel b/test/MODULE.bazel index dae87ec..c983480 100644 --- a/test/MODULE.bazel +++ b/test/MODULE.bazel @@ -1,6 +1,6 @@ module(name = "ecsact_rt_entt_test") -bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_cc", version = "0.0.17") bazel_dep(name = "bazel_skylib", version = "1.6.1") bazel_dep(name = "googletest", version = "1.14.0.bcr.1") bazel_dep(name = "rules_ecsact", version = "0.5.8") @@ -11,6 +11,7 @@ bazel_dep(name = "boost.dll", version = "1.83.0.bzl.2") bazel_dep(name = "entt", version = "3.12.2") bazel_dep(name = "ecsact_cli", version = "0.3.19") bazel_dep(name = "boost.process", version = "1.83.0.bzl.2") +bazel_dep(name = "tracy", version = "0.11.1") bazel_dep(name = "toolchains_llvm", version = "1.0.0", dev_dependency = True) bazel_dep(name = "hedron_compile_commands", dev_dependency = True) @@ -27,6 +28,12 @@ git_override( remote = "https://github.com/zaucy/libarchive.git", ) +git_override( + module_name = "tracy", + commit = "b75f30a3823bc290b4d2359234d10ff69855d046", + remote = "https://github.com/seaube/tracy.git", +) + bazel_dep(name = "ecsact_rt_entt") bazel_dep(name = "xxhash", version = "0.8.2")