mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-14 18:37:27 +00:00
rsx: Implement deferred request size io buffer where we do not know the size beforehand.
This commit is contained in:
parent
406a519400
commit
96793193b5
@ -22,7 +22,8 @@ namespace rsx
|
||||
mutable void* m_ptr = nullptr;
|
||||
mutable usz m_size = 0;
|
||||
|
||||
std::function<std::tuple<void*, usz>()> m_allocator{};
|
||||
std::function<std::tuple<void*, usz>(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<std::tuple<void*, usz> ()> allocator)
|
||||
io_buffer(std::function<std::tuple<void*, usz>(usz)> allocator)
|
||||
{
|
||||
ensure(allocator);
|
||||
m_allocator = allocator;
|
||||
@ -50,6 +51,11 @@ namespace rsx
|
||||
: m_ptr(const_cast<void*>(ptr)), m_size(size)
|
||||
{}
|
||||
|
||||
void reserve(usz size) const
|
||||
{
|
||||
m_allocation_size = size;
|
||||
}
|
||||
|
||||
std::pair<void*, usz> 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<T*>(m_ptr);
|
||||
|
@ -1014,7 +1014,7 @@ namespace vk
|
||||
check_caps = false;
|
||||
}
|
||||
|
||||
auto buf_allocator = [&]() -> std::tuple<void*, usz>
|
||||
auto buf_allocator = [&](usz) -> std::tuple<void*, usz>
|
||||
{
|
||||
if (image_setup_flags & source_is_gpu_resident)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user