Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
bicameral::sim::LabSession Class Reference

#include <lab_session.h>

Collaboration diagram for bicameral::sim::LabSession:
[legend]

Public Member Functions

bool Place (LabCellPosition cell, std::span< const SpeciesAmount > contents, uint32_t temperatureMilliKelvin)
bool SetTemperature (LabCellPosition cell, uint32_t temperatureMilliKelvin)
std::expected< void, std::string > Step (uint32_t tickCount)
std::expected< void, std::string > Reset ()
std::expected< void, std::string > Replay (const LabRecording &recording)
uint64_t NextTick () const
const MultiresNest & Cpu () const
const MultiresNest & Gpu () const
const BakedReactionTable & Table () const
const std::optional< LabMismatch > & Mismatch () const
std::optional< uint64_t > ReplayDivergence () const
bool Replaying () const
size_t PendingCommands () const
LabRecording Recording () const

Static Public Member Functions

static std::expected< LabSession, std::string > Create (ID3D12Device5 *device, D3D12_COMMAND_LIST_TYPE queueType, const BakedReactionTable &table)

Private Member Functions

 LabSession (BakedReactionTable table, gpu::ImmediateQueue queue, gpu::DebugRing ring, GpuLabBox box)
bool Queue (const Command &command)
std::vector< Command > TakeCommands (uint64_t tick)
std::expected< void, std::string > StepOne ()

Private Attributes

BakedReactionTable m_table
gpu::ImmediateQueue m_queue
gpu::DebugRing m_ring
GpuLabBox m_box
MultiresNest m_cpu
MultiresNest m_read
bool m_uploaded = false
uint64_t m_tick = 0
uint32_t m_sequence = 0
std::vector< Command > m_pending
std::vector< Command > m_scheduled
std::vector< Command > m_history
std::vector< uint64_t > m_hashes
std::optional< LabMismatch > m_mismatch
std::vector< uint64_t > m_replayHashes
uint64_t m_replayEnd = 0
std::optional< uint64_t > m_replayDivergence

Detailed Description

Definition at line 25 of file lab_session.h.

Constructor & Destructor Documentation

◆ LabSession()

bicameral::sim::LabSession::LabSession ( BakedReactionTable table,
gpu::ImmediateQueue queue,
gpu::DebugRing ring,
GpuLabBox box )
private

Definition at line 26 of file lab_session.cpp.

References m_box, m_cpu, m_queue, m_read, m_ring, m_table, and bicameral::sim::MakeLabBoxNest().

Referenced by Create().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ Cpu()

const MultiresNest & bicameral::sim::LabSession::Cpu ( ) const
inlinenodiscard

Definition at line 47 of file lab_session.h.

References m_cpu.

◆ Create()

std::expected< LabSession, std::string > bicameral::sim::LabSession::Create ( ID3D12Device5 * device,
D3D12_COMMAND_LIST_TYPE queueType,
const BakedReactionTable & table )
staticnodiscard

Definition at line 9 of file lab_session.cpp.

References bicameral::gpu::DebugRing::Create(), bicameral::gpu::ImmediateQueue::Create(), bicameral::sim::GpuLabBox::Create(), and LabSession().

Referenced by bicameral::editor::LabPanel::CreateSession().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gpu()

const MultiresNest & bicameral::sim::LabSession::Gpu ( ) const
inlinenodiscard

Definition at line 48 of file lab_session.h.

References m_read.

◆ Mismatch()

const std::optional< LabMismatch > & bicameral::sim::LabSession::Mismatch ( ) const
inlinenodiscard

Definition at line 50 of file lab_session.h.

References m_mismatch.

◆ NextTick()

uint64_t bicameral::sim::LabSession::NextTick ( ) const
inlinenodiscard

Definition at line 46 of file lab_session.h.

References m_tick.

◆ PendingCommands()

size_t bicameral::sim::LabSession::PendingCommands ( ) const
inlinenodiscard

Definition at line 53 of file lab_session.h.

References m_pending.

◆ Place()

bool bicameral::sim::LabSession::Place ( LabCellPosition cell,
std::span< const SpeciesAmount > contents,
uint32_t temperatureMilliKelvin )

Definition at line 46 of file lab_session.cpp.

References m_sequence, m_tick, bicameral::sim::MakeLabFillCommand(), and Queue().

Here is the call graph for this function:

◆ Queue()

bool bicameral::sim::LabSession::Queue ( const Command & command)
private

Definition at line 36 of file lab_session.cpp.

References bicameral::sim::LAB_MAX_COMMANDS_PER_TICK, m_pending, and m_sequence.

Referenced by Place(), and SetTemperature().

Here is the caller graph for this function:

◆ Recording()

LabRecording bicameral::sim::LabSession::Recording ( ) const
nodiscard

Definition at line 162 of file lab_session.cpp.

References m_hashes, m_history, and m_tick.

◆ Replay()

std::expected< void, std::string > bicameral::sim::LabSession::Replay ( const LabRecording & recording)
nodiscard

Definition at line 149 of file lab_session.cpp.

References bicameral::sim::LabRecording::commands, bicameral::sim::LabRecording::hashes, m_replayEnd, m_replayHashes, m_scheduled, m_sequence, Reset(), bicameral::sim::Command::sequence, Step(), and bicameral::sim::LabRecording::tickCount.

Here is the call graph for this function:

◆ ReplayDivergence()

std::optional< uint64_t > bicameral::sim::LabSession::ReplayDivergence ( ) const
inlinenodiscard

Definition at line 51 of file lab_session.h.

References m_replayDivergence.

◆ Replaying()

bool bicameral::sim::LabSession::Replaying ( ) const
inlinenodiscard

Definition at line 52 of file lab_session.h.

References m_replayEnd, and m_tick.

◆ Reset()

std::expected< void, std::string > bicameral::sim::LabSession::Reset ( )
nodiscard

Definition at line 131 of file lab_session.cpp.

References m_cpu, m_hashes, m_history, m_mismatch, m_pending, m_read, m_replayDivergence, m_replayEnd, m_replayHashes, m_scheduled, m_sequence, m_table, m_tick, m_uploaded, and bicameral::sim::MakeLabBoxNest().

Referenced by Replay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTemperature()

bool bicameral::sim::LabSession::SetTemperature ( LabCellPosition cell,
uint32_t temperatureMilliKelvin )

Definition at line 51 of file lab_session.cpp.

References m_sequence, m_tick, bicameral::sim::MakeLabTemperatureCommand(), and Queue().

Here is the call graph for this function:

◆ Step()

std::expected< void, std::string > bicameral::sim::LabSession::Step ( uint32_t tickCount)
nodiscard

Definition at line 120 of file lab_session.cpp.

References m_mismatch, and StepOne().

Referenced by Replay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StepOne()

std::expected< void, std::string > bicameral::sim::LabSession::StepOne ( )
nodiscardprivate

Definition at line 78 of file lab_session.cpp.

References bicameral::sim::FindLabMismatch(), bicameral::sim::HashWholeNest(), m_box, m_cpu, m_hashes, m_history, m_mismatch, m_queue, m_read, m_replayDivergence, m_replayHashes, m_ring, m_table, m_tick, m_uploaded, bicameral::sim::MakeLabBoxNest(), bicameral::sim::StepLabBox(), and TakeCommands().

Referenced by Step().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Table()

const BakedReactionTable & bicameral::sim::LabSession::Table ( ) const
inlinenodiscard

Definition at line 49 of file lab_session.h.

References m_table.

◆ TakeCommands()

std::vector< Command > bicameral::sim::LabSession::TakeCommands ( uint64_t tick)
nodiscardprivate

Definition at line 58 of file lab_session.cpp.

References bicameral::sim::CommandPrecedes(), bicameral::sim::LAB_MAX_COMMANDS_PER_TICK, m_pending, and m_scheduled.

Referenced by StepOne().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_box

GpuLabBox bicameral::sim::LabSession::m_box
private

Definition at line 66 of file lab_session.h.

Referenced by LabSession(), and StepOne().

◆ m_cpu

MultiresNest bicameral::sim::LabSession::m_cpu
private

Definition at line 69 of file lab_session.h.

Referenced by Cpu(), LabSession(), Reset(), and StepOne().

◆ m_hashes

std::vector<uint64_t> bicameral::sim::LabSession::m_hashes
private

Definition at line 81 of file lab_session.h.

Referenced by Recording(), Reset(), and StepOne().

◆ m_history

std::vector<Command> bicameral::sim::LabSession::m_history
private

Definition at line 78 of file lab_session.h.

Referenced by Recording(), Reset(), and StepOne().

◆ m_mismatch

std::optional<LabMismatch> bicameral::sim::LabSession::m_mismatch
private

Definition at line 82 of file lab_session.h.

Referenced by Mismatch(), Reset(), Step(), and StepOne().

◆ m_pending

std::vector<Command> bicameral::sim::LabSession::m_pending
private

Definition at line 76 of file lab_session.h.

Referenced by PendingCommands(), Queue(), Reset(), and TakeCommands().

◆ m_queue

gpu::ImmediateQueue bicameral::sim::LabSession::m_queue
private

Definition at line 64 of file lab_session.h.

Referenced by LabSession(), and StepOne().

◆ m_read

MultiresNest bicameral::sim::LabSession::m_read
private

Definition at line 70 of file lab_session.h.

Referenced by Gpu(), LabSession(), Reset(), and StepOne().

◆ m_replayDivergence

std::optional<uint64_t> bicameral::sim::LabSession::m_replayDivergence
private

Definition at line 85 of file lab_session.h.

Referenced by ReplayDivergence(), Reset(), and StepOne().

◆ m_replayEnd

uint64_t bicameral::sim::LabSession::m_replayEnd = 0
private

Definition at line 84 of file lab_session.h.

Referenced by Replay(), Replaying(), and Reset().

◆ m_replayHashes

std::vector<uint64_t> bicameral::sim::LabSession::m_replayHashes
private

Definition at line 83 of file lab_session.h.

Referenced by Replay(), Reset(), and StepOne().

◆ m_ring

gpu::DebugRing bicameral::sim::LabSession::m_ring
private

Definition at line 65 of file lab_session.h.

Referenced by LabSession(), and StepOne().

◆ m_scheduled

std::vector<Command> bicameral::sim::LabSession::m_scheduled
private

Definition at line 77 of file lab_session.h.

Referenced by Replay(), Reset(), and TakeCommands().

◆ m_sequence

uint32_t bicameral::sim::LabSession::m_sequence = 0
private

Definition at line 73 of file lab_session.h.

Referenced by Place(), Queue(), Replay(), Reset(), and SetTemperature().

◆ m_table

BakedReactionTable bicameral::sim::LabSession::m_table
private

Definition at line 63 of file lab_session.h.

Referenced by LabSession(), Reset(), StepOne(), and Table().

◆ m_tick

uint64_t bicameral::sim::LabSession::m_tick = 0
private

Definition at line 72 of file lab_session.h.

Referenced by NextTick(), Place(), Recording(), Replaying(), Reset(), SetTemperature(), and StepOne().

◆ m_uploaded

bool bicameral::sim::LabSession::m_uploaded = false
private

Definition at line 71 of file lab_session.h.

Referenced by Reset(), and StepOne().


The documentation for this class was generated from the following files: