mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-17 13:07:14 +00:00
Highlight empty viewports that are still enabled in the UI. Refs #144
This commit is contained in:
@@ -164,19 +164,25 @@ struct D3D11PipelineState
|
||||
{
|
||||
struct Viewport
|
||||
{
|
||||
Viewport(float TX=0.0f, float TY=0.0f, float W=0.0f, float H=0.0f, float MN=0.0f, float MX=0.0f)
|
||||
: Width(W), Height(H), MinDepth(MN), MaxDepth(MX)
|
||||
Viewport()
|
||||
: Width(0.0f), Height(0.0f), MinDepth(0.0f), MaxDepth(0.0f), Enabled(false)
|
||||
{ TopLeft[0] = 0.0f; TopLeft[1] = 0.0f; }
|
||||
Viewport(float TX, float TY, float W, float H, float MN, float MX, bool en)
|
||||
: Width(W), Height(H), MinDepth(MN), MaxDepth(MX), Enabled(en)
|
||||
{ TopLeft[0] = TX; TopLeft[1] = TY; }
|
||||
float TopLeft[2];
|
||||
float Width, Height;
|
||||
float MinDepth, MaxDepth;
|
||||
bool32 Enabled;
|
||||
};
|
||||
rdctype::array<Viewport> Viewports;
|
||||
|
||||
struct Scissor
|
||||
{
|
||||
Scissor(int l=0, int t=0, int r=0, int b=0) : left(l), top(t), right(r), bottom(b) {}
|
||||
Scissor() : left(0), top(0), right(0), bottom(0), Enabled(false) {}
|
||||
Scissor(int l, int t, int r, int b, bool en) : left(l), top(t), right(r), bottom(b), Enabled(en) {}
|
||||
int32_t left, top, right, bottom;
|
||||
bool32 Enabled;
|
||||
};
|
||||
rdctype::array<Scissor> Scissors;
|
||||
|
||||
|
||||
@@ -835,19 +835,19 @@ D3D11PipelineState D3D11Replay::MakePipelineState()
|
||||
create_array_uninit(ret.m_RS.Scissors, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE);
|
||||
for(i=0; i < rs->RS.NumScissors; i++)
|
||||
ret.m_RS.Scissors[i] = D3D11PipelineState::Rasterizer::Scissor(rs->RS.Scissors[i].left, rs->RS.Scissors[i].top,
|
||||
rs->RS.Scissors[i].right, rs->RS.Scissors[i].bottom);
|
||||
rs->RS.Scissors[i].right, rs->RS.Scissors[i].bottom, true);
|
||||
|
||||
for(; i < D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; i++)
|
||||
ret.m_RS.Scissors[i] = D3D11PipelineState::Rasterizer::Scissor(0, 0, 0, 0);
|
||||
ret.m_RS.Scissors[i] = D3D11PipelineState::Rasterizer::Scissor(0, 0, 0, 0, false);
|
||||
|
||||
create_array_uninit(ret.m_RS.Viewports, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE);
|
||||
for(i=0; i < rs->RS.NumViews; i++)
|
||||
ret.m_RS.Viewports[i] = D3D11PipelineState::Rasterizer::Viewport(rs->RS.Viewports[i].TopLeftX, rs->RS.Viewports[i].TopLeftY,
|
||||
rs->RS.Viewports[i].Width, rs->RS.Viewports[i].Height,
|
||||
rs->RS.Viewports[i].MinDepth, rs->RS.Viewports[i].MaxDepth);
|
||||
rs->RS.Viewports[i].MinDepth, rs->RS.Viewports[i].MaxDepth, true);
|
||||
|
||||
for(; i < D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; i++)
|
||||
ret.m_RS.Viewports[i] = D3D11PipelineState::Rasterizer::Viewport(0, 0, 0, 0, 0, 0);
|
||||
ret.m_RS.Viewports[i] = D3D11PipelineState::Rasterizer::Viewport(0, 0, 0, 0, 0, 0, false);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
@@ -217,6 +217,7 @@ namespace renderdoc
|
||||
public float[] TopLeft;
|
||||
public float Width, Height;
|
||||
public float MinDepth, MaxDepth;
|
||||
public bool Enabled;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public Viewport[] Viewports;
|
||||
@@ -225,6 +226,7 @@ namespace renderdoc
|
||||
public class Scissor
|
||||
{
|
||||
public Int32 left, top, right, bottom;
|
||||
public bool Enabled;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public Scissor[] Scissors;
|
||||
|
||||
@@ -220,6 +220,7 @@ namespace renderdoc
|
||||
public float Left, Bottom;
|
||||
public float Width, Height;
|
||||
public double MinDepth, MaxDepth;
|
||||
public bool Enabled;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public Viewport[] Viewports;
|
||||
|
||||
@@ -1094,12 +1094,15 @@ namespace renderdocui.Windows.PipelineState
|
||||
int i = 0;
|
||||
foreach (var v in state.m_RS.Viewports)
|
||||
{
|
||||
if (v.Width != v.Height || v.Width != 0 || v.Height != 0 || showEmpty.Checked)
|
||||
if (v.Enabled || showEmpty.Checked)
|
||||
{
|
||||
var node = viewports.Nodes.Add(new object[] { i, v.TopLeft[0], v.TopLeft[1], v.Width, v.Height, v.MinDepth, v.MaxDepth });
|
||||
|
||||
if (v.Width == v.Height && v.Width == 0 && v.Height == 0)
|
||||
if (v.Width == 0 || v.Height == 0 || v.MinDepth == v.MaxDepth)
|
||||
EmptyRow(node);
|
||||
|
||||
if (!v.Enabled)
|
||||
InactiveRow(node);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -1117,12 +1120,15 @@ namespace renderdocui.Windows.PipelineState
|
||||
int i = 0;
|
||||
foreach (var s in state.m_RS.Scissors)
|
||||
{
|
||||
if (s.right != 0 || s.bottom != 0 || showEmpty.Checked)
|
||||
if (s.Enabled || showEmpty.Checked)
|
||||
{
|
||||
var node = scissors.Nodes.Add(new object[] { i, s.left, s.top, s.right - s.left, s.bottom - s.top });
|
||||
|
||||
if (s.right == 0 && s.bottom == 0)
|
||||
if (s.right == s.left || s.bottom == s.top)
|
||||
EmptyRow(node);
|
||||
|
||||
if (!s.Enabled)
|
||||
InactiveRow(node);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
@@ -1131,14 +1131,14 @@ namespace renderdocui.Windows.PipelineState
|
||||
v1.MinDepth != v2.MinDepth ||
|
||||
v1.MaxDepth != v2.MaxDepth)
|
||||
{
|
||||
if (v1.Width != v1.Height || v1.Width != 0 || v1.Height != 0 || showEmpty.Checked)
|
||||
if (v1.Width != v1.Height || v1.Width != 0 || v1.Height != 0 || v1.MinDepth != v2.MaxDepth || showEmpty.Checked)
|
||||
{
|
||||
string indexstring = prev.ToString();
|
||||
if (prev < i - 1)
|
||||
indexstring = String.Format("{0}-{1}", prev, i - 1);
|
||||
var node = viewports.Nodes.Add(new object[] { indexstring, v1.Left, v1.Bottom, v1.Width, v1.Height, v1.MinDepth, v1.MaxDepth });
|
||||
|
||||
if (v1.Width == v1.Height && v1.Width == 0 && v1.Height == 0)
|
||||
if (v1.Width == 0 || v1.Height == 0 || v1.MinDepth == v1.MaxDepth)
|
||||
EmptyRow(node);
|
||||
}
|
||||
|
||||
@@ -1151,14 +1151,18 @@ namespace renderdocui.Windows.PipelineState
|
||||
{
|
||||
var v1 = state.m_RS.Viewports[prev];
|
||||
|
||||
if (v1.Width != v1.Height || v1.Width != 0 || v1.Height != 0 || showEmpty.Checked)
|
||||
// must display at least one viewport - otherwise if they are
|
||||
// all empty we get an empty list - we want a nice obvious
|
||||
// 'invalid viewport' entry. So check if prev is 0
|
||||
|
||||
if (v1.Width != v1.Height || v1.Width != 0 || v1.Height != 0 || showEmpty.Checked || prev == 0)
|
||||
{
|
||||
string indexstring = prev.ToString();
|
||||
if (prev < state.m_RS.Viewports.Length-1)
|
||||
indexstring = String.Format("{0}-{1}", prev, state.m_RS.Viewports.Length - 1);
|
||||
var node = viewports.Nodes.Add(new object[] { indexstring, v1.Left, v1.Bottom, v1.Width, v1.Height, v1.MinDepth, v1.MaxDepth });
|
||||
|
||||
if (v1.Width == v1.Height && v1.Width == 0 && v1.Height == 0)
|
||||
if (v1.Width == 0 || v1.Height == 0 || v1.MinDepth == v1.MaxDepth)
|
||||
EmptyRow(node);
|
||||
}
|
||||
}
|
||||
@@ -1184,17 +1188,21 @@ namespace renderdocui.Windows.PipelineState
|
||||
if (s1.Width != s2.Width ||
|
||||
s1.Height != s2.Height ||
|
||||
s1.Left != s2.Left ||
|
||||
s1.Bottom != s2.Bottom)
|
||||
s1.Bottom != s2.Bottom ||
|
||||
s1.Enabled != s2.Enabled)
|
||||
{
|
||||
if (s1.Width != s1.Height || s1.Width != 0 || s1.Height != 0 || showEmpty.Checked)
|
||||
if (s1.Enabled || showEmpty.Checked)
|
||||
{
|
||||
string indexstring = prev.ToString();
|
||||
if (prev < i - 1)
|
||||
indexstring = String.Format("{0}-{1}", prev, i - 1);
|
||||
var node = scissors.Nodes.Add(new object[] { indexstring, s1.Left, s1.Bottom, s1.Width, s1.Height, s1.Enabled });
|
||||
|
||||
if (s1.Width == s1.Height && s1.Width == 0 && s1.Height == 0)
|
||||
if (s1.Width == 0 || s1.Height == 0)
|
||||
EmptyRow(node);
|
||||
|
||||
if (!s1.Enabled)
|
||||
InactiveRow(node);
|
||||
}
|
||||
|
||||
prev = i;
|
||||
@@ -1206,15 +1214,18 @@ namespace renderdocui.Windows.PipelineState
|
||||
{
|
||||
var s1 = state.m_RS.Scissors[prev];
|
||||
|
||||
if (s1.Width != s1.Height || s1.Width != 0 || s1.Height != 0 || showEmpty.Checked)
|
||||
if (s1.Enabled || showEmpty.Checked)
|
||||
{
|
||||
string indexstring = prev.ToString();
|
||||
if (prev < state.m_RS.Scissors.Length - 1)
|
||||
indexstring = String.Format("{0}-{1}", prev, state.m_RS.Scissors.Length - 1);
|
||||
var node = scissors.Nodes.Add(new object[] { indexstring, s1.Left, s1.Bottom, s1.Width, s1.Height, s1.Enabled });
|
||||
|
||||
if (s1.Width == s1.Height && s1.Width == 0 && s1.Height == 0)
|
||||
if (s1.Width == 0 || s1.Height == 0)
|
||||
EmptyRow(node);
|
||||
|
||||
if (!s1.Enabled)
|
||||
InactiveRow(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user