Show generic vtx in attributes, and show attribute names from VS

This commit is contained in:
baldurk
2015-01-15 23:16:55 +00:00
parent 99f3eb78cf
commit 1096308755
9 changed files with 703 additions and 631 deletions
+1
View File
@@ -37,6 +37,7 @@ struct GLPipelineState
VertexAttribute() : BufferSlot(0), RelativeOffset(0) {}
bool32 Enabled;
ResourceFormat Format;
FloatVector GenericValue;
uint32_t BufferSlot;
uint32_t RelativeOffset;
};
+1
View File
@@ -225,6 +225,7 @@ struct BindpointMap
struct ShaderBindpointMapping
{
rdctype::array<int> InputAttributes;
rdctype::array<BindpointMap> ConstantBlocks;
rdctype::array<BindpointMap> Resources;
};
+1
View File
@@ -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);
}
+9
View File
@@ -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++)
{
+24
View File
@@ -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;
+1
View File
@@ -39,6 +39,7 @@ namespace renderdoc
public bool Enabled;
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
public ResourceFormat Format;
public FloatVector GenericValue;
public UInt32 BufferSlot;
public UInt32 RelativeOffset;
};
+2
View File
@@ -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)]
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);
}