Implement a way to run non-graphics passes with command executor

These commands will end the current renderpass and run on their own, this is useful for compute, blits etc.
This commit is contained in:
Robin Kertels 2022-04-13 22:04:26 +01:00 committed by PixelyIon
parent feb179fcff
commit 036faedabd
2 changed files with 16 additions and 0 deletions

View File

@ -58,6 +58,17 @@ namespace skyline::gpu::interconnect {
nodes.emplace_back(std::in_place_type_t<node::NextSubpassFunctionNode>(), std::forward<std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &, vk::RenderPass, u32)>>(function)); nodes.emplace_back(std::in_place_type_t<node::NextSubpassFunctionNode>(), std::forward<std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &, vk::RenderPass, u32)>>(function));
} }
void CommandExecutor::AddNonGraphicsPass(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &)> &&function) {
// End render pass
if (renderPass) {
nodes.emplace_back(std::in_place_type_t<node::RenderPassEndNode>());
renderPass = nullptr;
subpassCount = 0;
}
nodes.emplace_back(std::in_place_type_t<node::FunctionNode>(), std::forward<decltype(function)>(function));
}
void CommandExecutor::AddClearColorSubpass(TextureView *attachment, const vk::ClearColorValue &value) { void CommandExecutor::AddClearColorSubpass(TextureView *attachment, const vk::ClearColorValue &value) {
bool newRenderPass{CreateRenderPass(vk::Rect2D{ bool newRenderPass{CreateRenderPass(vk::Rect2D{
.extent = attachment->texture->dimensions, .extent = attachment->texture->dimensions,

View File

@ -73,6 +73,11 @@ namespace skyline::gpu::interconnect {
*/ */
void AddClearDepthStencilSubpass(TextureView *attachment, const vk::ClearDepthStencilValue &value); void AddClearDepthStencilSubpass(TextureView *attachment, const vk::ClearDepthStencilValue &value);
/**
* @brief Adds a non graphics pass that can be used to execute arbitrary commands outside of a render pass
*/
void AddNonGraphicsPass(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &)> &&function);
/** /**
* @brief Execute all the nodes and submit the resulting command buffer to the GPU * @brief Execute all the nodes and submit the resulting command buffer to the GPU
*/ */