chrono_batch_render/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
14 / 14
100.0%
Branches:
5 / 11
45.5%
Functions:
5 / 5
100.0%

scene/tables/surfaces.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstdint>
5 #include <span>
6 #include <string_view>
7 #include <vector>
8
9 #include "chrono_batch_render/device/program.h"
10 #include "chrono_batch_render/device/ref.h"
11 #include "chrono_batch_render/scene/records/instances.h"
12 #include "chrono_batch_render/scene/tables/instances.h"
13 #include "chrono_batch_render/scene/tables/storage.h"
14 #include "chrono_batch_render/scene/tables/table.h"
15 #include "chrono_batch_render/stage/structure/structure.h"
16
17 namespace chrono::batch_render {
18
19 class SurfaceTable : public RenderTable {
20 public:
21 371 SurfaceTable(Structure& structure, const RenderTables& tables, const InstanceTable& instances)
22
1/3
✓ Branch 1 taken 371 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
742 : m_structure(structure), m_tables(tables), m_instances(instances) {}
23
24 963 std::string_view Name() const override {
25 963 return "surfaces";
26 }
27
28 std::span<const ColumnRef> Inputs() const override;
29
30 2573 std::span<const TableId> TableInputs() const override {
31 2573 static constexpr TableId kTables[] = {TableId::Meshes, TableId::Slots};
32 2573 return kTables;
33 }
34
35 1924 bool Structural() const override {
36 1924 return false;
37 }
38
39 void Prepare() override;
40 void Run(const ChangeSet& changes, TableVersions& versions) override;
41 void Describe(RenderTables& tables) const override;
42
43 963 void Hold(std::vector<Ref<const RefCounted>>& held) const override {
44
4/8
✓ Branch 0 taken 963 times.
✓ Branch 1 taken 963 times.
✓ Branch 2 taken 962 times.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1926 HoldBuffers(held, {m_surfaces.Buffer()});
45 1926 }
46
47 12 uint32_t Written() const {
48 12 return m_written;
49 }
50
51 private:
52 device::Program& Kernels();
53
54 Structure& m_structure;
55 const RenderTables& m_tables;
56 const InstanceTable& m_instances;
57 Ref<device::Program> m_program;
58 DeviceTable<SurfaceRecord> m_surfaces{"instance surfaces"};
59 uint32_t m_written = 0;
60 };
61
62 }
63