13 return std::unexpected(nest.error());
20 return std::unexpected(shader.error());
24 return std::unexpected(
"実験室の箱のパイプラインを作れない");
31 return std::unexpected(
"実験室の箱のバッファを作れない");
37 return m_nest.RecordUpload(list, nest);
41 void* mapped =
nullptr;
42 const D3D12_RANGE noRead{.Begin = 0, .End = 0};
46 std::memcpy(mapped, commands.data(), commands.size_bytes());
52 D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
53 list->ResourceBarrier(1, &toUav);
58 bool GpuLabBox::RecordTick(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, uint64_t tick,
59 std::span<const Command> commands) {
64 if (!commands.empty()) {
68 const D3D12_GPU_VIRTUAL_ADDRESS commandAddress =
m_commands->GetGPUVirtualAddress();
69 m_nest.SetExternalViews(commandAddress, commandAddress);
71 {static_cast<uint32_t>(commands.size()), LAB_BOX_SLOT, m_speciesCount, 0});
ComPtr< ID3D12Resource > m_commands
GpuLabBox(GpuMultires nest)
ComPtr< ID3D12Resource > m_commandUpload
bool RecordUpload(ID3D12GraphicsCommandList10 *list, const MultiresNest &nest)
ComPtr< ID3D12PipelineState > m_applyPipeline
static std::expected< GpuLabBox, std::string > Create(ID3D12Device5 *device, const BakedReactionTable &table)
bool RecordCommandUpload(ID3D12GraphicsCommandList10 *list, std::span< const Command > commands)
bool RecordTick(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, uint64_t tick, std::span< const Command > commands)
ID3D12RootSignature * RootSignature() const
static std::expected< GpuMultires, std::string > Create(ID3D12Device5 *device, const BakedReactionTable &table, const MultiresCapacity &capacity, const GpuMultiresOptions &options={})
std::expected< std::vector< std::byte >, std::string > LoadShader(std::string_view relativePath)
ComPtr< ID3D12PipelineState > CreateComputePipeline(ID3D12Device *device, ID3D12RootSignature *rootSignature, std::span< const std::byte > bytecode)
D3D12_RESOURCE_BARRIER Transition(ID3D12Resource *resource, D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after)
ComPtr< ID3D12Resource > CreateBuffer(ID3D12Device *device, uint64_t sizeBytes, BufferKind kind)
constexpr MultiresStepOptions LAB_STEP_OPTIONS
constexpr uint32_t LAB_MAX_COMMANDS_PER_TICK
constexpr uint32_t COMMAND_BYTES
constexpr uint64_t LAB_WORLD_SEED
MultiresCapacity LabBoxCapacity(const BakedReactionTable &table)
std::vector< reaction::RxSpecies > species