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

[dxvk] Fix race condition in relocation check

The storage pointer is not safe to dereference outside the CS thread
for relocatable resources since the storage object may change.
This commit is contained in:
Philip Rebohle 2024-10-18 01:27:10 +02:00 committed by Philip Rebohle
parent 3a1de271cb
commit a3c8c88222
2 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,8 @@ namespace dxvk {
m_properties (memFlags),
m_shaderStages (util::shaderStages(createInfo.stages)),
m_sharingMode (device->getSharingMode()),
m_info (createInfo) {
m_info (createInfo),
m_stableAddress (true) {
m_allocator->registerResource(this);
DxvkAllocationInfo allocationInfo = { };
@ -58,7 +59,6 @@ namespace dxvk {
bool DxvkBuffer::canRelocate() const {
return !m_bufferInfo.mapPtr && !m_stableAddress
&& !m_storage->flags().test(DxvkAllocationFlag::Imported)
&& !(m_info.flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT);
}

View File

@ -45,7 +45,8 @@ namespace dxvk {
m_allocator (&memAlloc),
m_properties (memFlags),
m_shaderStages (util::shaderStages(createInfo.stages)),
m_info (createInfo) {
m_info (createInfo),
m_stableAddress (true) {
m_allocator->registerResource(this);
copyFormatList(createInfo.viewFormatCount, createInfo.viewFormats);
@ -66,7 +67,6 @@ namespace dxvk {
bool DxvkImage::canRelocate() const {
return !m_imageInfo.mapPtr && !m_shared && !m_stableAddress
&& !m_storage->flags().test(DxvkAllocationFlag::Imported)
&& !(m_info.flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT);
}