mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Handle super small buffers in buffer viewer without displaying nothing
This commit is contained in:
@@ -325,7 +325,7 @@ namespace renderdocui.Code
|
||||
return ret;
|
||||
}
|
||||
|
||||
static public FormatElement[] ParseFormatString(string formatString, bool tightPacking, out string errors)
|
||||
static public FormatElement[] ParseFormatString(string formatString, UInt64 maxLen, bool tightPacking, out string errors)
|
||||
{
|
||||
var elems = new List<FormatElement>();
|
||||
|
||||
@@ -586,6 +586,11 @@ namespace renderdocui.Code
|
||||
|
||||
var fmt = new ResourceFormat(FormatComponentType.UInt, 4, 4);
|
||||
|
||||
if (maxLen > 0 && maxLen < 16)
|
||||
fmt.compCount = 1;
|
||||
if (maxLen > 0 && maxLen < 4)
|
||||
fmt.compByteWidth = 1;
|
||||
|
||||
elems.Add(new FormatElement("data", 0, 0, false, 1, false, 1, fmt, true));
|
||||
}
|
||||
|
||||
|
||||
@@ -677,12 +677,14 @@ namespace renderdocui.Windows
|
||||
|
||||
m_FormatText = formatString;
|
||||
|
||||
UInt64 len = 0;
|
||||
Text = "Buffer Contents";
|
||||
foreach (var b in m_Core.CurBuffers)
|
||||
{
|
||||
if (b.ID == id)
|
||||
{
|
||||
Text = b.name + " - Contents";
|
||||
len = b.byteSize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -691,7 +693,7 @@ namespace renderdocui.Windows
|
||||
|
||||
string errors = "";
|
||||
|
||||
FormatElement[] elems = FormatElement.ParseFormatString(formatString, true, out errors);
|
||||
FormatElement[] elems = FormatElement.ParseFormatString(formatString, len, true, out errors);
|
||||
|
||||
input.Strides = new uint[] { elems.Last().offset + elems.Last().ByteSize };
|
||||
input.Buffers = new ResourceId[] { isBuffer ? id : ResourceId.Null, isBuffer ? ResourceId.Null : id };
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace renderdocui.Controls
|
||||
{
|
||||
string errors = "";
|
||||
|
||||
m_FormatOverride = FormatElement.ParseFormatString(formatText, false, out errors);
|
||||
m_FormatOverride = FormatElement.ParseFormatString(formatText, 0, false, out errors);
|
||||
|
||||
if (m_FormatSpecifier != null)
|
||||
m_FormatSpecifier.SetErrors(errors);
|
||||
|
||||
Reference in New Issue
Block a user