mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-21 22:54:16 +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
|
* unformatted data. Can be accessed by the host
|
||||||
* if allocated on an appropriate memory type.
|
* if allocated on an appropriate memory type.
|
||||||
*/
|
*/
|
||||||
class DxvkBuffer : public DxvkResource {
|
class DxvkBuffer : public DxvkPagedResource {
|
||||||
friend class DxvkBufferView;
|
friend class DxvkBufferView;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -294,16 +294,6 @@ namespace dxvk {
|
|||||||
m_nextSlices.push_back(slice);
|
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:
|
private:
|
||||||
|
|
||||||
DxvkDevice* m_device;
|
DxvkDevice* m_device;
|
||||||
@ -316,8 +306,6 @@ namespace dxvk {
|
|||||||
DxvkBufferSliceHandle m_physSlice;
|
DxvkBufferSliceHandle m_physSlice;
|
||||||
uint32_t m_vertexStride = 0;
|
uint32_t m_vertexStride = 0;
|
||||||
|
|
||||||
DxvkSparsePageTable m_sparsePageTable;
|
|
||||||
|
|
||||||
alignas(CACHE_LINE_SIZE)
|
alignas(CACHE_LINE_SIZE)
|
||||||
sync::Spinlock m_freeMutex;
|
sync::Spinlock m_freeMutex;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ namespace dxvk {
|
|||||||
* Can be accessed by the host if allocated on a suitable
|
* Can be accessed by the host if allocated on a suitable
|
||||||
* memory type and if created with the linear tiling option.
|
* memory type and if created with the linear tiling option.
|
||||||
*/
|
*/
|
||||||
class DxvkImage : public DxvkResource {
|
class DxvkImage : public DxvkPagedResource {
|
||||||
friend class DxvkContext;
|
friend class DxvkContext;
|
||||||
friend class DxvkImageView;
|
friend class DxvkImageView;
|
||||||
public:
|
public:
|
||||||
@ -324,16 +324,6 @@ namespace dxvk {
|
|||||||
return result;
|
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
|
* \brief Create a new shared handle to dedicated memory backing the image
|
||||||
* \returns The shared handle with the type given by DxvkSharedHandleInfo::type
|
* \returns The shared handle with the type given by DxvkSharedHandleInfo::type
|
||||||
@ -347,7 +337,6 @@ namespace dxvk {
|
|||||||
DxvkImageCreateInfo m_info;
|
DxvkImageCreateInfo m_info;
|
||||||
VkMemoryPropertyFlags m_memFlags;
|
VkMemoryPropertyFlags m_memFlags;
|
||||||
DxvkPhysicalImage m_image;
|
DxvkPhysicalImage m_image;
|
||||||
DxvkSparsePageTable m_sparsePageTable;
|
|
||||||
|
|
||||||
bool m_shared = false;
|
bool m_shared = false;
|
||||||
|
|
||||||
|
@ -132,6 +132,14 @@ namespace dxvk {
|
|||||||
DxvkDevice* device,
|
DxvkDevice* device,
|
||||||
const DxvkImage* image);
|
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
|
* \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