device/resource.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <string> | ||
| 5 | |||
| 6 | #include "chrono_batch_render/device/ref.h" | ||
| 7 | #include "chrono_batch_render/export.h" | ||
| 8 | |||
| 9 | namespace chrono::batch_render::device { | ||
| 10 | |||
| 11 | class Device; | ||
| 12 | |||
| 13 | class CHRONO_BATCH_RENDER_API Resource : public RefCounted { | ||
| 14 | public: | ||
| 15 | ~Resource() override; | ||
| 16 | |||
| 17 | 1244299 | Device& GetDevice() const { | |
| 18 | 1244299 | return *m_device; | |
| 19 | } | ||
| 20 | |||
| 21 | 243385 | const std::string& Label() const { | |
| 22 | 243385 | return m_label; | |
| 23 | } | ||
| 24 | |||
| 25 | protected: | ||
| 26 | Resource(Device& device, std::string label); | ||
| 27 | |||
| 28 | private: | ||
| 29 | friend class Device; | ||
| 30 | |||
| 31 | void LastReleased() noexcept override; | ||
| 32 | |||
| 33 | Device* m_device; | ||
| 34 | std::string m_label; | ||
| 35 | bool m_holdsDevice = true; | ||
| 36 | }; | ||
| 37 | |||
| 38 | } | ||
| 39 |