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

device/operation.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstddef>
5 #include <cstdint>
6
7 #include "chrono_batch_render/device/ref.h"
8 #include "chrono_batch_render/device/stream.h"
9 #include "chrono_batch_render/export.h"
10 #include "chrono_batch_render/util/span.h"
11
12 namespace chrono::batch_render::device {
13
14 class Buffer;
15 class Device;
16 class Queue;
17
18 27987 struct CHRONO_BATCH_RENDER_API Operation {
19 Queue* queue = nullptr;
20 uint64_t value = 0;
21
22 bool Ready() const;
23
24 void Wait() const;
25
26 void Wait(Stream stream) const;
27 };
28
29 class CHRONO_BATCH_RENDER_API Download : public Operation {
30 public:
31 Download();
32 ~Download();
33 Download(const Download& other);
34 Download(Download&& other) noexcept;
35 Download& operator=(const Download& other);
36 Download& operator=(Download&& other) noexcept;
37
38 Span<const std::byte> Bytes() const;
39
40 private:
41 friend class Queue;
42
43 Ref<Device> m_device;
44 Ref<Buffer> m_staging;
45 uint64_t m_offset = 0;
46 uint64_t m_bytes = 0;
47 };
48
49 }
50