mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-23 08:39:16 +01:00
Drop exclusiveSubpass in favour of only ending RPs when attachments change
Significantly helps Mali performance by avoiding creating an excessive number of RPs.
This commit is contained in:
parent
a3f38c0cf7
commit
7133c5d6b3
@ -152,7 +152,7 @@ namespace skyline::gpu::interconnect {
|
|||||||
return gpu.megaBufferAllocator;
|
return gpu.megaBufferAllocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandExecutor::CreateRenderPassWithSubpass(vk::Rect2D renderArea, span<TextureView *> inputAttachments, span<TextureView *> colorAttachments, TextureView *depthStencilAttachment) {
|
bool CommandExecutor::CreateRenderPassWithSubpass(vk::Rect2D renderArea, span<TextureView *> inputAttachments, span<TextureView *> colorAttachments, TextureView *depthStencilAttachment, bool noSubpassCreation) {
|
||||||
auto addSubpass{[&] {
|
auto addSubpass{[&] {
|
||||||
renderPass->AddSubpass(inputAttachments, colorAttachments, depthStencilAttachment, gpu);
|
renderPass->AddSubpass(inputAttachments, colorAttachments, depthStencilAttachment, gpu);
|
||||||
|
|
||||||
@ -175,7 +175,12 @@ namespace skyline::gpu::interconnect {
|
|||||||
lastSubpassDepthStencilAttachment = depthStencilAttachment;
|
lastSubpassDepthStencilAttachment = depthStencilAttachment;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
if (renderPass == nullptr || renderPass->renderArea != renderArea || subpassCount >= gpu.traits.quirks.maxSubpassCount) {
|
bool attachmentsMatch{ranges::equal(lastSubpassInputAttachments, inputAttachments) &&
|
||||||
|
ranges::equal(lastSubpassColorAttachments, colorAttachments) &&
|
||||||
|
lastSubpassDepthStencilAttachment == depthStencilAttachment};
|
||||||
|
|
||||||
|
if (renderPass == nullptr || renderPass->renderArea != renderArea ||
|
||||||
|
((noSubpassCreation || subpassCount >= gpu.traits.quirks.maxSubpassCount) && !attachmentsMatch)) {
|
||||||
// We need to create a render pass if one doesn't already exist or the current one isn't compatible
|
// We need to create a render pass if one doesn't already exist or the current one isn't compatible
|
||||||
if (renderPass != nullptr)
|
if (renderPass != nullptr)
|
||||||
slot->nodes.emplace_back(std::in_place_type_t<node::RenderPassEndNode>());
|
slot->nodes.emplace_back(std::in_place_type_t<node::RenderPassEndNode>());
|
||||||
@ -184,9 +189,7 @@ namespace skyline::gpu::interconnect {
|
|||||||
subpassCount = 1;
|
subpassCount = 1;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (ranges::equal(lastSubpassInputAttachments, inputAttachments) &&
|
if (attachmentsMatch) {
|
||||||
ranges::equal(lastSubpassColorAttachments, colorAttachments) &&
|
|
||||||
lastSubpassDepthStencilAttachment == depthStencilAttachment) {
|
|
||||||
// The last subpass had the same attachments, so we can reuse them
|
// The last subpass had the same attachments, so we can reuse them
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -285,18 +288,12 @@ namespace skyline::gpu::interconnect {
|
|||||||
cycle->AttachObject(dependency);
|
cycle->AttachObject(dependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandExecutor::AddSubpass(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &, vk::RenderPass, u32)> &&function, vk::Rect2D renderArea, span<TextureView *> inputAttachments, span<TextureView *> colorAttachments, TextureView *depthStencilAttachment, bool exclusiveSubpass) {
|
void CommandExecutor::AddSubpass(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &, vk::RenderPass, u32)> &&function, vk::Rect2D renderArea, span<TextureView *> inputAttachments, span<TextureView *> colorAttachments, TextureView *depthStencilAttachment, bool noSubpassCreation) {
|
||||||
if (exclusiveSubpass)
|
bool gotoNext{CreateRenderPassWithSubpass(renderArea, inputAttachments, colorAttachments, depthStencilAttachment ? &*depthStencilAttachment : nullptr, noSubpassCreation)};
|
||||||
FinishRenderPass();
|
|
||||||
|
|
||||||
bool gotoNext{CreateRenderPassWithSubpass(renderArea, inputAttachments, colorAttachments, depthStencilAttachment ? &*depthStencilAttachment : nullptr)};
|
|
||||||
if (gotoNext)
|
if (gotoNext)
|
||||||
slot->nodes.emplace_back(std::in_place_type_t<node::NextSubpassFunctionNode>(), std::forward<decltype(function)>(function));
|
slot->nodes.emplace_back(std::in_place_type_t<node::NextSubpassFunctionNode>(), std::forward<decltype(function)>(function));
|
||||||
else
|
else
|
||||||
slot->nodes.emplace_back(std::in_place_type_t<node::SubpassFunctionNode>(), std::forward<decltype(function)>(function));
|
slot->nodes.emplace_back(std::in_place_type_t<node::SubpassFunctionNode>(), std::forward<decltype(function)>(function));
|
||||||
|
|
||||||
if (exclusiveSubpass)
|
|
||||||
FinishRenderPass();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandExecutor::AddOutsideRpCommand(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &)> &&function) {
|
void CommandExecutor::AddOutsideRpCommand(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &)> &&function) {
|
||||||
|
@ -127,10 +127,11 @@ namespace skyline::gpu::interconnect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a new render pass and subpass with the specified attachments, if one doesn't already exist or the current one isn't compatible
|
* @brief Create a new render pass and subpass with the specified attachments, if one doesn't already exist or the current one isn't compatible
|
||||||
|
* @param noSubpassCreation Forces creation of a renderpass when a new subpass would otherwise be created
|
||||||
* @note This also checks for subpass coalescing and will merge the new subpass with the previous one when possible
|
* @note This also checks for subpass coalescing and will merge the new subpass with the previous one when possible
|
||||||
* @return If the next subpass must be started prior to issuing any commands
|
* @return If the next subpass must be started prior to issuing any commands
|
||||||
*/
|
*/
|
||||||
bool CreateRenderPassWithSubpass(vk::Rect2D renderArea, span<TextureView *> inputAttachments, span<TextureView *> colorAttachments, TextureView *depthStencilAttachment);
|
bool CreateRenderPassWithSubpass(vk::Rect2D renderArea, span<TextureView *> inputAttachments, span<TextureView *> colorAttachments, TextureView *depthStencilAttachment, bool noSubpassCreation = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Ends a render pass if one is currently active and resets all corresponding state
|
* @brief Ends a render pass if one is currently active and resets all corresponding state
|
||||||
@ -218,7 +219,7 @@ namespace skyline::gpu::interconnect {
|
|||||||
* @param exclusiveSubpass If this subpass should be the only subpass in a render pass
|
* @param exclusiveSubpass If this subpass should be the only subpass in a render pass
|
||||||
* @note Any supplied texture should be attached prior and not undergo any persistent layout transitions till execution
|
* @note Any supplied texture should be attached prior and not undergo any persistent layout transitions till execution
|
||||||
*/
|
*/
|
||||||
void AddSubpass(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &, vk::RenderPass, u32)> &&function, vk::Rect2D renderArea, span<TextureView *> inputAttachments = {}, span<TextureView *> colorAttachments = {}, TextureView *depthStencilAttachment = {}, bool exclusiveSubpass = false);
|
void AddSubpass(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &, vk::RenderPass, u32)> &&function, vk::Rect2D renderArea, span<TextureView *> inputAttachments = {}, span<TextureView *> colorAttachments = {}, TextureView *depthStencilAttachment = {}, bool noSubpassCreation = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds a subpass that clears the entirety of the specified attachment with a color value, it may utilize VK_ATTACHMENT_LOAD_OP_CLEAR for a more efficient clear when possible
|
* @brief Adds a subpass that clears the entirety of the specified attachment with a color value, it may utilize VK_ATTACHMENT_LOAD_OP_CLEAR for a more efficient clear when possible
|
||||||
|
Loading…
Reference in New Issue
Block a user