mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Impeller] Use depth transform in framebuffer blend entities. (flutter/engine#53951)
\Without this the depth always ends up being a very large z depth of 0.5, which can cause clips to be ignored.
This commit is contained in:
parent
22116874ea
commit
fc18d5bc59
@ -117,5 +117,30 @@ TEST_P(AiksTest, ClipsUseCurrentTransform) {
|
||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||
}
|
||||
|
||||
/// If correct, this test should draw a green circle. If any red is visible,
|
||||
/// there is a depth bug.
|
||||
TEST_P(AiksTest, FramebufferBlendsRespectClips) {
|
||||
DisplayListBuilder builder;
|
||||
|
||||
// Clear the whole canvas with white.
|
||||
DlPaint paint;
|
||||
paint.setColor(DlColor::kWhite());
|
||||
builder.DrawPaint(paint);
|
||||
|
||||
builder.ClipPath(SkPath::Circle(150, 150, 50), DlCanvas::ClipOp::kIntersect);
|
||||
|
||||
// Draw a red rectangle that should not show through the circle clip.
|
||||
paint.setColor(DlColor::kRed());
|
||||
paint.setBlendMode(DlBlendMode::kMultiply);
|
||||
builder.DrawRect(SkRect::MakeXYWH(100, 100, 100, 100), paint);
|
||||
|
||||
// Draw a green circle that shows through the clip.
|
||||
paint.setColor(DlColor::kGreen());
|
||||
paint.setBlendMode(DlBlendMode::kSrcOver);
|
||||
builder.DrawCircle(SkPoint::Make(150, 150), 50, paint);
|
||||
|
||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace impeller
|
||||
|
||||
@ -365,7 +365,8 @@ std::optional<Entity> BlendFilterContents::CreateForegroundAdvancedBlend(
|
||||
FS::BindTextureSamplerDst(pass, dst_snapshot->texture, dst_sampler);
|
||||
frame_info.dst_y_coord_scale = dst_snapshot->texture->GetYCoordScale();
|
||||
|
||||
frame_info.mvp = pass.GetOrthographicTransform() * dst_snapshot->transform;
|
||||
frame_info.mvp = Entity::GetShaderTransform(entity.GetShaderClipDepth(),
|
||||
pass, dst_snapshot->transform);
|
||||
|
||||
blend_info.dst_input_alpha =
|
||||
absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
|
||||
@ -454,7 +455,8 @@ std::optional<Entity> BlendFilterContents::CreateForegroundPorterDuffBlend(
|
||||
FS::FragInfo frag_info;
|
||||
VS::FrameInfo frame_info;
|
||||
|
||||
frame_info.mvp = pass.GetOrthographicTransform() * dst_snapshot->transform;
|
||||
frame_info.mvp = Entity::GetShaderTransform(entity.GetShaderClipDepth(),
|
||||
pass, dst_snapshot->transform);
|
||||
|
||||
auto dst_sampler_descriptor = dst_snapshot->sampler_descriptor;
|
||||
if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
|
||||
|
||||
@ -644,6 +644,9 @@ impeller_Play_AiksTest_ForegroundPipelineBlendAppliesTransformCorrectly_Vulkan.p
|
||||
impeller_Play_AiksTest_FramebufferAdvancedBlendCoverage_Metal.png
|
||||
impeller_Play_AiksTest_FramebufferAdvancedBlendCoverage_OpenGLES.png
|
||||
impeller_Play_AiksTest_FramebufferAdvancedBlendCoverage_Vulkan.png
|
||||
impeller_Play_AiksTest_FramebufferBlendsRespectClips_Metal.png
|
||||
impeller_Play_AiksTest_FramebufferBlendsRespectClips_OpenGLES.png
|
||||
impeller_Play_AiksTest_FramebufferBlendsRespectClips_Vulkan.png
|
||||
impeller_Play_AiksTest_GaussianBlurAnimatedBackdrop_Metal.png
|
||||
impeller_Play_AiksTest_GaussianBlurAnimatedBackdrop_OpenGLES.png
|
||||
impeller_Play_AiksTest_GaussianBlurAnimatedBackdrop_Vulkan.png
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user