From d262bebd90907bbcb45ed2d62d8a95cf832e8ca8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 12 Feb 2022 17:02:19 +0100 Subject: [PATCH] [dxvk] Remove DxvkStagingDataAlloc Unused and overly clunky. --- src/dxvk/dxvk_staging.cpp | 65 --------------------------------------- src/dxvk/dxvk_staging.h | 45 --------------------------- 2 files changed, 110 deletions(-) diff --git a/src/dxvk/dxvk_staging.cpp b/src/dxvk/dxvk_staging.cpp index 6882861f..786b4adf 100644 --- a/src/dxvk/dxvk_staging.cpp +++ b/src/dxvk/dxvk_staging.cpp @@ -3,71 +3,6 @@ namespace dxvk { - DxvkStagingDataAlloc::DxvkStagingDataAlloc(const Rc& device) - : m_device(device) { - - } - - - DxvkStagingDataAlloc::~DxvkStagingDataAlloc() { - - } - - - DxvkBufferSlice DxvkStagingDataAlloc::alloc(VkDeviceSize align, VkDeviceSize size) { - if (size > MaxBufferSize) - return DxvkBufferSlice(createBuffer(size)); - - if (m_buffer == nullptr) - m_buffer = createBuffer(MaxBufferSize); - - if (!m_buffer->isInUse()) - m_offset = 0; - - m_offset = dxvk::align(m_offset, align); - - if (m_offset + size > MaxBufferSize) { - m_offset = 0; - - if (m_buffers.size() < MaxBufferCount) - m_buffers.push(std::move(m_buffer)); - - if (!m_buffers.front()->isInUse()) { - m_buffer = std::move(m_buffers.front()); - m_buffers.pop(); - } else { - m_buffer = createBuffer(MaxBufferSize); - } - } - - DxvkBufferSlice slice(m_buffer, m_offset, size); - m_offset = dxvk::align(m_offset + size, align); - return slice; - } - - - void DxvkStagingDataAlloc::trim() { - m_buffer = nullptr; - m_offset = 0; - - while (!m_buffers.empty()) - m_buffers.pop(); - } - - - Rc DxvkStagingDataAlloc::createBuffer(VkDeviceSize size) { - DxvkBufferCreateInfo info; - info.size = size; - info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; - info.stages = VK_PIPELINE_STAGE_TRANSFER_BIT; - info.access = VK_ACCESS_TRANSFER_READ_BIT; - - return m_device->createBuffer(info, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); - } - - DxvkStagingBuffer::DxvkStagingBuffer( const Rc& device, VkDeviceSize size) diff --git a/src/dxvk/dxvk_staging.h b/src/dxvk/dxvk_staging.h index b2a591ac..b2346fe3 100644 --- a/src/dxvk/dxvk_staging.h +++ b/src/dxvk/dxvk_staging.h @@ -8,51 +8,6 @@ namespace dxvk { class DxvkDevice; - /** - * \brief Staging data allocator - * - * Allocates buffer slices for resource uploads, - * while trying to keep the number of allocations - * but also the amount of allocated memory low. - */ - class DxvkStagingDataAlloc { - constexpr static VkDeviceSize MaxBufferSize = 1 << 25; // 32 MiB - constexpr static uint32_t MaxBufferCount = 2; - public: - - DxvkStagingDataAlloc(const Rc& device); - - ~DxvkStagingDataAlloc(); - - /** - * \brief Alloctaes a staging buffer slice - * - * \param [in] align Alignment of the allocation - * \param [in] size Size of the allocation - * \returns Staging buffer slice - */ - DxvkBufferSlice alloc(VkDeviceSize align, VkDeviceSize size); - - /** - * \brief Deletes all staging buffers - * - * Destroys allocated buffers and - * releases all buffer memory. - */ - void trim(); - - private: - - Rc m_device; - Rc m_buffer; - VkDeviceSize m_offset = 0; - - std::queue> m_buffers; - - Rc createBuffer(VkDeviceSize size); - - }; - /** * \brief Staging buffer *