feat: Implement render graph support in Vulkan backend

- Added RecordRenderGraph method to IRenderCommandService and its implementation in RenderCommandService.
- Updated VulkanGraphicsBackend to handle render graph definitions and record commands accordingly.
- Introduced GetDepthFormat method in ISwapchainService to retrieve depth buffer format.
- Enhanced VulkanGraphicsBackend with methods to set render graph definitions and manage render graph resources.
- Added RenderGraphImage structure to manage render targets and depth targets within the render graph.
- Updated interfaces and services to accommodate new render graph functionality, including descriptor set layout retrieval in IPipelineService.
This commit is contained in:
2026-01-06 02:02:52 +00:00
parent b11a2f9e30
commit fb71265a5b
15 changed files with 1349 additions and 9 deletions
+14 -1
View File
@@ -220,7 +220,12 @@ bool VulkanGraphicsBackend::EndFrame(GraphicsDeviceHandle device) {
logger_->Trace("VulkanGraphicsBackend", "EndFrame");
// Record all accumulated commands
renderCommandService_->RecordCommands(currentImageIndex_, frameCommands_, currentViewProj_);
if (renderGraphEnabled_) {
renderCommandService_->RecordRenderGraph(currentImageIndex_, renderGraphDefinition_,
frameCommands_, currentViewProj_);
} else {
renderCommandService_->RecordCommands(currentImageIndex_, frameCommands_, currentViewProj_);
}
// End the frame
return renderCommandService_->EndFrame(currentImageIndex_);
@@ -231,6 +236,14 @@ void VulkanGraphicsBackend::SetViewProjection(const std::array<float, 16>& viewP
currentViewProj_ = viewProj;
}
void VulkanGraphicsBackend::SetRenderGraphDefinition(const RenderGraphDefinition& definition) {
logger_->Trace("VulkanGraphicsBackend", "SetRenderGraphDefinition",
"resources=" + std::to_string(definition.resources.size()) +
", passes=" + std::to_string(definition.passes.size()));
renderGraphDefinition_ = definition;
renderGraphEnabled_ = !definition.passes.empty();
}
void VulkanGraphicsBackend::Draw(GraphicsDeviceHandle device, GraphicsPipelineHandle pipeline,
GraphicsBufferHandle vertexBuffer, GraphicsBufferHandle indexBuffer,
uint32_t indexCount, const std::array<float, 16>& modelMatrix) {