RHI: Replace IsFinalized/Finalize with IsValid/EnsureValid
Unified PSO validation semantics across D3D12 and OpenGL backends: - IsValid() returns whether PSO is ready to use - EnsureValid() ensures PSO is valid (compiles if needed) Behavior by backend: - D3D12: IsValid=false after creation, true after EnsureValid() with shaders - OpenGL: IsValid always=true (immediate model) Also added test_pipeline_state.cpp with 10 tests for RHIPipelineState.
This commit is contained in:
@@ -55,7 +55,8 @@ bool D3D12PipelineState::Initialize(ID3D12Device* device, const D3D12_GRAPHICS_P
|
||||
m_inputElements.push_back(desc.InputLayout.pInputElementDescs[i]);
|
||||
}
|
||||
|
||||
return Finalize();
|
||||
EnsureValid();
|
||||
return m_finalized;
|
||||
}
|
||||
|
||||
D3D12PipelineState::~D3D12PipelineState() {
|
||||
@@ -130,12 +131,13 @@ void D3D12PipelineState::SetComputeShaderBytecodes(const D3D12_SHADER_BYTECODE&
|
||||
m_csBytecode = cs;
|
||||
}
|
||||
|
||||
bool D3D12PipelineState::Finalize() {
|
||||
if (m_finalized) return true;
|
||||
void D3D12PipelineState::EnsureValid() {
|
||||
if (m_finalized) return;
|
||||
if (HasComputeShader()) {
|
||||
return CreateD3D12ComputePSO();
|
||||
CreateD3D12ComputePSO();
|
||||
} else {
|
||||
CreateD3D12PSO();
|
||||
}
|
||||
return CreateD3D12PSO();
|
||||
}
|
||||
|
||||
bool D3D12PipelineState::CreateD3D12PSO() {
|
||||
|
||||
Reference in New Issue
Block a user