mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Make generic values show up in the mesh viewer
This commit is contained in:
@@ -337,6 +337,7 @@ namespace renderdocui.Code
|
||||
public bool PerInstance;
|
||||
public int InstanceRate;
|
||||
public ResourceFormat Format;
|
||||
public object[] GenericValue;
|
||||
};
|
||||
|
||||
public VertexInputAttribute[] GetVertexInputs()
|
||||
@@ -378,6 +379,7 @@ namespace renderdocui.Code
|
||||
ret[i].PerInstance = layouts[i].PerInstance;
|
||||
ret[i].InstanceRate = (int)layouts[i].InstanceDataStepRate;
|
||||
ret[i].Format = layouts[i].Format;
|
||||
ret[i].GenericValue = null;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -395,7 +397,7 @@ namespace renderdocui.Code
|
||||
else
|
||||
attrib = i;
|
||||
|
||||
if (attrs[i].Enabled && attrib >= 0)
|
||||
if (attrib >= 0)
|
||||
num++;
|
||||
}
|
||||
|
||||
@@ -403,9 +405,13 @@ namespace renderdocui.Code
|
||||
VertexInputAttribute[] ret = new VertexInputAttribute[num];
|
||||
for (int i = 0; i < attrs.Length && a < num; i++)
|
||||
{
|
||||
if (!attrs[i].Enabled) continue;
|
||||
|
||||
ret[a].Name = String.Format("attr{0}", i);
|
||||
ret[a].GenericValue = null;
|
||||
ret[a].VertexBuffer = (int)attrs[i].BufferSlot;
|
||||
ret[a].RelativeByteOffset = attrs[i].RelativeOffset;
|
||||
ret[a].PerInstance = m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor > 0;
|
||||
ret[a].InstanceRate = (int)m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor;
|
||||
ret[a].Format = attrs[i].Format;
|
||||
|
||||
if (m_GL.m_VS.BindpointMapping != null && m_GL.m_VS.ShaderDetails != null)
|
||||
{
|
||||
@@ -415,13 +421,33 @@ namespace renderdocui.Code
|
||||
ret[a].Name = m_GL.m_VS.ShaderDetails.InputSig[attrib].varName;
|
||||
|
||||
if (attrib == -1) continue;
|
||||
}
|
||||
|
||||
ret[a].VertexBuffer = (int)attrs[i].BufferSlot;
|
||||
ret[a].RelativeByteOffset = attrs[i].RelativeOffset;
|
||||
ret[a].PerInstance = m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor > 0;
|
||||
ret[a].InstanceRate = (int)m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor;
|
||||
ret[a].Format = attrs[i].Format;
|
||||
if (!attrs[i].Enabled)
|
||||
{
|
||||
uint compCount = m_GL.m_VS.ShaderDetails.InputSig[attrib].compCount;
|
||||
FormatComponentType compType = m_GL.m_VS.ShaderDetails.InputSig[attrib].compType;
|
||||
|
||||
ret[a].GenericValue = new object[compCount];
|
||||
|
||||
for (uint c = 0; c < compCount; c++)
|
||||
{
|
||||
if (compType == FormatComponentType.Float)
|
||||
ret[a].GenericValue[c] = attrs[i].GenericValue.f[c];
|
||||
else if (compType == FormatComponentType.UInt)
|
||||
ret[a].GenericValue[c] = attrs[i].GenericValue.u[c];
|
||||
else if (compType == FormatComponentType.SInt)
|
||||
ret[a].GenericValue[c] = attrs[i].GenericValue.i[c];
|
||||
}
|
||||
|
||||
ret[a].PerInstance = false;
|
||||
ret[a].InstanceRate = 0;
|
||||
ret[a].Format.compByteWidth = 4;
|
||||
ret[a].Format.compCount = compCount;
|
||||
ret[a].Format.compType = compType;
|
||||
ret[a].Format.special = false;
|
||||
ret[a].Format.srgbCorrected = false;
|
||||
}
|
||||
}
|
||||
|
||||
a++;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace renderdocui.Windows
|
||||
{
|
||||
public FormatElement[] BufferFormats = null;
|
||||
public ResourceId[] Buffers = null;
|
||||
public object[][] GenericValues = null;
|
||||
public uint[] Strides = null;
|
||||
public uint[] Offsets = null;
|
||||
|
||||
@@ -811,6 +812,8 @@ namespace renderdocui.Windows
|
||||
var vinputs = m_Core.CurPipelineState.GetVertexInputs();
|
||||
f = new FormatElement[vinputs.Length];
|
||||
|
||||
ret.GenericValues = new object[vinputs.Length][];
|
||||
|
||||
int i = 0;
|
||||
foreach (var a in vinputs)
|
||||
{
|
||||
@@ -823,6 +826,7 @@ namespace renderdocui.Windows
|
||||
1, // matrix dimension
|
||||
a.Format,
|
||||
false);
|
||||
ret.GenericValues[i] = a.GenericValue;
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1334,6 +1338,7 @@ namespace renderdocui.Windows
|
||||
bool finished = false;
|
||||
|
||||
var bufferFormats = input.BufferFormats;
|
||||
var generics = input.GenericValues;
|
||||
|
||||
Vec3f minBounds = new Vec3f(float.MaxValue, float.MaxValue, float.MaxValue);
|
||||
Vec3f maxBounds = new Vec3f(-float.MaxValue, -float.MaxValue, -float.MaxValue);
|
||||
@@ -1369,6 +1374,21 @@ namespace renderdocui.Windows
|
||||
|
||||
for (int el = 0; el < bufferFormats.Length; el++)
|
||||
{
|
||||
if (generics != null && generics[el] != null)
|
||||
{
|
||||
for(int g=0; g < generics[el].Length; g++)
|
||||
{
|
||||
if (generics[el][g] is uint)
|
||||
rawWriter.Write((uint)generics[el][g]);
|
||||
else if (generics[el][g] is int)
|
||||
rawWriter.Write((int)generics[el][g]);
|
||||
else if (generics[el][g] is float)
|
||||
rawWriter.Write((float)generics[el][g]);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
byte[] bytedata = d[bufferFormats[el].buffer];
|
||||
@@ -1560,6 +1580,7 @@ namespace renderdocui.Windows
|
||||
byte[][] d = data.Buffers;
|
||||
|
||||
var bufferFormats = input.BufferFormats;
|
||||
var generics = input.GenericValues;
|
||||
uint rowlen = 0;
|
||||
|
||||
foreach(var el in bufferFormats)
|
||||
@@ -1633,6 +1654,14 @@ namespace renderdocui.Windows
|
||||
{
|
||||
int xstart = x;
|
||||
|
||||
if (generics != null && generics[el] != null)
|
||||
{
|
||||
for (int g = 0; g < generics[el].Length; g++)
|
||||
rowdata[x++] = generics[el][g];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
byte[] bytedata = d[bufferFormats[el].buffer];
|
||||
|
||||
Reference in New Issue
Block a user