diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 4a05a00e..9e42b96f 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -3103,7 +3103,7 @@ namespace dxvk { template DxvkBufferSlice D3D11CommonContext::AllocStagingBuffer( VkDeviceSize Size) { - return m_staging.alloc(256, Size); + return m_staging.alloc(Size); } diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 1c40f455..cab43433 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -4513,7 +4513,7 @@ namespace dxvk { m_stagingBufferAllocated += size; D3D9BufferSlice result; - result.slice = m_stagingBuffer.alloc(256, size); + result.slice = m_stagingBuffer.alloc(size); result.mapPtr = result.slice.mapPtr(0); return result; } diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 805cfea5..3bd1d98a 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -2540,7 +2540,7 @@ namespace dxvk { const void* data) { auto bufferSlice = buffer->getSliceHandle(); - auto stagingSlice = m_staging.alloc(CACHE_LINE_SIZE, bufferSlice.length); + auto stagingSlice = m_staging.alloc(bufferSlice.length); auto stagingHandle = stagingSlice.getSliceHandle(); std::memcpy(stagingHandle.mapPtr, data, bufferSlice.length); @@ -3478,7 +3478,7 @@ namespace dxvk { } auto blockCount = util::computeBlockCount(extent, formatInfo->blockSize); - auto stagingSlice = m_staging.alloc(CACHE_LINE_SIZE, elementSize * util::flattenImageExtent(blockCount)); + auto stagingSlice = m_staging.alloc(elementSize * util::flattenImageExtent(blockCount)); auto stagingHandle = stagingSlice.getSliceHandle(); util::packImageData(stagingHandle.mapPtr, layerData, diff --git a/src/dxvk/dxvk_staging.cpp b/src/dxvk/dxvk_staging.cpp index 0daa725c..80b1b318 100644 --- a/src/dxvk/dxvk_staging.cpp +++ b/src/dxvk/dxvk_staging.cpp @@ -16,7 +16,7 @@ namespace dxvk { } - DxvkBufferSlice DxvkStagingBuffer::alloc(VkDeviceSize align, VkDeviceSize size) { + DxvkBufferSlice DxvkStagingBuffer::alloc(VkDeviceSize size) { DxvkBufferCreateInfo info; info.size = size; info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT @@ -28,15 +28,14 @@ namespace dxvk { info.access = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_SHADER_READ_BIT; - VkDeviceSize alignedSize = dxvk::align(size, align); - VkDeviceSize alignedOffset = dxvk::align(m_offset, align); + VkDeviceSize alignedSize = dxvk::align(size, 256u); if (2 * alignedSize > m_size) { return DxvkBufferSlice(m_device->createBuffer(info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)); } - if (alignedOffset + alignedSize > m_size || m_buffer == nullptr) { + if (m_offset + alignedSize > m_size || m_buffer == nullptr) { info.size = m_size; // Free resources first if possible, in some rare @@ -44,11 +43,11 @@ namespace dxvk { m_buffer = nullptr; m_buffer = m_device->createBuffer(info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); - alignedOffset = 0; + m_offset = 0; } - DxvkBufferSlice slice(m_buffer, alignedOffset, size); - m_offset = alignedOffset + alignedSize; + DxvkBufferSlice slice(m_buffer, m_offset, size); + m_offset += alignedSize; return slice; } diff --git a/src/dxvk/dxvk_staging.h b/src/dxvk/dxvk_staging.h index b2346fe3..670f3114 100644 --- a/src/dxvk/dxvk_staging.h +++ b/src/dxvk/dxvk_staging.h @@ -38,11 +38,10 @@ namespace dxvk { * * Tries to suballocate from existing buffer, * or creates a new buffer if necessary. - * \param [in] align Minimum alignment * \param [in] size Number of bytes to allocate * \returns Allocated slice */ - DxvkBufferSlice alloc(VkDeviceSize align, VkDeviceSize size); + DxvkBufferSlice alloc(VkDeviceSize size); /** * \brief Resets staging buffer and allocator