texture_cache: fix for unexpected scheduler flushes by detiler

This commit is contained in:
psucien 2024-08-10 01:53:25 +02:00
parent d805c65b06
commit 9332910240
2 changed files with 5 additions and 1 deletions

View File

@ -146,6 +146,10 @@ public:
return offset;
}
u64 GetFreeSize() const {
return size_bytes - offset - mapped_size;
}
private:
struct Watch {
u64 tick{};

View File

@ -397,7 +397,7 @@ std::optional<vk::Buffer> TileManager::TryDetile(Image& image) {
const u32 image_size = image.info.guest_size_bytes;
const auto [in_buffer, in_offset] = [&] -> std::pair<vk::Buffer, u32> {
// Use stream buffer for smaller textures.
if (image_size <= StreamBufferSize) {
if (image_size <= stream_buffer.GetFreeSize()) {
u32 offset = stream_buffer.Copy(image.info.guest_address, image_size);
return {stream_buffer.Handle(), offset};
}