Compare commits

..

1 Commits

Author SHA1 Message Date
xbzk ec16a6142e [video_core] Revert 4490 and 4531 2026-10-28 18:33:56 -03:00
6 changed files with 5 additions and 36 deletions
+1 -1
View File
@@ -757,7 +757,7 @@ struct Memory::Impl {
}; };
auto& gpu = system.GPU(); auto& gpu = system.GPU();
gpu_device_memory->ApplyOpOnPointer( gpu_device_memory->ApplyOpOnPointer(
p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size, true); }); p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size); });
} }
Core::System& system; Core::System& system;
+3 -15
View File
@@ -226,19 +226,7 @@ struct GPU::Impl {
} }
/// Notify rasterizer that any caches of the specified region should be invalidated /// Notify rasterizer that any caches of the specified region should be invalidated
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) { void InvalidateRegion(DAddr addr, u64 size) {
if (preserve_gpu_writes) {
VideoCore::RasterizerInterface* rasterizer = renderer->ReadRasterizer();
if (!rasterizer->TryCacheInvalidation(addr, size)) {
const u64 fence = RequestSyncOperation([rasterizer, addr, size] {
rasterizer->FlushRegion(addr, size, VideoCommon::CacheType::BufferCache);
rasterizer->OnCacheInvalidation(addr, size);
});
gpu_thread.TickGPU(is_async);
WaitForSyncOperation(fence);
}
return;
}
gpu_thread.InvalidateRegion(addr, size); gpu_thread.InvalidateRegion(addr, size);
} }
@@ -530,8 +518,8 @@ void GPU::FlushRegion(DAddr addr, u64 size) {
impl->FlushRegion(addr, size); impl->FlushRegion(addr, size);
} }
void GPU::InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) { void GPU::InvalidateRegion(DAddr addr, u64 size) {
impl->InvalidateRegion(addr, size, preserve_gpu_writes); impl->InvalidateRegion(addr, size);
} }
bool GPU::OnCPUWrite(DAddr addr, u64 size) { bool GPU::OnCPUWrite(DAddr addr, u64 size) {
+1 -1
View File
@@ -248,7 +248,7 @@ public:
void FlushRegion(DAddr addr, u64 size); void FlushRegion(DAddr addr, u64 size);
/// Notify rasterizer that any caches of the specified region should be invalidated /// Notify rasterizer that any caches of the specified region should be invalidated
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes = false); void InvalidateRegion(DAddr addr, u64 size);
/// Notify rasterizer that CPU is trying to write this area. It returns true if the area is /// Notify rasterizer that CPU is trying to write this area. It returns true if the area is
/// sensible, false otherwise, addr and size must be a valid combination /// sensible, false otherwise, addr and size must be a valid combination
-6
View File
@@ -114,12 +114,6 @@ public:
/// Notify rasterizer that any caches of the specified region are desync with guest /// Notify rasterizer that any caches of the specified region are desync with guest
virtual void OnCacheInvalidation(PAddr addr, u64 size) = 0; virtual void OnCacheInvalidation(PAddr addr, u64 size) = 0;
virtual bool TryCacheInvalidation(DAddr addr, u64 size) {
if (MustFlushRegion(addr, size, VideoCommon::CacheType::BufferCache)) return false;
OnCacheInvalidation(addr, size);
return true;
}
virtual bool OnCPUWrite(PAddr addr, u64 size) = 0; virtual bool OnCPUWrite(PAddr addr, u64 size) = 0;
/// Sync memory between guest and host. /// Sync memory between guest and host.
@@ -798,18 +798,6 @@ void RasterizerVulkan::OnCacheInvalidation(DAddr addr, u64 size) {
pipeline_cache.InvalidateRegion(addr, size); pipeline_cache.InvalidateRegion(addr, size);
} }
bool RasterizerVulkan::TryCacheInvalidation(DAddr addr, u64 size) {
if (addr == 0 || size == 0) return true;
{
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
if (buffer_cache.IsRegionGpuModified(addr, size)) return false;
texture_cache.WriteMemory(addr, size);
buffer_cache.WriteMemory(addr, size);
}
pipeline_cache.InvalidateRegion(addr, size);
return true;
}
void RasterizerVulkan::InvalidateGPUCache() { void RasterizerVulkan::InvalidateGPUCache() {
gpu.InvalidateGPUCache(); gpu.InvalidateGPUCache();
} }
@@ -106,7 +106,6 @@ public:
VideoCommon::CacheType which = VideoCommon::CacheType::All) override; VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
void InnerInvalidation(std::span<const std::pair<DAddr, std::size_t>> sequences) override; void InnerInvalidation(std::span<const std::pair<DAddr, std::size_t>> sequences) override;
void OnCacheInvalidation(DAddr addr, u64 size) override; void OnCacheInvalidation(DAddr addr, u64 size) override;
bool TryCacheInvalidation(DAddr addr, u64 size) override;
bool OnCPUWrite(DAddr addr, u64 size) override; bool OnCPUWrite(DAddr addr, u64 size) override;
void InvalidateGPUCache() override; void InvalidateGPUCache() override;
void UnmapMemory(DAddr addr, u64 size) override; void UnmapMemory(DAddr addr, u64 size) override;