From 1469c5304899126b8822ec24c4550922eb021eee Mon Sep 17 00:00:00 2001 From: nmzik Date: Sun, 30 Aug 2026 23:39:18 +0400 Subject: [PATCH] fix(agc): honor top bound for single-ended buffers --- src/libs/agc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/agc.cpp b/src/libs/agc.cpp index 3b065303f..9766c73af 100644 --- a/src/libs/agc.cpp +++ b/src/libs/agc.cpp @@ -257,11 +257,12 @@ struct CommandBuffer { } [[nodiscard]] KYTY_SYSV_ABI uint32_t GetAvailableSizeDW() const { - if (cursor_up == nullptr || cursor_down == nullptr || cursor_down <= cursor_up) { + auto* end = cursor_down != nullptr ? cursor_down : top; + if (cursor_up == nullptr || end == nullptr || end <= cursor_up) { return 0; } - auto available = static_cast(cursor_down - cursor_up); + auto available = static_cast(end - cursor_up); if (available <= reserved_dw) { return 0; }