#pragma once #include "../architecture/Render_Config.h" #include "../architecture/global.h" #include "../base/Task.h" #include #include #include namespace renderive { struct Render_Task_Graph_Node { std::uint32_t index = UINT32_MAX; explicit operator bool() const noexcept { return index != UINT32_MAX; } }; class LIB_DECL Render_Task_Graph { public: explicit Render_Task_Graph(void* impl) noexcept; [[nodiscard]] Render_Task_Graph_Node emplace(Task work); void precede(Render_Task_Graph_Node before, Render_Task_Graph_Node after); private: void* impl{}; }; struct Render_Executor_Task { using Graph_Builder = std::function; Plot_Execution_Id plot_id{}; std::uint64_t frame_id{}; Render_Task_Kind kind = Render_Task_Kind::Primitive; Task work; Graph_Builder build_graph; Task completion; std::shared_ptr frame_stat; std::uint32_t logical_task_count{1}; bool frame_job{}; }; class Render_Executor_Private; class LIB_DECL Render_Executor { public: explicit Render_Executor(Render_Runtime_Config config = {}); Render_Executor(const Render_Executor&) = delete; Render_Executor& operator=(const Render_Executor&) = delete; ~Render_Executor(); bool try_submit(Render_Executor_Task task); void shutdown(); [[nodiscard]] Render_Executor_Snapshot snapshot() const; [[nodiscard]] std::size_t worker_count() const; private: std::unique_ptr d; }; std::size_t resolve_render_worker_count(std::size_t configured_count); } // namespace renderive