1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[dxvk] Separated buffer renaming from allocation

This commit is contained in:
Philip Rebohle 2017-12-20 02:58:36 +01:00
parent 70e5314cc6
commit f68655feff
3 changed files with 23 additions and 7 deletions

View File

@ -47,13 +47,20 @@ namespace dxvk {
VkMemoryPropertyFlags memoryType) VkMemoryPropertyFlags memoryType)
: m_device (device), : m_device (device),
m_info (createInfo), m_info (createInfo),
m_memFlags(memoryType) { m_memFlags(memoryType),
this->allocateResource(); m_resource(allocateResource()) {
} }
void DxvkBuffer::allocateResource() { void DxvkBuffer::renameResource(
m_resource = m_device->allocBufferResource(m_info, m_memFlags); const Rc<DxvkBufferResource>& resource) {
m_resource = resource;
}
Rc<DxvkBufferResource> DxvkBuffer::allocateResource() {
return m_device->allocBufferResource(m_info, m_memFlags);
} }

View File

@ -149,14 +149,22 @@ namespace dxvk {
} }
/** /**
* \brief Allocates new backing resource * \brief Replaces backing resource
* *
* Replaces the underlying buffer and implicitly marks * Replaces the underlying buffer and implicitly marks
* any buffer views using this resource as dirty. Do * any buffer views using this resource as dirty. Do
* not call this directly as this is called implicitly * not call this directly as this is called implicitly
* by the context's \c invalidateBuffer method. * by the context's \c invalidateBuffer method.
* \param [in] resource The new backing resource
*/ */
void allocateResource(); void renameResource(
const Rc<DxvkBufferResource>& resource);
/**
* \brief Allocates new backing resource
* \returns The new buffer
*/
Rc<DxvkBufferResource> allocateResource();
private: private:

View File

@ -354,7 +354,8 @@ namespace dxvk {
void DxvkContext::invalidateBuffer(const Rc<DxvkBuffer>& buffer) { void DxvkContext::invalidateBuffer(const Rc<DxvkBuffer>& buffer) {
// Allocate new backing resource // Allocate new backing resource
buffer->allocateResource(); buffer->renameResource(
buffer->allocateResource());
// We also need to update all bindings that the buffer // We also need to update all bindings that the buffer
// may be bound to either directly or through views. // may be bound to either directly or through views.