Fix issue with clamped length with byte offset in buffer viewer

This commit is contained in:
baldurk
2021-01-06 16:58:43 +00:00
parent 4f7abcd488
commit e970ee0e33
+8 -7
View File
@@ -2579,16 +2579,17 @@ void BufferViewer::OnEventChanged(uint32_t eventId)
uint64_t unclampedLen = m_ByteSize;
if(unclampedLen == UINT64_MAX)
{
uint64_t bufLen =
unclampedLen =
m_IsBuffer && m_BufferID != ResourceId() ? m_Ctx.GetBuffer(m_BufferID)->length : 0;
uint64_t bufOffs = m_ByteOffset;
if(bufOffs >= bufLen)
unclampedLen = 0;
else
unclampedLen = bufLen - bufOffs;
}
uint64_t bufOffs = m_ByteOffset;
if(bufOffs >= unclampedLen)
unclampedLen = 0;
else
unclampedLen = unclampedLen - bufOffs;
unclampedLen -= m_PagingByteOffset;
uint64_t clampedLen = qMin(unclampedLen, uint64_t(buf->stride * (MaxVisibleRows + 2)));