scene/tables/views.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <span> | ||
| 5 | #include <string_view> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "chrono_batch_render/device/buffer.h" | ||
| 9 | #include "chrono_batch_render/device/program.h" | ||
| 10 | #include "chrono_batch_render/device/ref.h" | ||
| 11 | #include "chrono_batch_render/scene/records/views.h" | ||
| 12 | #include "chrono_batch_render/scene/tables/products.h" | ||
| 13 | #include "chrono_batch_render/scene/tables/table.h" | ||
| 14 | #include "chrono_batch_render/stage/structure/structure.h" | ||
| 15 | |||
| 16 | namespace chrono::batch_render { | ||
| 17 | |||
| 18 | class ViewTable : public RenderTable { | ||
| 19 | public: | ||
| 20 | 353 | ViewTable(Structure& structure, const RenderTables& tables, const ProductTable& products) | |
| 21 | 353 | : m_structure(structure), m_tables(tables), m_products(products) {} | |
| 22 | |||
| 23 | 928 | std::string_view Name() const override { | |
| 24 | 928 | return "views"; | |
| 25 | } | ||
| 26 | |||
| 27 | 2381 | std::span<const ColumnRef> Inputs() const override { | |
| 28 | 2381 | return {}; | |
| 29 | } | ||
| 30 | |||
| 31 | 2381 | std::span<const TableId> TableInputs() const override { | |
| 32 | 2381 | static constexpr TableId kTables[] = {TableId::Cameras, TableId::Products}; | |
| 33 | 2381 | return kTables; | |
| 34 | } | ||
| 35 | |||
| 36 | void Prepare() override; | ||
| 37 | void Run(const ChangeSet& changes, TableVersions& versions) override; | ||
| 38 | void Describe(RenderTables& tables) const override; | ||
| 39 | |||
| 40 | 928 | void Hold(std::vector<Ref<const RefCounted>>& held) const override { | |
| 41 | 3712 | HoldBuffers(held, {m_views, m_starts}); | |
| 42 | 1856 | } | |
| 43 | |||
| 44 | const Ref<device::Buffer>& Views() const { | ||
| 45 | 10 | return m_views; | |
| 46 | } | ||
| 47 | |||
| 48 | const Ref<device::Buffer>& Starts() const { | ||
| 49 | 2 | return m_starts; | |
| 50 | } | ||
| 51 | |||
| 52 | 10 | uint32_t Count() const { | |
| 53 | 10 | return m_count; | |
| 54 | } | ||
| 55 | |||
| 56 | private: | ||
| 57 | device::Program& Kernels(); | ||
| 58 | |||
| 59 | Structure& m_structure; | ||
| 60 | const RenderTables& m_tables; | ||
| 61 | const ProductTable& m_products; | ||
| 62 | Ref<device::Program> m_program; | ||
| 63 | Ref<device::Buffer> m_views; | ||
| 64 | Ref<device::Buffer> m_starts; | ||
| 65 | uint32_t m_count = 0; | ||
| 66 | }; | ||
| 67 | |||
| 68 | } | ||
| 69 |