Skip to content

[Impeller] fix playground validation errors in imgui overlay.#167491

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
jonahwilliams:fix_foo_2
Apr 24, 2025
Merged

[Impeller] fix playground validation errors in imgui overlay.#167491
auto-submit[bot] merged 2 commits into
flutter:masterfrom
jonahwilliams:fix_foo_2

Conversation

@jonahwilliams

Copy link
Copy Markdown
Contributor

Fixes #167316

Recycling the render passes didn't account for a render pass changing from MSAA to non-MSAA.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Apr 21, 2025
@jonahwilliams jonahwilliams requested a review from gaaclarke April 21, 2025 19:29

namespace impeller {

// These methods should only be used by render_pass_vk.h

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Methods" is the appropriate term, "fields" is probably what you want.

Comment on lines +161 to +165
if (sample_count != frame_data.sample_count) {
frame_data.framebuffer = nullptr;
frame_data.render_pass = nullptr;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of clearing out the cached data if it doesn't have the right sample counts, should we instead be caching based on the sample count? This will cause thrashing in the cache in playgrounds where something is cached then thrown away directly, no? This isn't a big deal for playgrounds, my concern is that we'd accidentally introduce this behavior in production and it would take effort to figure out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its unlikely to be a problem in a real application as the render_target_cache actually separates MSAA and non-MSAA allocations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By effectively not caching in playgrounds but caching in production we are opening ourselves up to bugs that can only be reproduced in production, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only going to happen with the imgui overlay active though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In playgrounds we do the imgui pass regardless if there is some imgui overlay active though. The test I was using was CanDrawCapsAndJoins which doesn't have any visual change from imgui.

The golden tests don't have the imgui pass though.

This feels fragile to me. What argument is there against adding TextureSourceVK::GetCachedFrameData(size_t sample_count)?

Alternatively, I think instead of nulling out the cached value when it doesn't match our needs we can just put it back. That way we wouldn't be thrashing. We'd still be caching when it's possible and creating a new one when it isn't. That makes the worst case scenario less worse.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use it for the goldens though, and AFAIK that is what is actually running on CI?

@jonahwilliams jonahwilliams requested a review from gaaclarke April 24, 2025 15:46

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 24, 2025
@auto-submit auto-submit Bot added this pull request to the merge queue Apr 24, 2025
Merged via the queue into flutter:master with commit d2d453f Apr 24, 2025
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 24, 2025
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
…r#167491)

Fixes flutter#167316

Recycling the render passes didn't account for a render pass changing
from MSAA to non-MSAA.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vulkan playgrounds failing with vulkan validation

2 participants