Handle super small buffers in buffer viewer without displaying nothing

This commit is contained in:
baldurk
2015-11-04 12:42:13 +01:00
parent 484d70ddbd
commit 36d2ffd988
3 changed files with 10 additions and 3 deletions
+6 -1
View File
@@ -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));
}
+3 -1
View File
@@ -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);