mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Show generic vtx in attributes, and show attribute names from VS
This commit is contained in:
@@ -37,6 +37,7 @@ struct GLPipelineState
|
||||
VertexAttribute() : BufferSlot(0), RelativeOffset(0) {}
|
||||
bool32 Enabled;
|
||||
ResourceFormat Format;
|
||||
FloatVector GenericValue;
|
||||
uint32_t BufferSlot;
|
||||
uint32_t RelativeOffset;
|
||||
};
|
||||
|
||||
@@ -225,6 +225,7 @@ struct BindpointMap
|
||||
|
||||
struct ShaderBindpointMapping
|
||||
{
|
||||
rdctype::array<int> InputAttributes;
|
||||
rdctype::array<BindpointMap> ConstantBlocks;
|
||||
rdctype::array<BindpointMap> Resources;
|
||||
};
|
||||
|
||||
@@ -88,6 +88,7 @@ void Serialiser::Serialise(const char *name, BindpointMap &el)
|
||||
template<>
|
||||
void Serialiser::Serialise(const char *name, ShaderBindpointMapping &el)
|
||||
{
|
||||
Serialise("", el.InputAttributes);
|
||||
Serialise("", el.ConstantBlocks);
|
||||
Serialise("", el.Resources);
|
||||
}
|
||||
|
||||
@@ -492,6 +492,15 @@ D3D11PipelineState D3D11Replay::MakePipelineState()
|
||||
dst.ShaderName = str;
|
||||
|
||||
// create identity bindpoint mapping
|
||||
create_array_uninit(dst.BindpointMapping.InputAttributes, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT);
|
||||
for(int s=0; s < D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; s++)
|
||||
{
|
||||
// TODO: this should do any semantic rematching as defined by the bytecode
|
||||
// the input layout was built with (not necessarily the vertex shader's bytecode -
|
||||
// in the case of a mismatch). It's commonly, but not always the identity mapping
|
||||
dst.BindpointMapping.InputAttributes[s] = s;
|
||||
}
|
||||
|
||||
create_array_uninit(dst.BindpointMapping.ConstantBlocks, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
|
||||
for(int s=0; s < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; s++)
|
||||
{
|
||||
|
||||
@@ -816,6 +816,27 @@ void GLReplay::GetMapping(WrappedOpenGL &gl, GLuint curProg, int shadIdx, Shader
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GLint numVAttribBindings = 16;
|
||||
gl.glGetIntegerv(eGL_MAX_VERTEX_ATTRIBS, &numVAttribBindings);
|
||||
|
||||
create_array_uninit(mapping.InputAttributes, numVAttribBindings);
|
||||
for(int32_t i=0; i < numVAttribBindings; i++)
|
||||
mapping.InputAttributes[i] = -1;
|
||||
|
||||
// override identity map with bindings
|
||||
if(shadIdx == 0)
|
||||
{
|
||||
for(int32_t i=0; i < refl->InputSig.count; i++)
|
||||
{
|
||||
GLint loc = gl.glGetAttribLocation(curProg, refl->InputSig.elems[i].varName.elems);
|
||||
|
||||
if(loc >= 0 && loc < numVAttribBindings)
|
||||
{
|
||||
mapping.InputAttributes[loc] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(RELEASE)
|
||||
for(size_t i=1; i < ARRAY_COUNT(dummyReadback); i++)
|
||||
@@ -878,6 +899,9 @@ void GLReplay::SavePipelineState()
|
||||
|
||||
GLint integer = 0;
|
||||
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);
|
||||
|
||||
ResourceFormat fmt;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace renderdoc
|
||||
public bool Enabled;
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public ResourceFormat Format;
|
||||
public FloatVector GenericValue;
|
||||
public UInt32 BufferSlot;
|
||||
public UInt32 RelativeOffset;
|
||||
};
|
||||
|
||||
@@ -416,6 +416,8 @@ namespace renderdoc
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ShaderBindpointMapping
|
||||
{
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public int[] InputAttributes;
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public BindpointMap[] ConstantBlocks;
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
|
||||
+631
-627
File diff suppressed because it is too large
Load Diff
@@ -302,18 +302,47 @@ namespace renderdocui.Windows.PipelineState
|
||||
int i = 0;
|
||||
foreach (var l in state.m_VtxIn.attributes)
|
||||
{
|
||||
if (l.Enabled || showDisabled.Checked)
|
||||
bool filledSlot = true; // there's always an attribute, either from a buffer (if it's enabled)
|
||||
// or generic (if disabled)
|
||||
bool usedSlot = false;
|
||||
|
||||
string name = String.Format("Attribute {0}", i);
|
||||
|
||||
if (state.m_VS.Shader != ResourceId.Null)
|
||||
{
|
||||
int attrib = state.m_VS.BindpointMapping.InputAttributes[i];
|
||||
|
||||
if (attrib >= 0 && attrib < state.m_VS.ShaderDetails.InputSig.Length)
|
||||
{
|
||||
name = state.m_VS.ShaderDetails.InputSig[attrib].varName;
|
||||
usedSlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
// show if
|
||||
if (usedSlot || // it's referenced by the shader - regardless of empty or not
|
||||
(showDisabled.Checked && !usedSlot && filledSlot) || // it's bound, but not referenced, and we have "show disabled"
|
||||
(showEmpty.Checked && !filledSlot) // it's empty, and we have "show empty"
|
||||
)
|
||||
{
|
||||
string byteOffs = l.RelativeOffset.ToString();
|
||||
|
||||
var node = inputLayouts.Nodes.Add(new object[] { i, "", l.Format, l.BufferSlot.ToString(), byteOffs, });
|
||||
string genericVal = String.Format("Generic=<{0}, {1}, {2}, {3}>",
|
||||
l.GenericValue.x, l.GenericValue.y, l.GenericValue.z, l.GenericValue.w);
|
||||
|
||||
usedVBuffers[l.BufferSlot] = true;
|
||||
var node = inputLayouts.Nodes.Add(new object[] {
|
||||
i,
|
||||
l.Enabled ? "Enabled" : "Disabled", name,
|
||||
l.Enabled ? l.Format.ToString() : genericVal,
|
||||
l.BufferSlot.ToString(), byteOffs, });
|
||||
|
||||
if(l.Enabled)
|
||||
usedVBuffers[l.BufferSlot] = true;
|
||||
|
||||
node.Image = global::renderdocui.Properties.Resources.action;
|
||||
node.HoverImage = global::renderdocui.Properties.Resources.action_hover;
|
||||
|
||||
if (!l.Enabled)
|
||||
if (!usedSlot)
|
||||
InactiveRow(node);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user