bvh/software_builder.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <cstdint> | ||
| 5 | #include <span> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "chrono_batch_render/bvh/builder.h" | ||
| 9 | #include "chrono_batch_render/device/buffer.h" | ||
| 10 | #include "chrono_batch_render/device/ref.h" | ||
| 11 | |||
| 12 | namespace chrono::batch_render::device { | ||
| 13 | class Device; | ||
| 14 | } | ||
| 15 | |||
| 16 | namespace chrono::batch_render::bvh { | ||
| 17 | |||
| 18 | class SoftwareBlas final : public Blas { | ||
| 19 | public: | ||
| 20 | static constexpr device::Traversal kFormat = device::Traversal::Software; | ||
| 21 | |||
| 22 | SoftwareBlas(device::Device& device, const Geometry& geometry); | ||
| 23 | |||
| 24 | 1249 | uint64_t Handle() const override { | |
| 25 | 60 | return m_storage->Address(); | |
| 26 | } | ||
| 27 | |||
| 28 | 669 | device::Buffer& Storage() const { | |
| 29 | 669 | return *m_storage; | |
| 30 | } | ||
| 31 | |||
| 32 | 1437 | const Geometry& GetGeometry() const { | |
| 33 | 1437 | return m_geometry; | |
| 34 | } | ||
| 35 | |||
| 36 | private: | ||
| 37 | Geometry m_geometry; | ||
| 38 | std::vector<Ref<device::Buffer>> m_buffers; | ||
| 39 | Ref<device::Buffer> m_storage; | ||
| 40 | }; | ||
| 41 | |||
| 42 | class SoftwareTlas final : public Tlas { | ||
| 43 | public: | ||
| 44 | static constexpr device::Traversal kFormat = device::Traversal::Software; | ||
| 45 | |||
| 46 | SoftwareTlas(device::Device& device, std::span<const uint32_t> capacities); | ||
| 47 | |||
| 48 | device::Buffer& Storage() const { | ||
| 49 | return *m_storage; | ||
| 50 | } | ||
| 51 | |||
| 52 | device::BufferRange World(uint32_t world) const; | ||
| 53 | |||
| 54 | private: | ||
| 55 | Ref<device::Buffer> m_storage; | ||
| 56 | }; | ||
| 57 | |||
| 58 | } | ||
| 59 |