mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
[dxvk] Separated buffer renaming from allocation
This commit is contained in:
parent
70e5314cc6
commit
f68655feff
@ -47,13 +47,20 @@ namespace dxvk {
|
||||
VkMemoryPropertyFlags memoryType)
|
||||
: m_device (device),
|
||||
m_info (createInfo),
|
||||
m_memFlags(memoryType) {
|
||||
this->allocateResource();
|
||||
m_memFlags(memoryType),
|
||||
m_resource(allocateResource()) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DxvkBuffer::allocateResource() {
|
||||
m_resource = m_device->allocBufferResource(m_info, m_memFlags);
|
||||
void DxvkBuffer::renameResource(
|
||||
const Rc<DxvkBufferResource>& resource) {
|
||||
m_resource = resource;
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkBufferResource> DxvkBuffer::allocateResource() {
|
||||
return m_device->allocBufferResource(m_info, m_memFlags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,14 +149,22 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Allocates new backing resource
|
||||
* \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] 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:
|
||||
|
||||
|
@ -354,7 +354,8 @@ namespace dxvk {
|
||||
|
||||
void DxvkContext::invalidateBuffer(const Rc<DxvkBuffer>& buffer) {
|
||||
// Allocate new backing resource
|
||||
buffer->allocateResource();
|
||||
buffer->renameResource(
|
||||
buffer->allocateResource());
|
||||
|
||||
// We also need to update all bindings that the buffer
|
||||
// may be bound to either directly or through views.
|
||||
|
Loading…
Reference in New Issue
Block a user