mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Introduce DxvkPagedResource
This commit is contained in:
parent
2d124b811b
commit
dd54de4d97
@ -103,7 +103,7 @@ namespace dxvk {
|
||||
* unformatted data. Can be accessed by the host
|
||||
* if allocated on an appropriate memory type.
|
||||
*/
|
||||
class DxvkBuffer : public DxvkResource {
|
||||
class DxvkBuffer : public DxvkPagedResource {
|
||||
friend class DxvkBufferView;
|
||||
public:
|
||||
|
||||
@ -294,16 +294,6 @@ namespace dxvk {
|
||||
m_nextSlices.push_back(slice);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Queries sparse page table
|
||||
* \returns Page table, or \c nullptr for a non-sparse resource
|
||||
*/
|
||||
DxvkSparsePageTable* getSparsePageTable() {
|
||||
return m_info.flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT
|
||||
? &m_sparsePageTable
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
DxvkDevice* m_device;
|
||||
@ -316,8 +306,6 @@ namespace dxvk {
|
||||
DxvkBufferSliceHandle m_physSlice;
|
||||
uint32_t m_vertexStride = 0;
|
||||
|
||||
DxvkSparsePageTable m_sparsePageTable;
|
||||
|
||||
alignas(CACHE_LINE_SIZE)
|
||||
sync::Spinlock m_freeMutex;
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace dxvk {
|
||||
* Can be accessed by the host if allocated on a suitable
|
||||
* memory type and if created with the linear tiling option.
|
||||
*/
|
||||
class DxvkImage : public DxvkResource {
|
||||
class DxvkImage : public DxvkPagedResource {
|
||||
friend class DxvkContext;
|
||||
friend class DxvkImageView;
|
||||
public:
|
||||
@ -324,16 +324,6 @@ namespace dxvk {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Queries sparse page table
|
||||
* \returns Page table, or \c nullptr for a non-sparse resource
|
||||
*/
|
||||
DxvkSparsePageTable* getSparsePageTable() {
|
||||
return m_info.flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT
|
||||
? &m_sparsePageTable
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Create a new shared handle to dedicated memory backing the image
|
||||
* \returns The shared handle with the type given by DxvkSharedHandleInfo::type
|
||||
@ -347,7 +337,6 @@ namespace dxvk {
|
||||
DxvkImageCreateInfo m_info;
|
||||
VkMemoryPropertyFlags m_memFlags;
|
||||
DxvkPhysicalImage m_image;
|
||||
DxvkSparsePageTable m_sparsePageTable;
|
||||
|
||||
bool m_shared = false;
|
||||
|
||||
|
@ -132,6 +132,14 @@ namespace dxvk {
|
||||
DxvkDevice* device,
|
||||
const DxvkImage* image);
|
||||
|
||||
/**
|
||||
* \brief Checks whether page table is defined
|
||||
* \returns \c true if the page table is defined
|
||||
*/
|
||||
operator bool () const {
|
||||
return m_buffer || m_image;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Counts total number of pages in the resources
|
||||
*
|
||||
@ -197,4 +205,31 @@ namespace dxvk {
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Paged resource
|
||||
*
|
||||
* Base class for any resource that can
|
||||
* hold a sparse page table.
|
||||
*/
|
||||
class DxvkPagedResource : public DxvkResource {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* \brief Queries sparse page table
|
||||
* \returns Sparse page table, if defined
|
||||
*/
|
||||
DxvkSparsePageTable* getSparsePageTable() {
|
||||
return m_sparsePageTable
|
||||
? &m_sparsePageTable
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
DxvkSparsePageTable m_sparsePageTable;
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user