Add more improvements to optional tess/geo shaders

This commit is contained in:
Wojtek Figat
2024-04-04 18:35:26 +02:00
parent d12630d815
commit 84e04de23d
13 changed files with 131 additions and 39 deletions

View File

@@ -8,9 +8,13 @@ void GPUPipelineStateDX11::OnReleaseGPU()
{
BlendState = nullptr;
VS = nullptr;
#if GPU_ALLOW_TESSELLATION_SHADERS
HS = nullptr;
DS = nullptr;
#endif
#if GPU_ALLOW_GEOMETRY_SHADERS
GS = nullptr;
#endif
PS = nullptr;
}
@@ -30,9 +34,13 @@ bool GPUPipelineStateDX11::Init(const Description& desc)
// Cache shaders
VS = (GPUShaderProgramVSDX11*)desc.VS;
#if GPU_ALLOW_TESSELLATION_SHADERS
HS = desc.HS ? (GPUShaderProgramHSDX11*)desc.HS : nullptr;
DS = desc.DS ? (GPUShaderProgramDSDX11*)desc.DS : nullptr;
#endif
#if GPU_ALLOW_GEOMETRY_SHADERS
GS = desc.GS ? (GPUShaderProgramGSDX11*)desc.GS : nullptr;
#endif
PS = desc.PS ? (GPUShaderProgramPSDX11*)desc.PS : nullptr;
// Primitive Topology
@@ -44,8 +52,10 @@ bool GPUPipelineStateDX11::Init(const Description& desc)
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
};
PrimitiveTopology = D3D11_primTypes[static_cast<int32>(desc.PrimitiveTopology)];
#if GPU_ALLOW_TESSELLATION_SHADERS
if (HS)
PrimitiveTopology = (D3D11_PRIMITIVE_TOPOLOGY)((int32)D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (HS->GetControlPointsCount() - 1));
#endif
// States
DepthStencilStateIndex = static_cast<int32>(desc.DepthFunc) + (desc.DepthEnable ? 0 : 9) + (desc.DepthWriteEnable ? 0 : 18);