feat(RHI): 实现 RHISwapChain 抽象基类

This commit is contained in:
2026-03-17 18:05:40 +08:00
parent 55865a0252
commit 354b6a5cfc
6 changed files with 163 additions and 17 deletions

View File

@@ -105,5 +105,19 @@ void* D3D12SwapChain::GetNativeHandle() const {
return reinterpret_cast<void*>(m_swapChain.Get());
}
RHITexture* D3D12SwapChain::GetCurrentBackBuffer() {
return GetBackBuffer(GetCurrentBackBufferIndex());
}
bool D3D12SwapChain::ShouldClose() const {
return false;
}
void D3D12SwapChain::SetShouldClose(bool shouldClose) {
}
void D3D12SwapChain::PollEvents() {
}
} // namespace RHI
} // namespace XCEngine

View File

@@ -116,5 +116,34 @@ void OpenGLSwapChain::PollEvents() {
glfwPollEvents();
}
void OpenGLSwapChain::Present(uint32_t syncInterval, uint32_t flags) {
if (m_window) {
glfwSwapBuffers(m_window);
}
}
void OpenGLSwapChain::Resize(uint32_t width, uint32_t height) {
Resize(static_cast<int>(width), static_cast<int>(height));
}
void OpenGLSwapChain::SetFullscreen(bool fullscreen) {
}
bool OpenGLSwapChain::IsFullscreen() const {
return false;
}
uint32_t OpenGLSwapChain::GetCurrentBackBufferIndex() const {
return 0;
}
RHITexture* OpenGLSwapChain::GetCurrentBackBuffer() {
return nullptr;
}
void* OpenGLSwapChain::GetNativeHandle() {
return nullptr;
}
} // namespace RHI
} // namespace XCEngine