From 8652edb07b24370965bc01828a3b8174d37ee233 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Mon, 6 Dec 2021 23:25:13 +0530 Subject: [PATCH] Make `GuestBuffer` format-less Buffers generally don't have formats that are fundamentally associated with them unless they're texel buffers, if that is the case it can be manually set in `BufferView`. --- app/src/main/cpp/skyline/gpu/buffer.h | 3 +-- app/src/main/cpp/skyline/gpu/buffer_manager.cpp | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/buffer.h b/app/src/main/cpp/skyline/gpu/buffer.h index 9008229c..5f9fdf95 100644 --- a/app/src/main/cpp/skyline/gpu/buffer.h +++ b/app/src/main/cpp/skyline/gpu/buffer.h @@ -12,7 +12,6 @@ namespace skyline::gpu { struct GuestBuffer { using Mappings = boost::container::small_vector, 3>; Mappings mappings; //!< Spans to CPU memory for the underlying data backing this buffer - vk::Format format; /** * @return The total size of the buffer by adding up the size of all mappings @@ -107,7 +106,7 @@ namespace skyline::gpu { /** * @return A cached or newly created view into this buffer with the supplied attributes */ - std::shared_ptr GetView(vk::DeviceSize offset, vk::DeviceSize range, vk::Format format); + std::shared_ptr GetView(vk::DeviceSize offset, vk::DeviceSize range, vk::Format format = {}); }; /** diff --git a/app/src/main/cpp/skyline/gpu/buffer_manager.cpp b/app/src/main/cpp/skyline/gpu/buffer_manager.cpp index ca583f1d..147f0824 100644 --- a/app/src/main/cpp/skyline/gpu/buffer_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/buffer_manager.cpp @@ -43,11 +43,11 @@ namespace skyline::gpu { if (firstHostMapping == hostMappings.begin() && firstHostMapping->begin() == guestMapping.begin() && mappingMatch && endHostMapping == hostMappings.end() && lastGuestMapping.end() == lastHostMapping.end()) { // We've gotten a perfect 1:1 match for *all* mappings from the start to end std::scoped_lock bufferLock(*hostMapping->buffer); - return hostMapping->buffer->GetView(0, hostMapping->buffer->size, guest.format); + return hostMapping->buffer->GetView(0, hostMapping->buffer->size); } else if (mappingMatch && firstHostMapping->begin() > guestMapping.begin() && lastHostMapping.end() > lastGuestMapping.end()) { // We've gotten a guest buffer that is located entirely within a host buffer std::scoped_lock bufferLock(*hostMapping->buffer); - return hostMapping->buffer->GetView(hostMapping->offset + static_cast(hostMapping->begin() - guestMapping.begin()), guest.BufferSize(), guest.format); + return hostMapping->buffer->GetView(hostMapping->offset + static_cast(hostMapping->begin() - guestMapping.begin()), guest.BufferSize()); } } } @@ -103,6 +103,6 @@ namespace skyline::gpu { offset += mapping->size_bytes(); } - return buffer->GetView(0, buffer->size, guest.format); + return buffer->GetView(0, buffer->size); } }