核心模板架构

This commit is contained in:
2026-08-04 16:24:41 +08:00
parent 68476882a3
commit f1b9cadd47
121 changed files with 4782 additions and 210 deletions
@@ -92,7 +92,7 @@ struct Explicit_Input_Frame_Handle final : Render_Input_Frame_Handle {
runtime->committed_update_states.push_back(std::move(runtime->input.completion_state));
}
if (input)
input->clear();
input->consume();
runtime->input.pending = false;
}
Explicit_Renderable_Runtime_Data* runtime{};
@@ -192,6 +192,13 @@ Render_Input_Write_Guard Explicit_Renderable_Runtime::acquire_edit_input(bool no
return Render_Input_Write_Guard(d->input.data, std::make_unique<Explicit_Input_Write_Handle>(d.get(), std::move(lock), notify_render));
}
Render_Input_Frame_Guard Explicit_Renderable_Runtime::acquire_input_read(Renderable_Input_Role) {
std::unique_lock<std::mutex> lock(d->input_mutex, std::try_to_lock);
if (!lock || !d->input.data)
return {};
return Render_Input_Frame_Guard(d->input.data, std::make_unique<Explicit_Input_Frame_Handle>(d.get(), std::move(lock)));
}
Renderable_Frame_View Explicit_Renderable_Runtime::capture_frame_view() {
std::unique_lock<std::mutex> state_lock(d->state_mutex);
if (!d->state)
@@ -21,6 +21,7 @@ public:
Render_State_Read_Guard acquire_edit_state_read() override;
Render_State_Write_Guard acquire_edit_state() override;
Render_Input_Write_Guard acquire_edit_input(bool notify_render) override;
Render_Input_Frame_Guard acquire_input_read(Renderable_Input_Role role) override;
Renderable_Frame_View capture_frame_view() override;
Render_State* state(Renderable_State_Role role) override;
Input_Data* input_data(Renderable_Input_Role role) override;
@@ -21,6 +21,7 @@ public:
Render_State_Read_Guard acquire_edit_state_read() override;
Render_State_Write_Guard acquire_edit_state() override;
Render_Input_Write_Guard acquire_edit_input(bool notify_render) override;
Render_Input_Frame_Guard acquire_input_read(Renderable_Input_Role role) override;
Renderable_Frame_View capture_frame_view() override;
Render_State* state(Renderable_State_Role role) override;
Input_Data* input_data(Renderable_Input_Role role) override;
+13 -1
View File
@@ -240,7 +240,7 @@ struct Low_Latency_Renderable_Runtime_Data {
committed_update_states.push_back(std::move(slot.completion_state));
}
if (slot.data)
slot.data->clear();
slot.data->consume();
slot.pending = false;
}
};
@@ -379,6 +379,18 @@ Render_Input_Write_Guard Low_Latency_Renderable_Runtime::acquire_edit_input(bool
return Render_Input_Write_Guard(input, std::make_unique<Low_Latency_Input_Write_Handle>(d.get(), record.lease, notify_render));
}
Render_Input_Frame_Guard Low_Latency_Renderable_Runtime::acquire_input_read(Renderable_Input_Role role) {
Triple_Buffer_Lease lease = d->try_mark_input_role(input_role_index(role));
if (!lease)
return {};
Input_Data* input = d->input_data_by_index(lease.index);
if (!input) {
d->input_control.unmark_use(lease);
return {};
}
return Render_Input_Frame_Guard(input, std::make_unique<Low_Latency_Input_Frame_Handle>(d.get(), lease));
}
Renderable_Frame_View Low_Latency_Renderable_Runtime::capture_frame_view() {
d->sync_state_pipeline();
Triple_Buffer_Lease state_lease = d->try_mark_state_role(State_Render);