Show restart index on GL pipe state, and handle it being disabled

This commit is contained in:
baldurk
2015-01-15 23:37:17 +00:00
parent 1096308755
commit f459c63380
7 changed files with 87 additions and 9 deletions
+2
View File
@@ -54,6 +54,8 @@ struct GLPipelineState
rdctype::array<VertexBuffer> vbuffers;
ResourceId ibuffer;
bool32 primitiveRestart;
uint32_t restartIndex;
} m_VtxIn;
struct ShaderStage
+3
View File
@@ -864,6 +864,9 @@ void GLReplay::SavePipelineState()
gl.glGetIntegerv(eGL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint*)&ibuffer);
pipe.m_VtxIn.ibuffer = rm->GetOriginalID(rm->GetID(BufferRes(ctx, ibuffer)));
pipe.m_VtxIn.primitiveRestart = rs.Enabled[GLRenderState::eEnabled_PrimitiveRestart];
pipe.m_VtxIn.restartIndex = rs.Enabled[GLRenderState::eEnabled_PrimitiveRestartFixedIndex] ? ~0U : rs.PrimitiveRestartIndex;
// Vertex buffers and attributes
GLint numVBufferBindings = 16;
gl.glGetIntegerv(eGL_MAX_VERTEX_ATTRIB_BINDINGS, &numVBufferBindings);
+41
View File
@@ -248,6 +248,47 @@ namespace renderdocui.Code
ByteOffset = 0;
}
public bool IsStripRestartEnabled()
{
if (LogLoaded)
{
if (IsLogD3D11)
{
// D3D11 this is always enabled
return true;
}
else if (IsLogGL)
{
return m_GL.m_VtxIn.primitiveRestart;
}
}
return false;
}
public uint GetStripRestartIndex(uint indexByteWidth)
{
if (LogLoaded)
{
if (IsLogD3D11)
{
// D3D11 this is always '-1' in whichever size of index we're using
return indexByteWidth == 2 ? ushort.MaxValue : uint.MaxValue;
}
else if (IsLogGL)
{
uint maxval = uint.MaxValue;
if (indexByteWidth == 2)
maxval = ushort.MaxValue;
else if (indexByteWidth == 1)
maxval = 0xff;
return Math.Min(maxval, m_GL.m_VtxIn.restartIndex);
}
}
return uint.MaxValue;
}
public struct VBuffer
{
public ResourceId Buffer;
+2
View File
@@ -59,6 +59,8 @@ namespace renderdoc
public VertexBuffer[] vbuffers;
public ResourceId ibuffer;
public bool primitiveRestart;
public UInt32 restartIndex;
};
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
public VertexInputs m_VtxIn;
+10 -6
View File
@@ -76,6 +76,8 @@ namespace renderdocui.Windows
public ResourceId IndexBuffer = ResourceId.Null;
public uint IndexOffset = 0;
public bool IndexRestart = true;
public uint IndexRestartValue = uint.MaxValue;
}
// contains the raw bytes (and any state necessary from the drawcall itself)
@@ -711,6 +713,8 @@ namespace renderdocui.Windows
ret.IndexBuffer = ibuffer;
ret.IndexOffset = ioffset;
ret.IndexRestart = m_Core.CurPipelineState.IsStripRestartEnabled();
ret.IndexRestartValue = m_Core.CurPipelineState.GetStripRestartIndex(draw != null ? draw.indexByteWidth : 0);
if (type != MeshDataStage.VSIn)
{
@@ -893,9 +897,9 @@ namespace renderdocui.Windows
uint minIndex = ret.Indices.Length > 0 ? ret.Indices[0] : 0;
foreach (var i in ret.Indices)
{
if (input.Drawcall.indexByteWidth == 2 && i == UInt16.MaxValue)
if (input.Drawcall.indexByteWidth == 2 && i == input.IndexRestartValue && input.IndexRestart)
continue;
if (input.Drawcall.indexByteWidth == 4 && i == UInt32.MaxValue)
if (input.Drawcall.indexByteWidth == 4 && i == input.IndexRestartValue && input.IndexRestart)
continue;
minIndex = Math.Min(minIndex, i);
@@ -949,9 +953,9 @@ namespace renderdocui.Windows
maxIndex = 0;
foreach (var i in ret.Indices)
{
if (input.Drawcall.indexByteWidth == 2 && i == UInt16.MaxValue)
if (input.Drawcall.indexByteWidth == 2 && i == input.IndexRestartValue && input.IndexRestart)
continue;
if (input.Drawcall.indexByteWidth == 4 && i == UInt32.MaxValue)
if (input.Drawcall.indexByteWidth == 4 && i == input.IndexRestartValue && input.IndexRestart)
continue;
maxIndex = Math.Max(maxIndex, i);
@@ -1576,9 +1580,9 @@ namespace renderdocui.Windows
state.m_Data.Topology == PrimitiveTopology.TriangleStrip ||
state.m_Data.Topology == PrimitiveTopology.TriangleStrip_Adj;
if (state.m_Input.Drawcall.indexByteWidth == 2 && index == ushort.MaxValue && strip)
if (state.m_Input.Drawcall.indexByteWidth == 2 && index == state.m_Input.IndexRestartValue && state.m_Input.IndexRestart && strip)
rowdata[1] = "-1";
if (state.m_Input.Drawcall.indexByteWidth == 4 && index == uint.MaxValue && strip)
if (state.m_Input.Drawcall.indexByteWidth == 4 && index == state.m_Input.IndexRestartValue && state.m_Input.IndexRestart && strip)
rowdata[1] = "-1";
x = 2;
@@ -287,6 +287,7 @@
this.tableLayoutPanel13 = new System.Windows.Forms.TableLayoutPanel();
this.topologyDiagram = new System.Windows.Forms.PictureBox();
this.topology = new System.Windows.Forms.Label();
this.restartIndex = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.iabuffers = new TreelistView.TreeListView();
this.inputLayouts = new TreelistView.TreeListView();
@@ -787,12 +788,14 @@
this.tableLayoutPanel13.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel13.Controls.Add(this.topologyDiagram, 0, 1);
this.tableLayoutPanel13.Controls.Add(this.topology, 0, 0);
this.tableLayoutPanel13.Controls.Add(this.restartIndex, 0, 2);
this.tableLayoutPanel13.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel13.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel13.Name = "tableLayoutPanel13";
this.tableLayoutPanel13.RowCount = 2;
this.tableLayoutPanel13.RowCount = 3;
this.tableLayoutPanel13.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel13.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel13.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel13.Size = new System.Drawing.Size(336, 278);
this.tableLayoutPanel13.TabIndex = 2;
//
@@ -802,7 +805,7 @@
this.topologyDiagram.Image = global::renderdocui.Properties.Resources.topo_trilist;
this.topologyDiagram.Location = new System.Drawing.Point(3, 26);
this.topologyDiagram.Name = "topologyDiagram";
this.topologyDiagram.Size = new System.Drawing.Size(330, 249);
this.topologyDiagram.Size = new System.Drawing.Size(330, 226);
this.topologyDiagram.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.topologyDiagram.TabIndex = 1;
this.topologyDiagram.TabStop = false;
@@ -821,6 +824,16 @@
this.topology.Text = "Triangle List";
this.topology.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// restartIndex
//
this.restartIndex.AutoSize = true;
this.restartIndex.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.restartIndex.Location = new System.Drawing.Point(3, 255);
this.restartIndex.Name = "restartIndex";
this.restartIndex.Size = new System.Drawing.Size(214, 23);
this.restartIndex.TabIndex = 2;
this.restartIndex.Text = "Restart Idx: 0xFFFFFFFF";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.iabuffers);
@@ -2405,7 +2418,7 @@
this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 687F));
this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 688F));
this.tableLayoutPanel8.Controls.Add(this.frontCCW, 5, 0);
this.tableLayoutPanel8.Controls.Add(this.cullMode, 3, 0);
this.tableLayoutPanel8.Controls.Add(label1, 0, 1);
@@ -4553,5 +4566,6 @@
private System.Windows.Forms.PictureBox psShaderEdit;
private System.Windows.Forms.PictureBox csShaderEdit;
private System.Windows.Forms.PictureBox meshView;
private System.Windows.Forms.Label restartIndex;
}
}
@@ -403,6 +403,18 @@ namespace renderdocui.Windows.PipelineState
bool ibufferUsed = draw != null && (draw.flags & DrawcallFlags.UseIBuffer) != 0;
if (ibufferUsed)
{
if(state.m_VtxIn.primitiveRestart)
restartIndex.Text = String.Format("Restart Idx: 0x{0:X8}", state.m_VtxIn.restartIndex);
else
restartIndex.Text = "Restart Idx: Disabled";
}
else
{
restartIndex.Text = "";
}
if (state.m_VtxIn.ibuffer != null)
{
if (ibufferUsed || showDisabled.Checked)