mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-22 19:29:20 +01:00
Fix infinite loop when reading dirty buffers with direct mem
The code didn't account for interval Queries returning zero when reaching the end.
This commit is contained in:
parent
0b551e04db
commit
1f0d297221
@ -312,12 +312,15 @@ namespace skyline::gpu {
|
|||||||
RefreshGpuWritesActiveDirect(true, flushHostCallback);
|
RefreshGpuWritesActiveDirect(true, flushHostCallback);
|
||||||
|
|
||||||
if (directTrackedShadowActive && RefreshGpuReadsActiveDirect()) {
|
if (directTrackedShadowActive && RefreshGpuReadsActiveDirect()) {
|
||||||
size_t curOffset{offset};
|
size_t dstOffset{};
|
||||||
while (curOffset != data.size() + offset) {
|
while (dstOffset != data.size()) {
|
||||||
auto result{directTrackedWrites.Query(curOffset)};
|
auto srcOffset{dstOffset + offset};
|
||||||
|
auto dstRemaining{data.size() - dstOffset};
|
||||||
|
auto result{directTrackedWrites.Query(srcOffset)};
|
||||||
|
auto size{result.size ? std::min(result.size, dstRemaining) : dstRemaining};
|
||||||
auto srcData{result.enclosed ? directTrackedShadow.data() : mirror.data()};
|
auto srcData{result.enclosed ? directTrackedShadow.data() : mirror.data()};
|
||||||
std::memcpy(data.data() + curOffset - offset, srcData + curOffset, result.size);
|
std::memcpy(data.data() + dstOffset, srcData + srcOffset, size);
|
||||||
curOffset += result.size;
|
dstOffset += size;
|
||||||
}
|
}
|
||||||
} else [[likely]] {
|
} else [[likely]] {
|
||||||
std::memcpy(data.data(), mirror.data() + offset, data.size());
|
std::memcpy(data.data(), mirror.data() + offset, data.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user