summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-08-05 22:56:46 +0200
committerGitHub <noreply@github.com>2020-08-05 22:56:46 +0200
commit61678c4e9fefb32624c5c2c261f4b152f9b133fb (patch)
tree731977645192bf0cc166bd3bc933619e101319e4 /src/core/hle
parentMerge pull request #4479 from lioncash/concepts (diff)
parentbuffer_queue: Make use of std::nullopt (diff)
downloadyuzu-61678c4e9fefb32624c5c2c261f4b152f9b133fb.tar
yuzu-61678c4e9fefb32624c5c2c261f4b152f9b133fb.tar.gz
yuzu-61678c4e9fefb32624c5c2c261f4b152f9b133fb.tar.bz2
yuzu-61678c4e9fefb32624c5c2c261f4b152f9b133fb.tar.lz
yuzu-61678c4e9fefb32624c5c2c261f4b152f9b133fb.tar.xz
yuzu-61678c4e9fefb32624c5c2c261f4b152f9b133fb.tar.zst
yuzu-61678c4e9fefb32624c5c2c261f4b152f9b133fb.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index caca80dde..637b310d7 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -24,13 +24,13 @@ BufferQueue::~BufferQueue() = default;
void BufferQueue::SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer) {
LOG_WARNING(Service, "Adding graphics buffer {}", slot);
- Buffer buffer{};
- buffer.slot = slot;
- buffer.igbp_buffer = igbp_buffer;
- buffer.status = Buffer::Status::Free;
free_buffers.push_back(slot);
+ queue.push_back({
+ .slot = slot,
+ .status = Buffer::Status::Free,
+ .igbp_buffer = igbp_buffer,
+ });
- queue.emplace_back(buffer);
buffer_wait_event.writable->Signal();
}
@@ -38,7 +38,7 @@ std::optional<std::pair<u32, Service::Nvidia::MultiFence*>> BufferQueue::Dequeue
u32 height) {
if (free_buffers.empty()) {
- return {};
+ return std::nullopt;
}
auto f_itr = free_buffers.begin();
@@ -69,7 +69,7 @@ std::optional<std::pair<u32, Service::Nvidia::MultiFence*>> BufferQueue::Dequeue
}
if (itr == queue.end()) {
- return {};
+ return std::nullopt;
}
itr->status = Buffer::Status::Dequeued;
@@ -103,14 +103,15 @@ std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::Ac
auto itr = queue.end();
// Iterate to find a queued buffer matching the requested slot.
while (itr == queue.end() && !queue_sequence.empty()) {
- u32 slot = queue_sequence.front();
+ const u32 slot = queue_sequence.front();
itr = std::find_if(queue.begin(), queue.end(), [&slot](const Buffer& buffer) {
return buffer.status == Buffer::Status::Queued && buffer.slot == slot;
});
queue_sequence.pop_front();
}
- if (itr == queue.end())
- return {};
+ if (itr == queue.end()) {
+ return std::nullopt;
+ }
itr->status = Buffer::Status::Acquired;
return *itr;
}