Fix handling of buffer truncation and zero-sized buffers

This commit is contained in:
baldurk
2020-05-29 17:26:29 +01:00
parent 9f0787da33
commit a0a373a8e1
36 changed files with 1038 additions and 242 deletions
@@ -136,7 +136,9 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventId)
if(!m_formatOverride.type.members.empty())
{
m_Ctx.Replay().AsyncInvoke([this, offset, size, wasEmpty](IReplayController *r) {
bytebuf data = r->GetBufferData(m_cbuffer, offset, size);
bytebuf data;
if(size > 0)
data = r->GetBufferData(m_cbuffer, offset, size);
rdcarray<ShaderVariable> vars = applyFormatOverride(data);
GUIInvoke::call(this, [this, vars, wasEmpty] {
RDTreeViewExpansionState state;
@@ -279,7 +281,7 @@ void ConstantBufferPreviewer::processFormat(const QString &format)
{
QString errors;
m_formatOverride = BufferFormatter::ParseFormatString(format, 0, false, errors);
m_formatOverride = BufferFormatter::ParseFormatString(format, ~0ULL, false, errors);
ui->formatSpecifier->setErrors(errors);
}