1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 04:24:11 +01:00

[dxvk] Add method to explicitly release staging buffer memory

This commit is contained in:
Philip Rebohle 2019-06-21 16:28:46 +02:00
parent 1c9bc235d0
commit 34cdba1df5
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 31 additions and 0 deletions

View File

@ -2284,6 +2284,11 @@ namespace dxvk {
void DxvkContext::writeTimestamp(const Rc<DxvkGpuQuery>& query) {
m_queryManager.writeTimestamp(m_cmd, query);
}
void DxvkContext::trimStagingBuffers() {
m_staging.trim();
}
void DxvkContext::clearImageViewFb(

View File

@ -954,6 +954,15 @@ namespace dxvk {
void writeTimestamp(
const Rc<DxvkGpuQuery>& query);
/**
* \brief Trims staging buffers
*
* Releases staging buffer resources. Calling
* this may be useful if data updates on a
* given context are rare.
*/
void trimStagingBuffers();
private:
const Rc<DxvkDevice> m_device;

View File

@ -46,6 +46,15 @@ namespace dxvk {
}
void DxvkStagingDataAlloc::trim() {
m_buffer = nullptr;
m_offset = 0;
while (!m_buffers.empty())
m_buffers.pop();
}
Rc<DxvkBuffer> DxvkStagingDataAlloc::createBuffer(VkDeviceSize size) {
DxvkBufferCreateInfo info;
info.size = size;

View File

@ -33,6 +33,14 @@ namespace dxvk {
*/
DxvkBufferSlice alloc(VkDeviceSize align, VkDeviceSize size);
/**
* \brief Deletes all staging buffers
*
* Destroys allocated buffers and
* releases all buffer memory.
*/
void trim();
private:
Rc<DxvkDevice> m_device;