Files
Renderive/Core/execution/Render_Executor.h
T
2026-08-02 03:43:39 +08:00

37 lines
1.2 KiB
C++

#pragma once
#include "../architecture/Render_Config.h"
#include "../architecture/global.h"
#include "../base/Task.h"
#include <functional>
#include <memory>
#include <taskflow/taskflow.hpp>
namespace renderive {
struct Render_Executor_Task {
using Taskflow_Builder = std::function<void(tf::Taskflow&, tf::Task, tf::Task)>;
Plot_Execution_Id plot_id{};
std::uint64_t frame_id{};
Render_Task_Kind kind = Render_Task_Kind::Primitive;
Task work;
Taskflow_Builder build_taskflow;
Task completion;
std::shared_ptr<Frame_Worker_Stats> 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<Render_Executor_Private> d;
};
std::size_t resolve_render_worker_count(std::size_t configured_count);
} // namespace renderive