mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-30 16:47:06 +02:00
[buffer_cache] guards against synchronizebuffer causing unmapped readblock due to rasterizers using writememory for unmap
This commit is contained in:
parent
ea190464f1
commit
d266e5b8b3
4 changed files with 13 additions and 2 deletions
|
|
@ -121,6 +121,15 @@ void BufferCache<P>::WriteMemory(DAddr device_addr, u64 size) {
|
||||||
memory_tracker.MarkRegionAsCpuModified(device_addr, size);
|
memory_tracker.MarkRegionAsCpuModified(device_addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class P>
|
||||||
|
void BufferCache<P>::UnmapMemory(DAddr device_addr, u64 size) {
|
||||||
|
if (memory_tracker.IsRegionGpuModified(device_addr, size)) {
|
||||||
|
ClearDownload(device_addr, size);
|
||||||
|
gpu_modified_ranges.Subtract(device_addr, size);
|
||||||
|
}
|
||||||
|
memory_tracker.UnmarkRegionAsCpuModified(device_addr, size);
|
||||||
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
void BufferCache<P>::CachedWriteMemory(DAddr device_addr, u64 size) {
|
void BufferCache<P>::CachedWriteMemory(DAddr device_addr, u64 size) {
|
||||||
const bool is_dirty = IsRegionRegistered(device_addr, size);
|
const bool is_dirty = IsRegionRegistered(device_addr, size);
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,8 @@ public:
|
||||||
|
|
||||||
void WriteMemory(DAddr device_addr, u64 size);
|
void WriteMemory(DAddr device_addr, u64 size);
|
||||||
|
|
||||||
|
void UnmapMemory(DAddr device_addr, u64 size);
|
||||||
|
|
||||||
void CachedWriteMemory(DAddr device_addr, u64 size);
|
void CachedWriteMemory(DAddr device_addr, u64 size);
|
||||||
|
|
||||||
bool OnCPUWrite(DAddr device_addr, u64 size);
|
bool OnCPUWrite(DAddr device_addr, u64 size);
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,7 @@ void RasterizerOpenGL::UnmapMemory(DAddr addr, u64 size) {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
buffer_cache.WriteMemory(addr, size);
|
buffer_cache.UnmapMemory(addr, size);
|
||||||
}
|
}
|
||||||
shader_cache.OnCacheInvalidation(addr, size);
|
shader_cache.OnCacheInvalidation(addr, size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -758,7 +758,7 @@ void RasterizerVulkan::UnmapMemory(DAddr addr, u64 size) {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
buffer_cache.WriteMemory(addr, size);
|
buffer_cache.UnmapMemory(addr, size);
|
||||||
}
|
}
|
||||||
pipeline_cache.OnCacheInvalidation(addr, size);
|
pipeline_cache.OnCacheInvalidation(addr, size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue