Fix PSO init to release old data on recreation

This commit is contained in:
Wojtek Figat
2025-07-31 15:08:38 +02:00
parent 08154d8fe5
commit 846a0b5685
3 changed files with 6 additions and 3 deletions

View File

@@ -31,7 +31,8 @@ bool GPUPipelineStateDX11::IsValid() const
bool GPUPipelineStateDX11::Init(const Description& desc)
{
ASSERT(!IsValid());
if (IsValid())
OnReleaseGPU();
// Cache shaders
VS = (GPUShaderProgramVSDX11*)desc.VS;

View File

@@ -135,7 +135,8 @@ void GPUPipelineStateDX12::OnReleaseGPU()
bool GPUPipelineStateDX12::Init(const Description& desc)
{
ASSERT(!IsValid());
if (IsValid())
OnReleaseGPU();
// Create description
D3D12_GRAPHICS_PIPELINE_STATE_DESC psDesc;

View File

@@ -355,7 +355,8 @@ bool GPUPipelineStateVulkan::IsValid() const
bool GPUPipelineStateVulkan::Init(const Description& desc)
{
ASSERT(!IsValid());
if (IsValid())
OnReleaseGPU();
// Reset description
RenderToolsVulkan::ZeroStruct(_desc, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO);