1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[dxvk] Remove legacy buffer renaming interface

This commit is contained in:
Philip Rebohle 2024-09-22 12:32:43 +02:00 committed by Philip Rebohle
parent 6f6e75b4b8
commit 4064c89e8c
4 changed files with 19 additions and 53 deletions

View File

@ -289,20 +289,6 @@ namespace dxvk {
return result;
}
/**
* \brief Replaces backing resource
*
* Replaces the underlying buffer and implicitly marks
* any buffer views using this resource as dirty. Do
* not call this directly as this is called implicitly
* by the context's \c invalidateBuffer method.
* \param [in] slice The new backing resource
* \returns Previous buffer slice
*/
DxvkBufferSliceHandle rename(const DxvkBufferSliceHandle& slice) {
return std::exchange(m_physSlice, slice);
}
/**
* \brief Transform feedback vertex stride
*
@ -329,7 +315,7 @@ namespace dxvk {
* \brief Allocates new buffer slice
* \returns The new buffer slice
*/
DxvkBufferSliceHandle allocSlice() {
DxvkBufferAllocation allocateSlice() {
std::unique_lock<sync::Spinlock> freeLock(m_freeMutex);
// If no slices are available, swap the two free lists.
@ -360,28 +346,26 @@ namespace dxvk {
}
// Take the first slice from the queue
DxvkBufferSliceHandle result = m_freeSlices.back();
DxvkBufferAllocation result(m_freeSlices.back());
m_freeSlices.pop_back();
return result;
}
/**
* \brief Allocates a new buffer slice
* \returns New buffer slice
*/
DxvkBufferAllocation allocateSlice() {
return DxvkBufferAllocation(allocSlice());
}
/**
* \brief Replaces backing storage
*
* Implicitly invalidates all views created for the buffer.
* \param [in] slice New buffer slice
* \returns Previous buffer allocation for lifetime tracking.
* \brief Replaces backing resource
*
* Replaces the underlying buffer and implicitly marks
* any buffer views using this resource as dirty. Do
* not call this directly as this is called implicitly
* by the context's \c invalidateBuffer method.
* \param [in] slice The new backing resource
* \returns Previous buffer slice
*/
DxvkBufferAllocation assignSlice(DxvkBufferAllocation&& slice) {
return DxvkBufferAllocation(rename(slice.m_slice));
DxvkBufferAllocation result(m_physSlice);
m_physSlice = slice.m_slice;
slice.m_slice = DxvkBufferSliceHandle();
return result;
}
/**
@ -403,7 +387,7 @@ namespace dxvk {
void freeSlice(const DxvkBufferSliceHandle& slice) {
// Add slice to a separate free list to reduce lock contention.
std::unique_lock<sync::Spinlock> swapLock(m_swapMutex);
m_nextSlices.push_back(slice);
m_nextSlices.emplace_back(slice);
}
/**
@ -438,11 +422,11 @@ namespace dxvk {
VkDeviceSize m_maxAllocationSize = 0;
std::vector<DxvkBufferHandle> m_buffers;
std::vector<DxvkBufferSliceHandle> m_freeSlices;
std::vector<DxvkBufferAllocation> m_freeSlices;
alignas(CACHE_LINE_SIZE)
sync::Spinlock m_swapMutex;
std::vector<DxvkBufferSliceHandle> m_nextSlices;
std::vector<DxvkBufferAllocation> m_nextSlices;
void pushSlice(const DxvkBufferHandle& handle, uint32_t index) {
DxvkBufferSliceHandle slice;
@ -450,7 +434,7 @@ namespace dxvk {
slice.offset = handle.getBaseOffset() + m_physSliceStride * index;
slice.length = m_physSliceLength;
slice.mapPtr = handle.memory.mapPtr(m_physSliceStride * index);
m_freeSlices.push_back(slice);
m_freeSlices.emplace_back(slice);
}
DxvkBufferHandle allocBuffer(

View File

@ -1865,13 +1865,6 @@ namespace dxvk {
}
void DxvkContext::invalidateBuffer(
const Rc<DxvkBuffer>& buffer,
const DxvkBufferSliceHandle& slice) {
invalidateBuffer(buffer, DxvkBufferAllocation(slice));
}
void DxvkContext::resolveImage(
const Rc<DxvkImage>& dstImage,
const Rc<DxvkImage>& srcImage,

View File

@ -964,10 +964,6 @@ namespace dxvk {
void invalidateBuffer(
const Rc<DxvkBuffer>& buffer,
DxvkBufferAllocation&& slice);
void invalidateBuffer(
const Rc<DxvkBuffer>& buffer,
const DxvkBufferSliceHandle& slice);
/**
* \brief Updates push constants

View File

@ -1,17 +1,10 @@
#pragma once
#include "dxvk_include.h"
#include "dxvk_memory.h"
namespace dxvk {
enum class DxvkAccess : uint32_t {
Read = 0,
Write = 1,
None = 2,
};
using DxvkAccessFlags = Flags<DxvkAccess>;
/**
* \brief DXVK resource
*