yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

hle: nvflinger: BufferQueueProducer: Handle SetPreallocatedBuffer with empty buffer.

- Used by Naruto Ultimate Ninja Storm.
This commit is contained in:
bunnei 2021-11-12 23:54:18 -08:00
parent 7f4165fc05
commit 5849c9a4cd
1 changed files with 10 additions and 7 deletions

View File

@ -793,8 +793,6 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
const std::shared_ptr<GraphicBuffer>& buffer) { const std::shared_ptr<GraphicBuffer>& buffer) {
LOG_DEBUG(Service_NVFlinger, "slot {}", slot); LOG_DEBUG(Service_NVFlinger, "slot {}", slot);
UNIMPLEMENTED_IF_MSG(!buffer, "buffer must be valid!");
if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
return Status::BadValue; return Status::BadValue;
} }
@ -802,13 +800,18 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
BufferQueueCore::AutoLock lock(core); BufferQueueCore::AutoLock lock(core);
slots[slot] = {}; slots[slot] = {};
slots[slot].is_preallocated = true;
slots[slot].graphic_buffer = buffer; slots[slot].graphic_buffer = buffer;
core->override_max_buffer_count = core->GetPreallocatedBufferCountLocked(); // Most games preallocate a buffer and pass a valid buffer here. However, it is possible for
core->default_width = buffer->Width(); // this to be called with an empty buffer, Naruto Ultimate Ninja Storm is a game that does this.
core->default_height = buffer->Height(); if (buffer) {
core->default_buffer_format = buffer->Format(); slots[slot].is_preallocated = true;
core->override_max_buffer_count = core->GetPreallocatedBufferCountLocked();
core->default_width = buffer->Width();
core->default_height = buffer->Height();
core->default_buffer_format = buffer->Format();
}
core->SignalDequeueCondition(); core->SignalDequeueCondition();
buffer_wait_event->GetWritableEvent().Signal(); buffer_wait_event->GetWritableEvent().Signal();