mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Format the generic vertex attribute values correctly according to type
This commit is contained in:
@@ -39,7 +39,14 @@ struct GLPipelineState
|
||||
VertexAttribute() : BufferSlot(0), RelativeOffset(0) {}
|
||||
bool32 Enabled;
|
||||
ResourceFormat Format;
|
||||
FloatVector GenericValue;
|
||||
|
||||
union
|
||||
{
|
||||
float f[4];
|
||||
uint32_t u[4];
|
||||
int32_t i[4];
|
||||
} GenericValue;
|
||||
|
||||
uint32_t BufferSlot;
|
||||
uint32_t RelativeOffset;
|
||||
};
|
||||
|
||||
@@ -470,7 +470,7 @@ void Serialiser::Serialise(const char *name, GLPipelineState::VertexInput::Verte
|
||||
{
|
||||
Serialise("", el.Enabled);
|
||||
Serialise("", el.Format);
|
||||
Serialise<4>("", &el.GenericValue.x);
|
||||
Serialise<4>("", el.GenericValue.f);
|
||||
Serialise("", el.BufferSlot);
|
||||
Serialise("", el.RelativeOffset);
|
||||
|
||||
|
||||
@@ -1052,7 +1052,7 @@ void GLReplay::SavePipelineState()
|
||||
gl.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_INTEGER, &integer);
|
||||
|
||||
RDCEraseEl(pipe.m_VtxIn.attributes[i].GenericValue);
|
||||
gl.glGetVertexAttribfv(i, eGL_CURRENT_VERTEX_ATTRIB, &pipe.m_VtxIn.attributes[i].GenericValue.x);
|
||||
gl.glGetVertexAttribfv(i, eGL_CURRENT_VERTEX_ATTRIB, pipe.m_VtxIn.attributes[i].GenericValue.f);
|
||||
|
||||
ResourceFormat fmt;
|
||||
|
||||
|
||||
@@ -39,7 +39,23 @@ namespace renderdoc
|
||||
public bool Enabled;
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public ResourceFormat Format;
|
||||
public FloatVector GenericValue;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GenericValueUnion
|
||||
{
|
||||
[CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.Float)]
|
||||
public float[] f;
|
||||
|
||||
[CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.UInt32)]
|
||||
public UInt32[] u;
|
||||
|
||||
[CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4, FixedType = CustomFixedType.Int32)]
|
||||
public Int32[] i;
|
||||
};
|
||||
|
||||
[CustomMarshalAs(CustomUnmanagedType.Union)]
|
||||
public GenericValueUnion GenericValue;
|
||||
|
||||
public UInt32 BufferSlot;
|
||||
public UInt32 RelativeOffset;
|
||||
};
|
||||
|
||||
@@ -777,6 +777,9 @@ namespace renderdocui.Windows.PipelineState
|
||||
|
||||
string name = String.Format("Attribute {0}", i);
|
||||
|
||||
uint compCount = 4;
|
||||
FormatComponentType compType = FormatComponentType.Float;
|
||||
|
||||
if (state.m_VS.Shader != ResourceId.Null)
|
||||
{
|
||||
int attrib = state.m_VS.BindpointMapping.InputAttributes[i];
|
||||
@@ -784,6 +787,8 @@ namespace renderdocui.Windows.PipelineState
|
||||
if (attrib >= 0 && attrib < state.m_VS.ShaderDetails.InputSig.Length)
|
||||
{
|
||||
name = state.m_VS.ShaderDetails.InputSig[attrib].varName;
|
||||
compCount = state.m_VS.ShaderDetails.InputSig[attrib].compCount;
|
||||
compType = state.m_VS.ShaderDetails.InputSig[attrib].compType;
|
||||
usedSlot = true;
|
||||
}
|
||||
}
|
||||
@@ -796,8 +801,20 @@ namespace renderdocui.Windows.PipelineState
|
||||
{
|
||||
string byteOffs = l.RelativeOffset.ToString();
|
||||
|
||||
string genericVal = String.Format("Generic=<{0}, {1}, {2}, {3}>",
|
||||
l.GenericValue.x, l.GenericValue.y, l.GenericValue.z, l.GenericValue.w);
|
||||
string genericVal = "Generic";
|
||||
|
||||
string fmtstr = "";
|
||||
if (compCount == 1) fmtstr = "=<{0}>";
|
||||
else if (compCount == 2) fmtstr = "=<{0}, {1}>";
|
||||
else if (compCount == 3) fmtstr = "=<{0}, {1}, {2}>";
|
||||
else if (compCount == 4) fmtstr = "=<{0}, {1}, {2}, {3}>";
|
||||
|
||||
if (compType == FormatComponentType.Float)
|
||||
genericVal += String.Format(fmtstr, l.GenericValue.f[0], l.GenericValue.f[1], l.GenericValue.f[2], l.GenericValue.f[3]);
|
||||
else if (compType == FormatComponentType.UInt)
|
||||
genericVal += String.Format(fmtstr, l.GenericValue.u[0], l.GenericValue.u[1], l.GenericValue.u[2], l.GenericValue.u[3]);
|
||||
else if (compType == FormatComponentType.SInt)
|
||||
genericVal += String.Format(fmtstr, l.GenericValue.i[0], l.GenericValue.i[1], l.GenericValue.i[2], l.GenericValue.i[3]);
|
||||
|
||||
var node = inputLayouts.Nodes.Add(new object[] {
|
||||
i,
|
||||
|
||||
Reference in New Issue
Block a user