Refactor viewport to have X/Y separate members instead of TopLeft[2]

This commit is contained in:
baldurk
2017-04-04 21:12:58 +01:00
parent f1df7423e2
commit 8262bd2770
5 changed files with 23 additions and 28 deletions
+4 -4
View File
@@ -119,15 +119,15 @@ Viewport CommonPipelineState::GetViewport(int index)
{
if(IsLogD3D11() && index < m_D3D11->m_RS.Viewports.count)
{
ret.x = m_D3D11->m_RS.Viewports[index].TopLeft[0];
ret.y = m_D3D11->m_RS.Viewports[index].TopLeft[1];
ret.x = m_D3D11->m_RS.Viewports[index].X;
ret.y = m_D3D11->m_RS.Viewports[index].Y;
ret.width = m_D3D11->m_RS.Viewports[index].Width;
ret.height = m_D3D11->m_RS.Viewports[index].Height;
}
else if(IsLogD3D12() && index < m_D3D12->m_RS.Viewports.count)
{
ret.x = m_D3D12->m_RS.Viewports[index].TopLeft[0];
ret.y = m_D3D12->m_RS.Viewports[index].TopLeft[1];
ret.x = m_D3D12->m_RS.Viewports[index].X;
ret.y = m_D3D12->m_RS.Viewports[index].Y;
ret.width = m_D3D12->m_RS.Viewports[index].Width;
ret.height = m_D3D12->m_RS.Viewports[index].Height;
}
@@ -1456,8 +1456,7 @@ void D3D11PipelineStateViewer::setState()
if(v.Enabled || ui->showEmpty->isChecked())
{
QTreeWidgetItem *node =
makeTreeNode({i, v.TopLeft[0], v.TopLeft[1], v.Width, v.Height, v.MinDepth, v.MaxDepth});
QTreeWidgetItem *node = makeTreeNode({i, v.X, v.Y, v.Width, v.Height, v.MinDepth, v.MaxDepth});
if(v.Width == 0 || v.Height == 0 || v.MinDepth == v.MaxDepth)
setEmptyRow(node);
@@ -1473,8 +1473,7 @@ void D3D12PipelineStateViewer::setState()
{
const D3D12Pipe::Viewport &v = state.m_RS.Viewports[i];
QTreeWidgetItem *node =
makeTreeNode({i, v.TopLeft[0], v.TopLeft[1], v.Width, v.Height, v.MinDepth, v.MaxDepth});
QTreeWidgetItem *node = makeTreeNode({i, v.X, v.Y, v.Width, v.Height, v.MinDepth, v.MaxDepth});
if(v.Width == 0 || v.Height == 0 || v.MinDepth == v.MaxDepth)
setEmptyRow(node);
+9 -9
View File
@@ -191,20 +191,20 @@ struct SO
struct Viewport
{
Viewport() : Width(0.0f), Height(0.0f), MinDepth(0.0f), MaxDepth(0.0f), Enabled(false)
Viewport()
: X(0.0f), Y(0.0f), 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)
: X(TX), Y(TY), 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;
float X;
float Y;
float Width;
float Height;
float MinDepth;
float MaxDepth;
bool32 Enabled;
};
+8 -11
View File
@@ -220,20 +220,17 @@ struct Streamout
struct Viewport
{
Viewport() : Width(0.0f), Height(0.0f), MinDepth(0.0f), MaxDepth(0.0f)
{
TopLeft[0] = 0.0f;
TopLeft[1] = 0.0f;
}
Viewport() : X(0.0f), Y(0.0f), Width(0.0f), Height(0.0f), MinDepth(0.0f), MaxDepth(0.0f) {}
Viewport(float TX, float TY, float W, float H, float MN, float MX)
: Width(W), Height(H), MinDepth(MN), MaxDepth(MX)
: X(TX), Y(TY), Width(W), Height(H), MinDepth(MN), MaxDepth(MX)
{
TopLeft[0] = TX;
TopLeft[1] = TY;
}
float TopLeft[2];
float Width, Height;
float MinDepth, MaxDepth;
float X;
float Y;
float Width;
float Height;
float MinDepth;
float MaxDepth;
};
struct Scissor