From b01698775b468a04e4d0a9bdd86035ff00e6decb Mon Sep 17 00:00:00 2001 From: liamwhite Date: Thu, 2 Feb 2023 15:53:28 -0500 Subject: Revert "hle_ipc: Use std::span to avoid heap allocations/copies when calling ReadBuffer" --- src/core/hle/kernel/hle_ipc.cpp | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/core/hle/kernel/hle_ipc.cpp') diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 494151eef..738b6d0f1 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -11,7 +11,6 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" -#include "common/scratch_buffer.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/k_auto_object.h" @@ -326,7 +325,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa return ResultSuccess; } -std::vector HLERequestContext::ReadBufferCopy(std::size_t buffer_index) const { +std::vector HLERequestContext::ReadBuffer(std::size_t buffer_index) const { const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && BufferDescriptorA()[buffer_index].Size()}; if (is_buffer_a) { @@ -346,33 +345,6 @@ std::vector HLERequestContext::ReadBufferCopy(std::size_t buffer_index) cons } } -std::span HLERequestContext::ReadBuffer(std::size_t buffer_index) const { - static thread_local std::array, 2> read_buffer_a; - static thread_local std::array, 2> read_buffer_x; - - const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && - BufferDescriptorA()[buffer_index].Size()}; - if (is_buffer_a) { - ASSERT_OR_EXECUTE_MSG( - BufferDescriptorA().size() > buffer_index, { return {}; }, - "BufferDescriptorA invalid buffer_index {}", buffer_index); - auto& read_buffer = read_buffer_a[buffer_index]; - read_buffer.resize_destructive(BufferDescriptorA()[buffer_index].Size()); - memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), read_buffer.data(), - read_buffer.size()); - return read_buffer; - } else { - ASSERT_OR_EXECUTE_MSG( - BufferDescriptorX().size() > buffer_index, { return {}; }, - "BufferDescriptorX invalid buffer_index {}", buffer_index); - auto& read_buffer = read_buffer_x[buffer_index]; - read_buffer.resize_destructive(BufferDescriptorX()[buffer_index].Size()); - memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), read_buffer.data(), - read_buffer.size()); - return read_buffer; - } -} - std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, std::size_t buffer_index) const { if (size == 0) { -- cgit v1.2.3