Rename GPUPipelineState::Description::PrimitiveTopologyType to PrimitiveTopology

This commit is contained in:
Wojtek Figat
2023-06-19 11:53:40 +02:00
parent 7fc3b264ac
commit a6353c0bb9
9 changed files with 19 additions and 13 deletions

View File

@@ -638,10 +638,10 @@ void DebugDrawService::Update()
// Default // Default
desc.PS = shader->GetPS("PS", 0); desc.PS = shader->GetPS("PS", 0);
desc.PrimitiveTopologyType = PrimitiveTopologyType::Line; desc.PrimitiveTopology = PrimitiveTopologyType::Line;
failed |= DebugDrawPsLinesDefault.Create(desc); failed |= DebugDrawPsLinesDefault.Create(desc);
desc.PS = shader->GetPS("PS", 1); desc.PS = shader->GetPS("PS", 1);
desc.PrimitiveTopologyType = PrimitiveTopologyType::Triangle; desc.PrimitiveTopology = PrimitiveTopologyType::Triangle;
failed |= DebugDrawPsTrianglesDefault.Create(desc); failed |= DebugDrawPsTrianglesDefault.Create(desc);
desc.Wireframe = true; desc.Wireframe = true;
failed |= DebugDrawPsWireTrianglesDefault.Create(desc); failed |= DebugDrawPsWireTrianglesDefault.Create(desc);
@@ -649,10 +649,10 @@ void DebugDrawService::Update()
// Depth Test // Depth Test
desc.Wireframe = false; desc.Wireframe = false;
desc.PS = shader->GetPS("PS", 2); desc.PS = shader->GetPS("PS", 2);
desc.PrimitiveTopologyType = PrimitiveTopologyType::Line; desc.PrimitiveTopology = PrimitiveTopologyType::Line;
failed |= DebugDrawPsLinesDepthTest.Create(desc); failed |= DebugDrawPsLinesDepthTest.Create(desc);
desc.PS = shader->GetPS("PS", 3); desc.PS = shader->GetPS("PS", 3);
desc.PrimitiveTopologyType = PrimitiveTopologyType::Triangle; desc.PrimitiveTopology = PrimitiveTopologyType::Triangle;
failed |= DebugDrawPsTrianglesDepthTest.Create(desc); failed |= DebugDrawPsTrianglesDepthTest.Create(desc);
desc.Wireframe = true; desc.Wireframe = true;
failed |= DebugDrawPsWireTrianglesDepthTest.Create(desc); failed |= DebugDrawPsWireTrianglesDepthTest.Create(desc);

View File

@@ -72,7 +72,7 @@ public:
/// <summary> /// <summary>
/// Input primitives topology /// Input primitives topology
/// </summary> /// </summary>
API_FIELD() PrimitiveTopologyType PrimitiveTopologyType; API_FIELD() PrimitiveTopologyType PrimitiveTopology;
/// <summary> /// <summary>
/// True if use wireframe rendering, otherwise false /// True if use wireframe rendering, otherwise false

View File

@@ -43,7 +43,7 @@ bool GPUPipelineStateDX11::Init(const Description& desc)
D3D11_PRIMITIVE_TOPOLOGY_LINELIST, D3D11_PRIMITIVE_TOPOLOGY_LINELIST,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
}; };
PrimitiveTopology = D3D11_primTypes[static_cast<int32>(desc.PrimitiveTopologyType)]; PrimitiveTopology = D3D11_primTypes[static_cast<int32>(desc.PrimitiveTopology)];
if (HS) if (HS)
PrimitiveTopology = (D3D11_PRIMITIVE_TOPOLOGY)((int32)D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (HS->GetControlPointsCount() - 1)); PrimitiveTopology = (D3D11_PRIMITIVE_TOPOLOGY)((int32)D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (HS->GetControlPointsCount() - 1));

View File

@@ -223,6 +223,7 @@ void GPUContextDX12::Reset()
_srMaskDirtyGraphics = 0; _srMaskDirtyGraphics = 0;
_srMaskDirtyCompute = 0; _srMaskDirtyCompute = 0;
_stencilRef = 0; _stencilRef = 0;
_primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
_psDirtyFlag = false; _psDirtyFlag = false;
_isCompute = false; _isCompute = false;
_currentCompute = nullptr; _currentCompute = nullptr;
@@ -545,7 +546,11 @@ void GPUContextDX12::flushPS()
// Change state // Change state
ASSERT(_currentState->IsValid()); ASSERT(_currentState->IsValid());
_commandList->SetPipelineState(_currentState->GetState(_rtDepth, _rtCount, _rtHandles)); _commandList->SetPipelineState(_currentState->GetState(_rtDepth, _rtCount, _rtHandles));
_commandList->IASetPrimitiveTopology(_currentState->PrimitiveTopologyType); if (_primitiveTopology != _currentState->PrimitiveTopology)
{
_primitiveTopology = _currentState->PrimitiveTopology;
_commandList->IASetPrimitiveTopology(_primitiveTopology);
}
RENDER_STAT_PS_STATE_CHANGE(); RENDER_STAT_PS_STATE_CHANGE();
} }

View File

@@ -48,6 +48,7 @@ private:
uint32 _srMaskDirtyGraphics; uint32 _srMaskDirtyGraphics;
uint32 _srMaskDirtyCompute; uint32 _srMaskDirtyCompute;
uint32 _stencilRef; uint32 _stencilRef;
D3D_PRIMITIVE_TOPOLOGY _primitiveTopology;
int32 _isCompute : 1; int32 _isCompute : 1;
int32 _rtDirtyFlag : 1; int32 _rtDirtyFlag : 1;

View File

@@ -157,12 +157,12 @@ bool GPUPipelineStateDX12::Init(const Description& desc)
D3D_PRIMITIVE_TOPOLOGY_LINELIST, D3D_PRIMITIVE_TOPOLOGY_LINELIST,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
}; };
psDesc.PrimitiveTopologyType = primTypes1[(int32)desc.PrimitiveTopologyType]; psDesc.PrimitiveTopologyType = primTypes1[(int32)desc.PrimitiveTopology];
PrimitiveTopologyType = primTypes2[(int32)desc.PrimitiveTopologyType]; PrimitiveTopology = primTypes2[(int32)desc.PrimitiveTopology];
if (desc.HS) if (desc.HS)
{ {
psDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH; psDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH;
PrimitiveTopologyType = (D3D_PRIMITIVE_TOPOLOGY)((int32)D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (desc.HS->GetControlPointsCount() - 1)); PrimitiveTopology = (D3D_PRIMITIVE_TOPOLOGY)((int32)D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (desc.HS->GetControlPointsCount() - 1));
} }
// Depth State // Depth State

View File

@@ -55,7 +55,7 @@ public:
public: public:
D3D_PRIMITIVE_TOPOLOGY PrimitiveTopologyType = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; D3D_PRIMITIVE_TOPOLOGY PrimitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
DxShaderHeader Header; DxShaderHeader Header;
/// <summary> /// <summary>

View File

@@ -239,7 +239,7 @@ bool GPUPipelineStateVulkan::Init(const Description& desc)
// Input Assembly // Input Assembly
RenderToolsVulkan::ZeroStruct(_descInputAssembly, VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO);; RenderToolsVulkan::ZeroStruct(_descInputAssembly, VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO);;
switch (desc.PrimitiveTopologyType) switch (desc.PrimitiveTopology)
{ {
case PrimitiveTopologyType::Point: case PrimitiveTopologyType::Point:
_descInputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST; _descInputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;

View File

@@ -157,7 +157,7 @@ bool DepthOfFieldPass::setupResources()
psDesc.GS = shader->GetGS("GS_Bokeh"); psDesc.GS = shader->GetGS("GS_Bokeh");
psDesc.PS = shader->GetPS("PS_Bokeh"); psDesc.PS = shader->GetPS("PS_Bokeh");
psDesc.BlendMode = BlendingMode::Additive; psDesc.BlendMode = BlendingMode::Additive;
psDesc.PrimitiveTopologyType = PrimitiveTopologyType::Point; psDesc.PrimitiveTopology = PrimitiveTopologyType::Point;
if (_psBokeh->Init(psDesc)) if (_psBokeh->Init(psDesc))
return true; return true;
} }