- 添加 D3D12PipelineState.h/cpp - 全局变量 gPipelineState - 使用 D3D12PipelineState::Initialize 替代原生 CreateGraphicsPipelineState - 测试通过
27 lines
593 B
C++
27 lines
593 B
C++
#include "XCEngine/RHI/D3D12/D3D12PipelineState.h"
|
|
|
|
namespace XCEngine {
|
|
namespace RHI {
|
|
|
|
D3D12PipelineState::D3D12PipelineState() {
|
|
}
|
|
|
|
D3D12PipelineState::~D3D12PipelineState() {
|
|
Shutdown();
|
|
}
|
|
|
|
bool D3D12PipelineState::Initialize(ID3D12Device* device, const D3D12_GRAPHICS_PIPELINE_STATE_DESC& desc) {
|
|
HRESULT hResult = device->CreateGraphicsPipelineState(&desc, IID_PPV_ARGS(&m_pipelineState));
|
|
if (FAILED(hResult)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void D3D12PipelineState::Shutdown() {
|
|
m_pipelineState.Reset();
|
|
}
|
|
|
|
} // namespace RHI
|
|
} // namespace XCEngine
|