diff options
Diffstat (limited to 'src/core/hle/service/vi/layer')
-rw-r--r-- | src/core/hle/service/vi/layer/vi_layer.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/service/vi/layer/vi_layer.h | 31 |
2 files changed, 35 insertions, 2 deletions
diff --git a/src/core/hle/service/vi/layer/vi_layer.cpp b/src/core/hle/service/vi/layer/vi_layer.cpp index 3a83e5b95..48f4c57cb 100644 --- a/src/core/hle/service/vi/layer/vi_layer.cpp +++ b/src/core/hle/service/vi/layer/vi_layer.cpp @@ -2,12 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/assert.h" #include "core/hle/service/vi/layer/vi_layer.h" namespace Service::VI { Layer::Layer(u64 id, std::shared_ptr<NVFlinger::BufferQueue> queue) - : id{id}, buffer_queue{std::move(queue)} {} + : id{id}, buffer_queue{std::move(queue)} +{ + ASSERT_MSG(buffer_queue != nullptr, "buffer_queue may not be null."); +} Layer::~Layer() = default; diff --git a/src/core/hle/service/vi/layer/vi_layer.h b/src/core/hle/service/vi/layer/vi_layer.h index df328e09f..dd4f7e596 100644 --- a/src/core/hle/service/vi/layer/vi_layer.h +++ b/src/core/hle/service/vi/layer/vi_layer.h @@ -14,10 +14,39 @@ class BufferQueue; namespace Service::VI { -struct Layer { +/// Represents a single display layer. +class Layer { +public: + /// Constructs a layer with a given ID and buffer queue. + /// + /// @param id The ID to assign to this layer. + /// @param queue The buffer queue for this layer to use. + /// Layer(u64 id, std::shared_ptr<NVFlinger::BufferQueue> queue); ~Layer(); + Layer(const Layer&) = delete; + Layer& operator=(const Layer&) = delete; + + Layer(Layer&&) = default; + Layer& operator=(Layer&&) = default; + + /// Gets the ID for this layer. + u64 GetID() const { + return id; + } + + /// Gets a reference to the buffer queue this layer is using. + NVFlinger::BufferQueue& GetBufferQueue() { + return *buffer_queue; + } + + /// Gets a const reference to the buffer queue this layer is using. + const NVFlinger::BufferQueue& GetBufferQueue() const { + return *buffer_queue; + } + +private: u64 id; std::shared_ptr<NVFlinger::BufferQueue> buffer_queue; }; |