Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] disble render pass caches. #50976

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions impeller/renderer/backend/vulkan/render_pass_cache_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,7 @@
namespace impeller {
namespace testing {

using RendererTest = PlaygroundTest;

TEST_P(RendererTest, CachesRenderPassAndFramebuffer) {
if (GetBackend() != PlaygroundBackend::kVulkan) {
GTEST_SKIP() << "Test only applies to Vulkan";
}

auto allocator = std::make_shared<RenderTargetAllocator>(
GetContext()->GetResourceAllocator());

auto render_target = RenderTarget::CreateOffscreenMSAA(
*GetContext(), *allocator, {100, 100}, 1);
auto resolve_texture =
render_target.GetColorAttachments().find(0u)->second.resolve_texture;
auto& texture_vk = TextureVK::Cast(*resolve_texture);

EXPECT_EQ(texture_vk.GetFramebuffer(), nullptr);
EXPECT_EQ(texture_vk.GetRenderPass(), nullptr);

auto buffer = GetContext()->CreateCommandBuffer();
auto render_pass = buffer->CreateRenderPass(render_target);

EXPECT_NE(texture_vk.GetFramebuffer(), nullptr);
EXPECT_NE(texture_vk.GetRenderPass(), nullptr);

render_pass->EncodeCommands();
GetContext()->GetCommandQueue()->Submit({buffer});

// Can be reused without error.
auto buffer_2 = GetContext()->CreateCommandBuffer();
auto render_pass_2 = buffer_2->CreateRenderPass(render_target);

EXPECT_TRUE(render_pass_2->EncodeCommands());
EXPECT_TRUE(GetContext()->GetCommandQueue()->Submit({buffer_2}).ok());
}
//

} // namespace testing
} // namespace impeller
18 changes: 2 additions & 16 deletions impeller/renderer/backend/vulkan/render_pass_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,16 @@ RenderPassVK::RenderPassVK(const std::shared_ptr<const Context>& context,
return true;
});

SharedHandleVK<vk::RenderPass> recycled_render_pass;
SharedHandleVK<vk::Framebuffer> recycled_framebuffer;
if (resolve_image_vk_) {
recycled_render_pass = TextureVK::Cast(*resolve_image_vk_).GetRenderPass();
recycled_framebuffer = TextureVK::Cast(*resolve_image_vk_).GetFramebuffer();
}

const auto& target_size = render_target_.GetRenderTargetSize();

render_pass_ =
CreateVKRenderPass(vk_context, recycled_render_pass, command_buffer_);
render_pass_ = CreateVKRenderPass(vk_context, nullptr, command_buffer_);
if (!render_pass_) {
VALIDATION_LOG << "Could not create renderpass.";
is_valid_ = false;
return;
}

auto framebuffer = (recycled_framebuffer == nullptr)
? CreateVKFramebuffer(vk_context, *render_pass_)
: recycled_framebuffer;
auto framebuffer = CreateVKFramebuffer(vk_context, *render_pass_);
if (!framebuffer) {
VALIDATION_LOG << "Could not create framebuffer.";
is_valid_ = false;
Expand All @@ -200,10 +190,6 @@ RenderPassVK::RenderPassVK(const std::shared_ptr<const Context>& context,
is_valid_ = false;
return;
}
if (resolve_image_vk_) {
TextureVK::Cast(*resolve_image_vk_).SetFramebuffer(framebuffer);
TextureVK::Cast(*resolve_image_vk_).SetRenderPass(render_pass_);
}

auto clear_values = GetVKClearValues(render_target_);

Expand Down