aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2023-08-27 04:26:59 +0200
committerGitHub <noreply@github.com>2023-08-27 04:26:59 +0200
commitada4697300fce6a139bd78d548f151f9f4599ad3 (patch)
treeaeadfc8ee130fa26ec6daeedf1f16606fbeda36d
parent6c4abd23be375afda850661cdf164b65e52f8cb8 (diff)
parentacc99433c7c0e527424828452c978d7a69f8b52a (diff)
Merge pull request #11389 from FernandoS27/discard-fixmainline-0-1539
Buffer Cache: fix discard writes.
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index f0f450edb0..8be7bd5947 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -289,8 +289,11 @@ std::pair<typename P::Buffer*, u32> BufferCache<P>::ObtainBuffer(GPUVAddr gpu_ad
MarkWrittenBuffer(buffer_id, *cpu_addr, size);
break;
case ObtainBufferOperation::DiscardWrite: {
- IntervalType interval{*cpu_addr, size};
+ VAddr cpu_addr_start = Common::AlignDown(*cpu_addr, 64);
+ VAddr cpu_addr_end = Common::AlignUp(*cpu_addr + size, 64);
+ IntervalType interval{cpu_addr_start, cpu_addr_end};
ClearDownload(interval);
+ common_ranges.subtract(interval);
break;
}
default:
@@ -1159,6 +1162,11 @@ void BufferCache<P>::UpdateDrawIndirect() {
.size = static_cast<u32>(size),
.buffer_id = FindBuffer(*cpu_addr, static_cast<u32>(size)),
};
+ VAddr cpu_addr_start = Common::AlignDown(*cpu_addr, 64);
+ VAddr cpu_addr_end = Common::AlignUp(*cpu_addr + size, 64);
+ IntervalType interval{cpu_addr_start, cpu_addr_end};
+ ClearDownload(interval);
+ common_ranges.subtract(interval);
};
if (current_draw_indirect->include_count) {
update(current_draw_indirect->count_start_address, sizeof(u32),