diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 98fa0266f2..f8b10e4971 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -872,11 +872,14 @@ void D3D12GSRender::Flip() ResourceStorage &newStorage = getCurrentResourceStorage(); newStorage.WaitAndClean(); - m_constantsData.m_getPos.store(newStorage.m_getPosConstantsHeap, std::memory_order_release); - m_vertexIndexData.m_getPos.store(newStorage.m_getPosVertexIndexHeap, std::memory_order_release); - m_textureUploadData.m_getPos.store(newStorage.m_getPosTextureUploadHeap, std::memory_order_release); - m_readbackResources.m_getPos.store(newStorage.m_getPosReadbackHeap, std::memory_order_release); - m_UAVHeap.m_getPos.store(newStorage.m_getPosUAVHeap, std::memory_order_release); + if (newStorage.m_inUse) + { + m_constantsData.m_getPos = newStorage.m_getPosConstantsHeap; + m_vertexIndexData.m_getPos = newStorage.m_getPosVertexIndexHeap; + m_textureUploadData.m_getPos = newStorage.m_getPosTextureUploadHeap; + m_readbackResources.m_getPos = newStorage.m_getPosReadbackHeap; + m_UAVHeap.m_getPos = newStorage.m_getPosUAVHeap; + } m_frame->Flip(nullptr); diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h index b14b7c3239..f0a11c1d14 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h @@ -119,14 +119,14 @@ struct DataHeap T *m_heap; size_t m_size; size_t m_putPos; // Start of free space - std::atomic m_getPos; // End of free space + size_t m_getPos; // End of free space void Init(ID3D12Device *device, size_t heapSize, D3D12_HEAP_TYPE type, D3D12_HEAP_FLAGS flags) { m_size = heapSize; m_heap = InitHeap::Init(device, heapSize, type, flags); m_putPos = 0; - m_getPos = m_size - 1; + m_getPos = heapSize - 1; } /** @@ -135,7 +135,7 @@ struct DataHeap bool canAlloc(size_t size) const { size_t allocSize = align(size, Alignment); - size_t currentGetPos = m_getPos.load(); + size_t currentGetPos = m_getPos; if (m_putPos + allocSize < m_size) { // range before get