Implement IShader and ISwapChain interfaces for D3D12 backend

- D3D12Shader now implements IShader interface with GetBytecode, GetBytecodeSize, GetType, GetInputLayout
- D3D12SwapChain now implements ISwapChain interface with GetBackBuffer returning IResource*
- Added D3D12Texture back buffer storage to SwapChain
- Fixed ISwapChain const correctness (GetCurrentBackBufferIndex, GetBackBuffer)
- main.cpp: use GetD3D12Bytecode() instead of GetBytecode() for PSO creation
This commit is contained in:
2026-03-16 12:38:17 +08:00
parent f4d94bda3d
commit 554c48448b
10 changed files with 84 additions and 46 deletions

View File

@@ -57,7 +57,7 @@ void D3D12Shader::Shutdown() {
m_error.Reset();
}
const D3D12_SHADER_BYTECODE D3D12Shader::GetBytecode() const {
const D3D12_SHADER_BYTECODE D3D12Shader::GetD3D12Bytecode() const {
D3D12_SHADER_BYTECODE bytecode = {};
if (m_bytecode) {
bytecode.pShaderBytecode = m_bytecode->GetBufferPointer();
@@ -66,5 +66,27 @@ const D3D12_SHADER_BYTECODE D3D12Shader::GetBytecode() const {
return bytecode;
}
const void* D3D12Shader::GetBytecode() const {
if (m_bytecode) {
return m_bytecode->GetBufferPointer();
}
return nullptr;
}
size_t D3D12Shader::GetBytecodeSize() const {
if (m_bytecode) {
return m_bytecode->GetBufferSize();
}
return 0;
}
const InputLayoutDesc& D3D12Shader::GetInputLayout() const {
return m_inputLayout;
}
ShaderType D3D12Shader::GetType() const {
return m_type;
}
} // namespace RHI
} // namespace XCEngine