Vulkan: Automatically merge render passes to the same target when possible.

Should speed things up a bit on mobile in some games that do stupid
things like GoW. Currently only enabled in GoW, but plan to enable this
globally as it should be quite cheap when nothing is detected.
This commit is contained in:
Henrik Rydgård committed 2019-08-21 20:32:23 +02:00
1 parent 16f4f525e7
commit 93412aff3b
7 files changed
+166 -1

No files matched your search

+5 -1
View File
@@ -858,7 +858,8 @@ void VulkanRenderManager::BlitFramebuffer(VKRFramebuffer *src, VkRect2D srcRect,
}
VkImageView VulkanRenderManager::BindFramebufferAsTexture(VKRFramebuffer *fb, int binding, int aspectBit, int attachment) {
// Mark the dependency and return the image.
_dbg_assert_(G3D, curRenderStep_ != nullptr);
// Mark the dependency, check for required transitions, and return the image.
for (int i = (int)steps_.size() - 1; i >= 0; i--) {
if (steps_[i]->stepType == VKRStepType::RENDER && steps_[i]->render.framebuffer == fb) {
@@ -871,6 +872,9 @@ VkImageView VulkanRenderManager::BindFramebufferAsTexture(VKRFramebuffer *fb, in
}
}
// Track dependencies fully.
curRenderStep_->dependencies.insert(fb);
if (!curRenderStep_->preTransitions.empty() &&
curRenderStep_->preTransitions.back().fb == fb &&
curRenderStep_->preTransitions.back().targetLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {