sensor_pipeline/resolve.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> | ||
| 7 | #include <utility> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | #include "chrono_batch_render/graph/graph.h" | ||
| 11 | #include "chrono_batch_render/sensor_pipeline/node.h" | ||
| 12 | |||
| 13 | namespace chrono::batch_render::sensor_pipeline { | ||
| 14 | |||
| 15 | inline constexpr uint32_t kNoValue = ~0u; | ||
| 16 | |||
| 17 | struct ConnectionDesc { | ||
| 18 | std::string input; | ||
| 19 | uint32_t source = ~0u; | ||
| 20 | std::string sourcePath; | ||
| 21 | std::string output; | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct NodeDesc { | ||
| 25 | uint32_t prim = 0; | ||
| 26 | std::string path; | ||
| 27 | std::string id; | ||
| 28 | std::vector<std::pair<std::string, std::string>> uniforms; | ||
| 29 | std::vector<std::pair<std::string, std::vector<float>>> values; | ||
| 30 | std::vector<ConnectionDesc> inputs; | ||
| 31 | }; | ||
| 32 | |||
| 33 | struct SensorPipelineDesc { | ||
| 34 | uint32_t prim = 0; | ||
| 35 | std::string path; | ||
| 36 | std::vector<NodeDesc> nodes; | ||
| 37 | std::vector<ConnectionDesc> outputs; | ||
| 38 | }; | ||
| 39 | |||
| 40 | struct ResolvedNode { | ||
| 41 | uint32_t def = kNoDef; | ||
| 42 | uint32_t prim = 0; | ||
| 43 | std::string path; | ||
| 44 | std::vector<uint32_t> uniforms; | ||
| 45 | std::vector<float> parameters; | ||
| 46 | std::vector<uint32_t> inputs; | ||
| 47 | std::vector<uint32_t> outputs; | ||
| 48 | std::vector<uint32_t> scratch; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct Value { | ||
| 52 | uint32_t node = 0; | ||
| 53 | uint32_t port = 0; | ||
| 54 | SignalType type = SignalType::ElectronRate; | ||
| 55 | }; | ||
| 56 | |||
| 57 | 617 | struct ResolvedOutput { | |
| 58 | std::string name; | ||
| 59 | uint32_t value = kNoValue; | ||
| 60 | }; | ||
| 61 | |||
| 62 | 94 | struct ResolvedSensorPipeline { | |
| 63 | std::vector<ResolvedNode> nodes; | ||
| 64 | std::vector<Value> values; | ||
| 65 | std::vector<ResolvedOutput> outputs; | ||
| 66 | graph::ShapeKey key; | ||
| 67 | }; | ||
| 68 | |||
| 69 | struct DetectorLayout { | ||
| 70 | uint32_t channels = 3; | ||
| 71 | uint32_t pattern = 0; | ||
| 72 | bool mosaics = false; | ||
| 73 | }; | ||
| 74 | |||
| 75 | ResolvedSensorPipeline ResolveSensorPipeline(const SensorPipelineDesc& desc, | ||
| 76 | const NodeRegistry& registry); | ||
| 77 | |||
| 78 | std::vector<SignalLayout> PropagateLayouts(const ResolvedSensorPipeline& pipeline, | ||
| 79 | const NodeRegistry& registry, DetectorLayout detector); | ||
| 80 | |||
| 81 | } | ||
| 82 |