chrono_batch_render/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
8 / 17
47.1%
Branches:
9 / 41
22.0%
Functions:
-
-%

device/stream.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstdint>
5
6 namespace chrono::batch_render {
7
8 class Stream {
9 public:
10 ✗ static constexpr Stream Compute(void* handle) {
11 ✗ return Stream(Kind::Compute, handle);
12 }
13
14 static constexpr Stream Default() {
15 return Stream(Kind::Compute, nullptr);
16 }
17
18 static constexpr Stream Host() {
19 return Stream(Kind::Host, nullptr);
20 }
21
22 static constexpr Stream None() {
23 return Stream(Kind::None, nullptr);
24 }
25
26 constexpr bool IsHost() const {
27 return m_kind == Kind::Host;
28 }
29
30 5935 constexpr bool IsNone() const {
31
3/8
<unknown function 10>:
✓ Branch 0 taken 1838 times.
✓ Branch 1 taken 3806 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
<unknown function 30>:
✓ Branch 0 taken 291 times.
✗ Branch 1 not taken.
5935 return m_kind == Kind::None;
32 }
33
34 139532 constexpr bool IsCompute() const {
35
6/22
<unknown function 10>:
✗ Branch 0 not taken.
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 1 taken 56190 times.
<unknown function 34>:
✗ Branch 0 not taken.
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
✓ Branch 1 taken 14172 times.
✗ Branch 2 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 69121 times.
139532 return m_kind == Kind::Compute;
36 }
37
38 ✗ constexpr bool IsDefault() const {
39
0/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ return m_kind == Kind::Compute && m_handle == nullptr;
40 }
41
42 ✗ constexpr void* Handle() const {
43
0/2
<unknown function 10>:
✗ Branch 1 not taken.
<unknown function 34>:
✗ Branch 1 not taken.
✗ return m_handle;
44 }
45
46 private:
47 enum class Kind : uint8_t { None, Host, Compute };
48
49
0/1
✗ Branch 1 not taken.
✗ constexpr Stream(Kind kind, void* handle) : m_kind(kind), m_handle(handle) {}
50
51 Kind m_kind;
52 void* m_handle;
53 };
54
55 }
56