rasterizer_cache: Proper surface unregister

This commit is contained in:
GPUCode 2023-08-14 02:14:52 +03:00
parent ba9f1f8ae9
commit 8421be7ebf
4 changed files with 20 additions and 7 deletions

View file

@ -1300,11 +1300,6 @@ void RasterizerCache<T>::InvalidateRegion(PAddr addr, u32 size, SurfaceId region
for (const SurfaceId surface_id : remove_surfaces) {
UnregisterSurface(surface_id);
if (slot_surfaces[surface_id].type != SurfaceType::Fill) {
sentenced.emplace_back(surface_id, frame_tick);
} else {
slot_surfaces.erase(surface_id);
}
}
}
@ -1365,7 +1360,13 @@ void RasterizerCache<T>::UnregisterSurface(SurfaceId surface_id) {
surfaces.erase(vector_it);
});
RemoveTextureCubeFace(surface_id);
if (surface.type != SurfaceType::Fill) {
RemoveTextureCubeFace(surface_id);
sentenced.emplace_back(surface_id, frame_tick);
return;
}
slot_surfaces.erase(surface_id);
}
template <class T>
@ -1376,7 +1377,9 @@ void RasterizerCache<T>::UnregisterAll() {
UnregisterSurface(surfaces.back());
}
}
texture_cube_cache.clear();
runtime.Finish();
frame_tick += runtime.RemoveThreshold();
RunGarbageCollector();
}
template <class T>

View file

@ -45,6 +45,9 @@ public:
/// Returns the removal threshold ticks for the garbage collector
u32 RemoveThreshold();
/// Submits and waits for current GPU work.
void Finish() {}
/// Returns true if the provided pixel format cannot be used natively by the runtime.
bool NeedsConversion(VideoCore::PixelFormat pixel_format) const;

View file

@ -278,6 +278,10 @@ u32 TextureRuntime::RemoveThreshold() {
return num_swapchain_images + 2;
}
void TextureRuntime::Finish() {
scheduler.Finish();
}
bool TextureRuntime::Reinterpret(Surface& source, Surface& dest,
const VideoCore::TextureBlit& blit) {
const PixelFormat src_format = source.pixel_format;

View file

@ -61,6 +61,9 @@ public:
/// Returns the removal threshold ticks for the garbage collector
u32 RemoveThreshold();
/// Submits and waits for current GPU work.
void Finish();
/// Maps an internal staging buffer of the provided size for pixel uploads/downloads
VideoCore::StagingData FindStaging(u32 size, bool upload);