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 | 17961 | program.GetDevice().Require(range.GetBuffer(), what); | |
| 17 | 17961 | if (range.Bytes() < count * sizeof(T)) { | |
| 18 | 7 | throw Error("{} needs {} bytes of buffer \"{}\"; the range it was given has {}", what, | |
| 19 | 7 | count * sizeof(T), range.GetBuffer().Label(), range.Bytes()); | |
| 20 | } | ||
| 21 | 17954 | return {range.Address()}; | |
| 22 | } | ||
| 23 | |||
| 24 | } | ||
| 25 |