Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
bicameral::sim::anonymous_namespace{probe_sim.cpp} Namespace Reference

Classes

struct  EventRingHeader
struct  ReferenceGeneration

Functions

gpu::GraphStatsLayout MakeConductStatsLayout ()
template<typename T>
void WriteAt (std::byte *base, uint32_t offset, const T &value)
template<typename T>
ComPtr< ID3D12Resource > CreateFilledUpload (ID3D12Device *device, const std::vector< T > &data, const wchar_t *name)
ComPtr< ID3D12PipelineState > LoadComputePipeline (ID3D12Device *device, ID3D12RootSignature *rootSignature, std::string_view shaderPath)
void SetUnitConstants (ID3D12GraphicsCommandList10 *list, uint64_t tick, uint32_t argument)
bool InCrate (uint32_t value)
bool OnCrateWall (uint32_t value)
bool IsCrateWall (uint32_t x, uint32_t y, uint32_t z)
void MarkWithNeighbors (std::vector< uint8_t > &scheduled, uint32_t block)
std::vector< uint8_t > ScheduleBlocks (std::span< const uint8_t > seeds)
uint32_t CountWokenBlocks (std::span< const uint8_t > flags, std::span< const uint8_t > previousScheduled)
uint64_t ApplyPokes (const ReactionTableView &table, ReferenceGeneration current, uint64_t tick, std::span< const ProbeCommand > commands, std::vector< uint8_t > &seeds, std::vector< uint64_t > &changedMarks)
ProbeCellStep ReferenceStepCell (const ReactionTableView &table, ReferenceGeneration current, uint32_t index, uint64_t tick, uint64_t changedMark)
uint32_t BlockOfCellIndex (uint32_t index)

Variables

constexpr gpu::RootSignatureLayout ROOT_LAYOUT
constexpr uint32_t UAV_CELLS = 0
constexpr uint32_t UAV_EVENTS = 1
constexpr uint32_t UAV_EXTRACTION0 = 2
constexpr uint32_t UAV_EXTRACTION1 = 3
constexpr uint32_t UAV_BUSY_SINK = 4
constexpr uint32_t UAV_EXTRACTION2 = 5
constexpr uint32_t UAV_HASHES = 6
constexpr uint32_t UAV_COMMAND_QUEUE = 7
constexpr uint32_t UAV_TICK_EVENTS = 8
constexpr uint32_t UAV_ACTIVE_LIST0 = 9
constexpr uint32_t UAV_ACTIVE_LIST1 = 10
constexpr uint32_t UAV_BLOCK_SCHEDULE = 11
constexpr uint32_t UAV_THERMAL = 12
constexpr uint32_t UAV_BODIES = 13
constexpr uint32_t SRV_INPUT = 0
constexpr uint32_t SRV_REACTION_FIRST = 1
constexpr uint32_t TIMESTAMPS_PER_SLOT = ProbeSim::MAX_UNITS_PER_FRAME + 2
constexpr uint64_t CELL_BYTES = uint64_t{PROBE_CELL_COUNT} * sizeof(reaction::RxCell)
constexpr uint64_t THERMAL_BYTES = uint64_t{PROBE_CELL_COUNT} * sizeof(reaction::HcThermalCache)
constexpr uint32_t SLICE_BYTES = PROBE_SLICE_CELL_COUNT * 4
constexpr uint32_t BUSY_GROUPS = PROBE_GRID_SIZE / PROBE_GROUP_SIZE
constexpr uint32_t LINEAR_CELL_GROUPS = PROBE_CELL_COUNT / PROBE_LINEAR_GROUP_SIZE
constexpr uint32_t BLOCK_GROUPS = (PROBE_BLOCK_COUNT + PROBE_LINEAR_GROUP_SIZE - 1) / PROBE_LINEAR_GROUP_SIZE
constexpr uint32_t EXTRACTION_BYTES = PROBE_EXTRACTION_WORDS * 4
constexpr uint32_t MAX_LOGGED_DEBUG_MESSAGES = 8
constexpr uint64_t AIR_OXYGEN_MICROMOLES = 1063800
constexpr uint64_t AIR_NITROGEN_MICROMOLES = 4014200
constexpr uint64_t CRATE_CELLULOSE_MICROMOLES = 38600000
constexpr uint64_t CRATE_OXYGEN_MICROMOLES = 983000
constexpr uint64_t CRATE_NITROGEN_MICROMOLES = 3697000
constexpr int32_t INITIAL_TEMPERATURE_MILLIKELVIN = 300000
constexpr uint32_t CRATE_SIZE = 8
constexpr uint32_t CRATE_BEGIN = (PROBE_GRID_SIZE - CRATE_SIZE) / 2
constexpr uint32_t CRATE_END = CRATE_BEGIN + CRATE_SIZE

Function Documentation

◆ ApplyPokes()

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::ApplyPokes ( const ReactionTableView & table,
ReferenceGeneration current,
uint64_t tick,
std::span< const ProbeCommand > commands,
std::vector< uint8_t > & seeds,
std::vector< uint64_t > & changedMarks )

Definition at line 1068 of file probe_sim.cpp.

References ApplyPokes(), bicameral::sim::anonymous_namespace{probe_sim.cpp}::ReferenceGeneration::caches, and bicameral::sim::anonymous_namespace{probe_sim.cpp}::ReferenceGeneration::cells.

Referenced by ApplyPokes().

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

◆ BlockOfCellIndex()

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::BlockOfCellIndex ( uint32_t index)

Definition at line 1112 of file probe_sim.cpp.

References BlockOfCellIndex().

Referenced by BlockOfCellIndex().

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

◆ CountWokenBlocks()

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CountWokenBlocks ( std::span< const uint8_t > flags,
std::span< const uint8_t > previousScheduled )

Definition at line 1050 of file probe_sim.cpp.

References CountWokenBlocks().

Referenced by CountWokenBlocks().

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

◆ CreateFilledUpload()

template<typename T>
ComPtr< ID3D12Resource > bicameral::sim::anonymous_namespace{probe_sim.cpp}::CreateFilledUpload ( ID3D12Device * device,
const std::vector< T > & data,
const wchar_t * name )

Definition at line 90 of file probe_sim.cpp.

References bicameral::gpu::CreateBuffer(), CreateFilledUpload(), and bicameral::gpu::Upload.

Referenced by CreateFilledUpload().

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

◆ InCrate()

bool bicameral::sim::anonymous_namespace{probe_sim.cpp}::InCrate ( uint32_t value)

Definition at line 968 of file probe_sim.cpp.

References CRATE_BEGIN, CRATE_END, and InCrate().

Referenced by InCrate(), and IsCrateWall().

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

◆ IsCrateWall()

bool bicameral::sim::anonymous_namespace{probe_sim.cpp}::IsCrateWall ( uint32_t x,
uint32_t y,
uint32_t z )

Definition at line 976 of file probe_sim.cpp.

References InCrate(), IsCrateWall(), and OnCrateWall().

Referenced by IsCrateWall().

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

◆ LoadComputePipeline()

ComPtr< ID3D12PipelineState > bicameral::sim::anonymous_namespace{probe_sim.cpp}::LoadComputePipeline ( ID3D12Device * device,
ID3D12RootSignature * rootSignature,
std::string_view shaderPath )

Definition at line 112 of file probe_sim.cpp.

References bicameral::gpu::CreateComputePipeline(), bicameral::Error, LoadComputePipeline(), bicameral::gpu::LoadShader(), bicameral::Log(), and bicameral::Sim.

Referenced by LoadComputePipeline().

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

◆ MakeConductStatsLayout()

gpu::GraphStatsLayout bicameral::sim::anonymous_namespace{probe_sim.cpp}::MakeConductStatsLayout ( )

Definition at line 69 of file probe_sim.cpp.

References bicameral::gpu::GraphStatsLayout::gauges, MakeConductStatsLayout(), and bicameral::gpu::GraphStatsLayout::nodes.

Referenced by MakeConductStatsLayout().

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

◆ MarkWithNeighbors()

void bicameral::sim::anonymous_namespace{probe_sim.cpp}::MarkWithNeighbors ( std::vector< uint8_t > & scheduled,
uint32_t block )

Definition at line 1018 of file probe_sim.cpp.

References MarkWithNeighbors().

Referenced by MarkWithNeighbors(), and ScheduleBlocks().

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

◆ OnCrateWall()

bool bicameral::sim::anonymous_namespace{probe_sim.cpp}::OnCrateWall ( uint32_t value)

Definition at line 972 of file probe_sim.cpp.

References CRATE_BEGIN, CRATE_END, and OnCrateWall().

Referenced by IsCrateWall(), and OnCrateWall().

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

◆ ReferenceStepCell()

ProbeCellStep bicameral::sim::anonymous_namespace{probe_sim.cpp}::ReferenceStepCell ( const ReactionTableView & table,
ReferenceGeneration current,
uint32_t index,
uint64_t tick,
uint64_t changedMark )

Definition at line 1095 of file probe_sim.cpp.

References bicameral::sim::anonymous_namespace{probe_sim.cpp}::ReferenceGeneration::caches, bicameral::sim::anonymous_namespace{probe_sim.cpp}::ReferenceGeneration::cells, and ReferenceStepCell().

Referenced by ReferenceStepCell().

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

◆ ScheduleBlocks()

std::vector< uint8_t > bicameral::sim::anonymous_namespace{probe_sim.cpp}::ScheduleBlocks ( std::span< const uint8_t > seeds)

Definition at line 1039 of file probe_sim.cpp.

References MarkWithNeighbors(), and ScheduleBlocks().

Referenced by ScheduleBlocks().

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

◆ SetUnitConstants()

void bicameral::sim::anonymous_namespace{probe_sim.cpp}::SetUnitConstants ( ID3D12GraphicsCommandList10 * list,
uint64_t tick,
uint32_t argument )

Definition at line 124 of file probe_sim.cpp.

References ROOT_LAYOUT, and SetUnitConstants().

Referenced by SetUnitConstants().

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

◆ WriteAt()

template<typename T>
void bicameral::sim::anonymous_namespace{probe_sim.cpp}::WriteAt ( std::byte * base,
uint32_t offset,
const T & value )

Definition at line 84 of file probe_sim.cpp.

References WriteAt().

Referenced by WriteAt().

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

Variable Documentation

◆ AIR_NITROGEN_MICROMOLES

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::AIR_NITROGEN_MICROMOLES = 4014200
constexpr

Definition at line 953 of file probe_sim.cpp.

◆ AIR_OXYGEN_MICROMOLES

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::AIR_OXYGEN_MICROMOLES = 1063800
constexpr

Definition at line 952 of file probe_sim.cpp.

◆ BLOCK_GROUPS

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::BLOCK_GROUPS = (PROBE_BLOCK_COUNT + PROBE_LINEAR_GROUP_SIZE - 1) / PROBE_LINEAR_GROUP_SIZE
constexpr

Definition at line 51 of file probe_sim.cpp.

◆ BUSY_GROUPS

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::BUSY_GROUPS = PROBE_GRID_SIZE / PROBE_GROUP_SIZE
constexpr

Definition at line 49 of file probe_sim.cpp.

◆ CELL_BYTES

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CELL_BYTES = uint64_t{PROBE_CELL_COUNT} * sizeof(reaction::RxCell)
constexpr

Definition at line 46 of file probe_sim.cpp.

◆ CRATE_BEGIN

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CRATE_BEGIN = (PROBE_GRID_SIZE - CRATE_SIZE) / 2
constexpr

Definition at line 965 of file probe_sim.cpp.

Referenced by InCrate(), and OnCrateWall().

◆ CRATE_CELLULOSE_MICROMOLES

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CRATE_CELLULOSE_MICROMOLES = 38600000
constexpr

Definition at line 957 of file probe_sim.cpp.

◆ CRATE_END

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CRATE_END = CRATE_BEGIN + CRATE_SIZE
constexpr

Definition at line 966 of file probe_sim.cpp.

Referenced by InCrate(), and OnCrateWall().

◆ CRATE_NITROGEN_MICROMOLES

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CRATE_NITROGEN_MICROMOLES = 3697000
constexpr

Definition at line 959 of file probe_sim.cpp.

◆ CRATE_OXYGEN_MICROMOLES

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CRATE_OXYGEN_MICROMOLES = 983000
constexpr

Definition at line 958 of file probe_sim.cpp.

◆ CRATE_SIZE

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::CRATE_SIZE = 8
constexpr

Definition at line 964 of file probe_sim.cpp.

◆ EXTRACTION_BYTES

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::EXTRACTION_BYTES = PROBE_EXTRACTION_WORDS * 4
constexpr

Definition at line 52 of file probe_sim.cpp.

◆ INITIAL_TEMPERATURE_MILLIKELVIN

int32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::INITIAL_TEMPERATURE_MILLIKELVIN = 300000
constexpr

Definition at line 961 of file probe_sim.cpp.

◆ LINEAR_CELL_GROUPS

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::LINEAR_CELL_GROUPS = PROBE_CELL_COUNT / PROBE_LINEAR_GROUP_SIZE
constexpr

Definition at line 50 of file probe_sim.cpp.

◆ MAX_LOGGED_DEBUG_MESSAGES

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::MAX_LOGGED_DEBUG_MESSAGES = 8
constexpr

Definition at line 64 of file probe_sim.cpp.

◆ ROOT_LAYOUT

gpu::RootSignatureLayout bicameral::sim::anonymous_namespace{probe_sim.cpp}::ROOT_LAYOUT
constexpr
Initial value:
{.uavCount = 14,
.rootConstantCount = PROBE_ROOT_CONSTANT_COUNT,
.debugRing = true,
.graphStats = true,
.graphTrace = true,
.srvCount = 5}

Definition at line 21 of file probe_sim.cpp.

Referenced by SetUnitConstants().

◆ SLICE_BYTES

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::SLICE_BYTES = PROBE_SLICE_CELL_COUNT * 4
constexpr

Definition at line 48 of file probe_sim.cpp.

◆ SRV_INPUT

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::SRV_INPUT = 0
constexpr

Definition at line 42 of file probe_sim.cpp.

◆ SRV_REACTION_FIRST

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::SRV_REACTION_FIRST = 1
constexpr

Definition at line 43 of file probe_sim.cpp.

◆ THERMAL_BYTES

uint64_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::THERMAL_BYTES = uint64_t{PROBE_CELL_COUNT} * sizeof(reaction::HcThermalCache)
constexpr

Definition at line 47 of file probe_sim.cpp.

◆ TIMESTAMPS_PER_SLOT

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::TIMESTAMPS_PER_SLOT = ProbeSim::MAX_UNITS_PER_FRAME + 2
constexpr

Definition at line 45 of file probe_sim.cpp.

◆ UAV_ACTIVE_LIST0

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_ACTIVE_LIST0 = 9
constexpr

Definition at line 37 of file probe_sim.cpp.

◆ UAV_ACTIVE_LIST1

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_ACTIVE_LIST1 = 10
constexpr

Definition at line 38 of file probe_sim.cpp.

◆ UAV_BLOCK_SCHEDULE

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_BLOCK_SCHEDULE = 11
constexpr

Definition at line 39 of file probe_sim.cpp.

◆ UAV_BODIES

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_BODIES = 13
constexpr

Definition at line 41 of file probe_sim.cpp.

◆ UAV_BUSY_SINK

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_BUSY_SINK = 4
constexpr

Definition at line 32 of file probe_sim.cpp.

◆ UAV_CELLS

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_CELLS = 0
constexpr

Definition at line 28 of file probe_sim.cpp.

◆ UAV_COMMAND_QUEUE

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_COMMAND_QUEUE = 7
constexpr

Definition at line 35 of file probe_sim.cpp.

◆ UAV_EVENTS

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_EVENTS = 1
constexpr

Definition at line 29 of file probe_sim.cpp.

◆ UAV_EXTRACTION0

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_EXTRACTION0 = 2
constexpr

Definition at line 30 of file probe_sim.cpp.

◆ UAV_EXTRACTION1

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_EXTRACTION1 = 3
constexpr

Definition at line 31 of file probe_sim.cpp.

◆ UAV_EXTRACTION2

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_EXTRACTION2 = 5
constexpr

Definition at line 33 of file probe_sim.cpp.

◆ UAV_HASHES

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_HASHES = 6
constexpr

Definition at line 34 of file probe_sim.cpp.

◆ UAV_THERMAL

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_THERMAL = 12
constexpr

Definition at line 40 of file probe_sim.cpp.

◆ UAV_TICK_EVENTS

uint32_t bicameral::sim::anonymous_namespace{probe_sim.cpp}::UAV_TICK_EVENTS = 8
constexpr

Definition at line 36 of file probe_sim.cpp.