diff --git a/rpcs3/Emu/RSX/Common/io_buffer.h b/rpcs3/Emu/RSX/Common/io_buffer.h index 7029608f6e..612777f463 100644 --- a/rpcs3/Emu/RSX/Common/io_buffer.h +++ b/rpcs3/Emu/RSX/Common/io_buffer.h @@ -22,7 +22,8 @@ namespace rsx mutable void* m_ptr = nullptr; mutable usz m_size = 0; - std::function()> m_allocator{}; + std::function(usz)> m_allocator{}; + mutable usz m_allocation_size = 0u; public: io_buffer() = default; @@ -34,7 +35,7 @@ namespace rsx m_size = container.size_bytes(); } - io_buffer(std::function ()> allocator) + io_buffer(std::function(usz)> allocator) { ensure(allocator); m_allocator = allocator; @@ -50,6 +51,11 @@ namespace rsx : m_ptr(const_cast(ptr)), m_size(size) {} + void reserve(usz size) const + { + m_allocation_size = size; + } + std::pair raw() const { return { m_ptr, m_size }; @@ -60,7 +66,7 @@ namespace rsx { if (!m_ptr && m_allocator) { - std::tie(m_ptr, m_size) = m_allocator(); + std::tie(m_ptr, m_size) = m_allocator(m_allocation_size); } return static_cast(m_ptr); diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index 5262fabf79..3353dcf341 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -1014,7 +1014,7 @@ namespace vk check_caps = false; } - auto buf_allocator = [&]() -> std::tuple + auto buf_allocator = [&](usz) -> std::tuple { if (image_setup_flags & source_is_gpu_resident) {