mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-09 13:36:35 +00:00
[GPU] Added flush helper to detect when FlusRegion must be flushed
This commit is contained in:
+1
-1
@@ -754,7 +754,7 @@ struct Memory::Impl {
|
||||
};
|
||||
auto& gpu = system.GPU();
|
||||
gpu_device_memory->ApplyOpOnPointer(p, scratch_buffers[core], [&](DAddr addr) {
|
||||
if (flush) {
|
||||
if (flush && gpu.MustFlushRegion(addr, size)) {
|
||||
void(gpu.OnCPURead(addr, size));
|
||||
}
|
||||
gpu.InvalidateRegion(addr, size);
|
||||
|
||||
@@ -219,6 +219,10 @@ struct GPU::Impl {
|
||||
return renderer->ReadRasterizer()->OnCPUWrite(addr, size);
|
||||
}
|
||||
|
||||
bool MustFlushRegion(DAddr addr, u64 size) {
|
||||
return renderer->ReadRasterizer()->MustFlushRegion(addr, size);
|
||||
}
|
||||
|
||||
/// Notify rasterizer that any caches of the specified region should be flushed and invalidated
|
||||
void FlushAndInvalidateRegion(DAddr addr, u64 size) {
|
||||
gpu_thread.FlushAndInvalidateRegion(addr, size, is_async);
|
||||
@@ -480,6 +484,10 @@ void GPU::InvalidateRegion(DAddr addr, u64 size) {
|
||||
impl->InvalidateRegion(addr, size);
|
||||
}
|
||||
|
||||
bool GPU::MustFlushRegion(DAddr addr, u64 size) {
|
||||
return impl->MustFlushRegion(addr, size);
|
||||
}
|
||||
|
||||
bool GPU::OnCPUWrite(DAddr addr, u64 size) {
|
||||
return impl->OnCPUWrite(addr, size);
|
||||
}
|
||||
|
||||
@@ -246,6 +246,9 @@ public:
|
||||
/// Notify rasterizer that any caches of the specified region should be invalidated
|
||||
void InvalidateRegion(DAddr addr, u64 size);
|
||||
|
||||
/// Check if the specified memory area requires flushing to CPU memory
|
||||
[[nodiscard]] bool MustFlushRegion(DAddr addr, u64 size);
|
||||
|
||||
/// 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
|
||||
bool OnCPUWrite(DAddr addr, u64 size);
|
||||
|
||||
Reference in New Issue
Block a user