This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Fix EntityPassTarget::Flip with implict MSAA. #47701
Merged
auto-submit
merged 4 commits into
flutter-team-archive:main
from
jonahwilliams:linear_texture_atlas
Nov 6, 2023
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "flutter/testing/testing.h" | ||
| #include "gtest/gtest.h" | ||
| #include "impeller/entity/entity_pass_target.h" | ||
| #include "impeller/entity/entity_playground.h" | ||
|
|
||
| namespace impeller { | ||
| namespace testing { | ||
|
|
||
| using EntityPassTargetTest = EntityPlayground; | ||
| INSTANTIATE_PLAYGROUND_SUITE(EntityPassTargetTest); | ||
|
|
||
| TEST_P(EntityPassTargetTest, SwapWithMSAATexture) { | ||
| if (GetContentContext() | ||
| ->GetDeviceCapabilities() | ||
| .SupportsImplicitResolvingMSAA()) { | ||
| GTEST_SKIP() << "Implicit MSAA is used on this device."; | ||
| } | ||
| auto content_context = GetContentContext(); | ||
| auto buffer = content_context->GetContext()->CreateCommandBuffer(); | ||
| auto render_target = RenderTarget::CreateOffscreenMSAA( | ||
| *content_context->GetContext(), | ||
| *GetContentContext()->GetRenderTargetCache(), {100, 100}); | ||
|
|
||
| auto entity_pass_target = EntityPassTarget(render_target, false); | ||
|
|
||
| auto color0 = entity_pass_target.GetRenderTarget() | ||
| .GetColorAttachments() | ||
| .find(0u) | ||
| ->second; | ||
| auto msaa_tex = color0.texture; | ||
| auto resolve_tex = color0.resolve_texture; | ||
|
|
||
| entity_pass_target.Flip( | ||
| *content_context->GetContext()->GetResourceAllocator()); | ||
|
|
||
| color0 = entity_pass_target.GetRenderTarget() | ||
| .GetColorAttachments() | ||
| .find(0u) | ||
| ->second; | ||
|
|
||
| ASSERT_EQ(msaa_tex, color0.texture); | ||
| ASSERT_NE(resolve_tex, color0.resolve_texture); | ||
| } | ||
|
|
||
| TEST_P(EntityPassTargetTest, SwapWithMSAAImplicitResolve) { | ||
| if (!GetContentContext() | ||
| ->GetDeviceCapabilities() | ||
| .SupportsImplicitResolvingMSAA()) { | ||
| GTEST_SKIP() << "Implicit MSAA is not used on this device."; | ||
| } | ||
| auto content_context = GetContentContext(); | ||
| auto buffer = content_context->GetContext()->CreateCommandBuffer(); | ||
| auto render_target = RenderTarget::CreateOffscreenMSAA( | ||
| *content_context->GetContext(), | ||
| *GetContentContext()->GetRenderTargetCache(), {100, 100}); | ||
|
|
||
| auto entity_pass_target = EntityPassTarget(render_target, false); | ||
|
|
||
| auto color0 = entity_pass_target.GetRenderTarget() | ||
| .GetColorAttachments() | ||
| .find(0u) | ||
| ->second; | ||
| auto msaa_tex = color0.texture; | ||
| auto resolve_tex = color0.resolve_texture; | ||
|
|
||
| ASSERT_EQ(msaa_tex, resolve_tex); | ||
|
|
||
| entity_pass_target.Flip( | ||
| *content_context->GetContext()->GetResourceAllocator()); | ||
|
|
||
| color0 = entity_pass_target.GetRenderTarget() | ||
| .GetColorAttachments() | ||
| .find(0u) | ||
| ->second; | ||
|
|
||
| ASSERT_EQ(msaa_tex, color0.texture); | ||
| ASSERT_NE(resolve_tex, color0.resolve_texture); | ||
| ASSERT_TRUE(false); // see if this runs. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Testing if we have a CI config that has implicit MSAA
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not! I'll need to emulate this so it can be covered. |
||
| } | ||
|
|
||
| } // namespace testing | ||
| } // namespace impeller | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aside: I wish we could do a capabilities check instead, but this is better than nothing I suppose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want me to I can pass that in? I'll just do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you. I can't imagine another scenario but at least we wouldn't accidentally capture a bug versus an intent. Thanks!