Skip to content

Commit dda2e71

Browse files
buffer_cache: Fix CopyBuffers bug
1 parent cf9f6ef commit dda2e71

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/video_core/buffer_cache/buffer_cache.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,17 @@ void BufferCache::CopyBuffer(VAddr dst, VAddr src, u32 num_bytes, bool dst_gds,
288288
if (src_gds) {
289289
return gds_buffer;
290290
}
291-
const auto [buffer, offset] = ObtainBuffer(src, num_bytes, false);
292-
return *buffer;
291+
// Avoid using ObtainBuffer here as that might give us the stream buffer.
292+
const BufferId buffer_id = FindBuffer(src, num_bytes);
293+
auto& buffer = slot_buffers[buffer_id];
294+
SynchronizeBuffer(buffer, src, num_bytes, false);
295+
return buffer;
293296
}();
294297
auto& dst_buffer = [&] -> const Buffer& {
295298
if (dst_gds) {
296299
return gds_buffer;
297300
}
301+
// Prefer using ObtainBuffer here as that will auto-mark the region as GPU modified.
298302
const auto [buffer, offset] = ObtainBuffer(dst, num_bytes, true);
299303
return *buffer;
300304
}();

0 commit comments

Comments
 (0)