mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-23 05:39:18 +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;
|
||||
}
|
||||
|
||||
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{[&] {
|
||||
renderPass->AddSubpass(inputAttachments, colorAttachments, depthStencilAttachment, gpu);
|
||||
|
||||
@ -175,7 +175,12 @@ namespace skyline::gpu::interconnect {
|
||||
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
|
||||
if (renderPass != nullptr)
|
||||
slot->nodes.emplace_back(std::in_place_type_t<node::RenderPassEndNode>());
|
||||
@ -184,9 +189,7 @@ namespace skyline::gpu::interconnect {
|
||||
subpassCount = 1;
|
||||
return false;
|
||||
} else {
|
||||
if (ranges::equal(lastSubpassInputAttachments, inputAttachments) &&
|
||||
ranges::equal(lastSubpassColorAttachments, colorAttachments) &&
|
||||
lastSubpassDepthStencilAttachment == depthStencilAttachment) {
|
||||
if (attachmentsMatch) {
|
||||
// The last subpass had the same attachments, so we can reuse them
|
||||
return false;
|
||||
} else {
|
||||
@ -285,18 +288,12 @@ namespace skyline::gpu::interconnect {
|
||||
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) {
|
||||
if (exclusiveSubpass)
|
||||
FinishRenderPass();
|
||||
|
||||
bool gotoNext{CreateRenderPassWithSubpass(renderArea, inputAttachments, colorAttachments, depthStencilAttachment ? &*depthStencilAttachment : nullptr)};
|
||||
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) {
|
||||
bool gotoNext{CreateRenderPassWithSubpass(renderArea, inputAttachments, colorAttachments, depthStencilAttachment ? &*depthStencilAttachment : nullptr, noSubpassCreation)};
|
||||
if (gotoNext)
|
||||
slot->nodes.emplace_back(std::in_place_type_t<node::NextSubpassFunctionNode>(), std::forward<decltype(function)>(function));
|
||||
else
|
||||
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) {
|
||||
|
@ -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
|
||||
* @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
|
||||
* @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
|
||||
@ -218,7 +219,7 @@ namespace skyline::gpu::interconnect {
|
||||
* @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
|
||||
*/
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user