diff --git a/renderdoc/api/replay/gl_pipestate.h b/renderdoc/api/replay/gl_pipestate.h index e7e9b90d6..79df494dd 100644 --- a/renderdoc/api/replay/gl_pipestate.h +++ b/renderdoc/api/replay/gl_pipestate.h @@ -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; }; diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index c45ac7436..4d8ed4f72 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -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); diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 8f2767c9d..8561efaaf 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -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; diff --git a/renderdocui/Interop/GLPipelineState.cs b/renderdocui/Interop/GLPipelineState.cs index 81e5e96da..ef16feba6 100644 --- a/renderdocui/Interop/GLPipelineState.cs +++ b/renderdocui/Interop/GLPipelineState.cs @@ -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; }; diff --git a/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs b/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs index 2bb22e9b4..4a296fc5b 100644 --- a/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs +++ b/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs @@ -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,