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

device/slang/dispatch.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstdint>
5
6 #include "chrono_batch_render/device/buffer.h"
7 #include "chrono_batch_render/device/device.h"
8 #include "chrono_batch_render/device/kernels/shared.h"
9 #include "chrono_batch_render/device/program.h"
10 #include "chrono_batch_render/util/error.h"
11
12 namespace chrono::batch_render::device {
13
14 template <class T>
15 17961 Ptr<T> RequireRange(const Program& program, const char* what, BufferRange range, uint64_t count) {
16
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 1886 times.
17961 program.GetDevice().Require(range.GetBuffer(), what);
17
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1886 times.
17961 if (range.Bytes() < count * sizeof(T)) {
18 7 throw Error("{} needs {} bytes of buffer \"{}\"; the range it was given has {}", what,
19
1/1
✓ Branch 1 taken 6 times.
7 count * sizeof(T), range.GetBuffer().Label(), range.Bytes());
20 }
21 17954 return {range.Address()};
22 }
23
24 }
25