chrono_batch_render/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
3 / 3
100.0%
Branches:
1 / 1
100.0%
Functions:
1 / 1, 1 excl
100.0%

scene/tables/pack.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstdint>
5 #include <string>
6 #include <vector>
7
8 #include "chrono_batch_render/device/program.h"
9 #include "chrono_batch_render/device/ref.h"
10 #include "chrono_batch_render/stage/columns/column_store.h"
11
12 namespace chrono::batch_render {
13
14 class PackPlan {
15 public:
16 706 explicit PackPlan(std::string label) : m_label(std::move(label)) {}
17
18 void Clear();
19 void Copy(ColumnRef column, uint32_t row, uint32_t destination);
20 uint32_t Literal(uint32_t destination, uint32_t value);
21 void SetLiteral(uint32_t literal, uint32_t value);
22
23 bool Reads(const ColumnInfo* column) const;
24 bool Stale(const ColumnStore& store, uint64_t since) const;
25 uint32_t Twice(uint32_t words) const;
26
27 311 uint32_t CopyCount() const {
28
1/1
✓ Branch 1 taken 311 times.
311 return uint32_t(m_copies.size());
29 }
30
31 void Build(ColumnStore& store, bool zeroed);
32 void Pack(ColumnStore& store, uint64_t words);
33
34 private:
35 struct Cell {
36 ColumnRef column;
37 uint32_t row = 0;
38 uint32_t destination = 0;
39 };
40
41 struct Word {
42 uint32_t destination = 0;
43 uint32_t value = 0;
44 bool late = false;
45 };
46
47 std::string m_label;
48 std::vector<Cell> m_copies;
49 std::vector<Word> m_literals;
50 std::vector<ColumnRef> m_columns;
51 Ref<device::Buffer> m_entries;
52 uint32_t m_count = 0;
53 Ref<device::Program> m_program;
54 };
55
56 }
57