76 [[nodiscard]]
static std::expected<GpuPhysics, std::string>
Create(ID3D12Device5* device,
78 const physics::PxParameters& parameters,
81 void RecordInitialize(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing);
82 void RecordStep(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing);
86 [[nodiscard]] std::vector<PhysicsBody>
ReadBodies()
const;
93 [[nodiscard]] ID3D12Resource*
Bodies()
const {
return m_uavs[0].Get(); }
107 [[nodiscard]] std::vector<GpuPhysicsPassTime>
ProfileResult()
const;
110 [[nodiscard]]
static uint64_t
StateHash(uint64_t tick,
const std::vector<PhysicsBody>& bodies);
151 [[nodiscard]] std::expected<void, std::string>
CreatePipelines(ID3D12Device5* device);
153 void RecordSubstep(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, uint32_t substep);
154 void RecordColoring(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing,
156 void RecordIterations(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing,
158 void RecordSolveColors(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing,
164 void RecordPass(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing,
Pass pass,
165 const Constants& constants, uint32_t threadCount);
167 const Constants& constants, int32_t color);
171 const Constants& constants);
172 void BindRoot(ID3D12GraphicsCommandList10* list, D3D12_GPU_VIRTUAL_ADDRESS debugRing,
173 const Constants& constants)
const;
192 std::array<ComPtr<ID3D12Resource>, 14>
m_uavs;
193 std::array<ComPtr<ID3D12Resource>, 2>
m_srvs;
std::unique_ptr< gpu::WorkGraph > m_graph
bool SkipsEmptyColors() const
std::span< const ComPtr< ID3D12Resource > > StateBuffers() const
void SetCursor(const GpuPhysicsCursor &cursor)
bool EnableProfiling(ID3D12Device *device)
ComPtr< ID3D12Resource > m_bodiesReadback
void RecordIterations(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, Constants constants)
std::array< ComPtr< ID3D12Resource >, 2 > m_srvs
std::array< uint64_t,(size_t) Pass::Count > m_profileCounts
static std::expected< GpuPhysics, std::string > Create(ID3D12Device5 *device, const PhysicsScene &scene, const physics::PxParameters ¶meters, const GpuPhysicsOptions &options={})
void RecordSolveColorGraph(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, const Constants &constants, int32_t color)
std::expected< void, std::string > CreatePipelines(ID3D12Device5 *device)
uint32_t m_broadphaseEntry
std::expected< void, std::string > CreateBuffers(ID3D12Device5 *device, const PhysicsScene &scene)
void RecordInitialize(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing)
GpuPhysicsCursor Cursor() const
std::array< ComPtr< ID3D12Resource >, 14 > m_uavs
std::array< uint64_t,(size_t) Pass::Count > m_profileTicks
ComPtr< ID3D12RootSignature > m_rootSignature
void RecordColorPredicateStates(ID3D12GraphicsCommandList10 *list, bool toPredication) const
void RecordBroadphaseGraph(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, const Constants &constants)
physics::PxParameters m_parameters
void RecordReadback(ID3D12GraphicsCommandList10 *list) const
GpuPhysicsStats ReadStats() const
void RecordColoring(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, Constants constants)
uint32_t BodyCount() const
void RecordTimestamp(ID3D12GraphicsCommandList10 *list, Pass pass)
std::vector< GpuPhysicsPassTime > ProfileResult() const
ComPtr< ID3D12QueryHeap > m_timestamps
void RecordPass(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, Pass pass, const Constants &constants, uint32_t threadCount)
void RecordSubstep(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, uint32_t substep)
void RecordStep(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing)
static uint64_t StateHash(uint64_t tick, const std::vector< PhysicsBody > &bodies)
std::vector< Pass > m_profiledPasses
void BindRoot(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, const Constants &constants) const
void RecordColorListStates(ID3D12GraphicsCommandList10 *list, bool toGraphInput) const
ComPtr< ID3D12Resource > m_statsReadback
ID3D12Resource * Bodies() const
Constants BaseConstants() const
void SetGraphProgram(ID3D12GraphicsCommandList10 *list)
GpuPhysicsOptions m_options
ComPtr< ID3D12Resource > m_timestampReadback
std::vector< PhysicsBody > ReadBodies() const
std::array< ComPtr< ID3D12PipelineState >,(size_t) Pass::Count > m_pipelines
void RecordProfileStart(ID3D12GraphicsCommandList10 *list) const
void RecordSolveColors(ID3D12GraphicsCommandList10 *list, D3D12_GPU_VIRTUAL_ADDRESS debugRing, Constants constants)