Skip to content

Commit 971b1af

Browse files
committed
Keep kDefaultMipBias in supports_decal > 0.0 branch and remove redundant test
1 parent 7c3c4bf commit 971b1af

3 files changed

Lines changed: 17 additions & 104 deletions

File tree

‎engine/src/flutter/impeller/display_list/aiks_dl_blend_unittests.cc‎

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "flutter/display_list/dl_paint.h"
1919
#include "flutter/impeller/display_list/dl_image_impeller.h"
2020
#include "flutter/impeller/geometry/scalar.h"
21-
#include "fml/synchronization/count_down_latch.h"
22-
#include "impeller/core/device_buffer.h"
2321
#include "impeller/display_list/aiks_context.h"
2422
#include "impeller/display_list/dl_dispatcher.h"
2523
#include "impeller/playground/playground.h"
@@ -829,91 +827,6 @@ TEST_P(AiksTest, FramebufferAdvancedBlendCoverage) {
829827
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
830828
}
831829

832-
TEST_P(AiksTest,
833-
FramebufferBlendDoesNotApplyMipBiasWhenHardwareDecalSupported) {
834-
std::shared_ptr<Context> context = GetContext();
835-
const auto& caps = context->GetCapabilities();
836-
if (!caps->SupportsFramebufferFetch() ||
837-
!caps->SupportsDecalSamplerAddressMode()) {
838-
GTEST_SKIP() << "Requires framebuffer fetch and hardware decal support.";
839-
}
840-
841-
// Mip 0 (8x8) is transparent black (0); mip 1 (4x4) is opaque white (255).
842-
// Drawing at 0.5x scale selects LOD = 1.0 (white) when framebuffer_blend.frag
843-
// takes the unbiased hardware decal path (`supports_decal > 0.0`). With the
844-
// old `supports_decal > 1` check, `1.0 > 1` was false and `IPSampleDecal`
845-
// applied `kDefaultMipBias = -0.475` (LOD = 0.525), dropping output to ~134.
846-
TextureDescriptor tex_desc;
847-
tex_desc.storage_mode = StorageMode::kDevicePrivate;
848-
tex_desc.format = PixelFormat::kR8G8B8A8UNormInt;
849-
tex_desc.size = ISize{8, 8};
850-
tex_desc.mip_count = 2u;
851-
tex_desc.usage = TextureUsage::kShaderRead;
852-
auto mip_texture = context->GetResourceAllocator()->CreateTexture(tex_desc);
853-
ASSERT_TRUE(mip_texture);
854-
855-
const std::vector<uint8_t> mip0_clear(8 * 8 * 4, 0);
856-
const std::vector<uint8_t> mip1_white(4 * 4 * 4, 255);
857-
auto buf0 = context->GetResourceAllocator()->CreateBufferWithCopy(
858-
mip0_clear.data(), mip0_clear.size());
859-
ASSERT_TRUE(buf0);
860-
auto buf1 = context->GetResourceAllocator()->CreateBufferWithCopy(
861-
mip1_white.data(), mip1_white.size());
862-
ASSERT_TRUE(buf1);
863-
{
864-
auto cmd = context->CreateCommandBuffer();
865-
auto blit = cmd->CreateBlitPass();
866-
ASSERT_TRUE(blit->AddCopy(DeviceBuffer::AsBufferView(buf0), mip_texture,
867-
IRect::MakeSize(ISize{8, 8}), "mip0", 0u));
868-
ASSERT_TRUE(blit->AddCopy(DeviceBuffer::AsBufferView(buf1), mip_texture,
869-
IRect::MakeSize(ISize{4, 4}), "mip1", 1u));
870-
ASSERT_TRUE(blit->ConvertTextureToShaderRead(mip_texture));
871-
ASSERT_TRUE(blit->EncodeCommands());
872-
ASSERT_TRUE(context->GetCommandQueue()->Submit({cmd}).ok());
873-
}
874-
875-
DisplayListBuilder builder;
876-
builder.DrawPaint(DlPaint().setColor(DlColor::kBlack()));
877-
builder.Scale(0.5f, 0.5f);
878-
DlPaint blend_paint;
879-
blend_paint.setBlendMode(DlBlendMode::kScreen);
880-
builder.DrawImage(DlImageImpeller::Make(mip_texture), DlPoint(0, 0),
881-
DlImageSampling::kMipmapLinear, &blend_paint);
882-
883-
AiksContext renderer(context, nullptr);
884-
auto out_texture =
885-
DisplayListToTexture(builder.Build(), ISize{4, 4}, renderer);
886-
ASSERT_TRUE(out_texture);
887-
888-
DeviceBufferDescriptor readback_desc;
889-
readback_desc.size =
890-
out_texture->GetTextureDescriptor().GetByteSizeOfBaseMipLevel();
891-
readback_desc.readback = true;
892-
readback_desc.storage_mode = StorageMode::kHostVisible;
893-
auto readback = context->GetResourceAllocator()->CreateBuffer(readback_desc);
894-
ASSERT_TRUE(readback);
895-
{
896-
auto cmd = context->CreateCommandBuffer();
897-
auto blit = cmd->CreateBlitPass();
898-
ASSERT_TRUE(blit->AddCopy(out_texture, readback));
899-
ASSERT_TRUE(blit->EncodeCommands());
900-
auto latch = std::make_shared<fml::CountDownLatch>(1u);
901-
ASSERT_TRUE(
902-
context->GetCommandQueue()
903-
->Submit({cmd},
904-
[latch](CommandBuffer::Status) { latch->CountDown(); })
905-
.ok());
906-
latch->Wait();
907-
}
908-
909-
const uint8_t* contents = readback->OnGetContents();
910-
ASSERT_TRUE(contents);
911-
const uint8_t* pixel = contents + (2 * 4 + 2) * 4;
912-
EXPECT_GE(pixel[0], 253u);
913-
EXPECT_GE(pixel[1], 253u);
914-
EXPECT_GE(pixel[2], 253u);
915-
}
916-
917830
TEST_P(AiksTest, ColorWheel) {
918831
// Compare with https://fiddle.skia.org/c/@BlendModes
919832

‎engine/src/flutter/impeller/entity/shaders/blending/framebuffer_blend.frag‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ out vec4 frag_color;
5555

5656
vec4 Sample(sampler2D texture_sampler, vec2 texture_coords) {
5757
if (supports_decal > 0.0) {
58-
return texture(texture_sampler, texture_coords);
58+
return texture(texture_sampler, texture_coords, kDefaultMipBias);
5959
}
6060
return IPSampleDecal(texture_sampler, texture_coords);
6161
}

‎engine/src/flutter/impeller/tools/malioc.json‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,8 +1729,8 @@
17291729
"longest_path_cycles": [
17301730
0.78125,
17311731
0.78125,
1732-
0.625,
1733-
0.625,
1732+
0.4375,
1733+
0.5625,
17341734
0.0,
17351735
0.25,
17361736
1.25
@@ -1746,25 +1746,25 @@
17461746
],
17471747
"shortest_path_bound_pipelines": [
17481748
"arith_total",
1749-
"arith_sfu"
1749+
"arith_fma"
17501750
],
17511751
"shortest_path_cycles": [
1752-
0.625,
17531752
0.59375,
1754-
0.421875,
1755-
0.625,
1753+
0.59375,
1754+
0.3125,
1755+
0.5625,
17561756
0.0,
17571757
0.25,
1758-
0.0
1758+
0.25
17591759
],
17601760
"total_bound_pipelines": [
17611761
"texture"
17621762
],
17631763
"total_cycles": [
17641764
0.78125,
17651765
0.78125,
1766-
0.625,
1767-
0.625,
1766+
0.4375,
1767+
0.5625,
17681768
0.0,
17691769
0.25,
17701770
1.25
@@ -4520,8 +4520,8 @@
45204520
"longest_path_cycles": [
45214521
0.53125,
45224522
0.53125,
4523-
0.40625,
4524-
0.1875,
4523+
0.21875,
4524+
0.125,
45254525
0.0,
45264526
0.25,
45274527
0.25
@@ -4542,11 +4542,11 @@
45424542
"shortest_path_cycles": [
45434543
0.53125,
45444544
0.53125,
4545-
0.296875,
45464545
0.1875,
4546+
0.125,
45474547
0.0,
45484548
0.25,
4549-
0.0
4549+
0.25
45504550
],
45514551
"total_bound_pipelines": [
45524552
"arith_total",
@@ -4555,8 +4555,8 @@
45554555
"total_cycles": [
45564556
0.53125,
45574557
0.53125,
4558-
0.40625,
4559-
0.1875,
4558+
0.21875,
4559+
0.125,
45604560
0.0,
45614561
0.25,
45624562
0.25
@@ -4565,7 +4565,7 @@
45654565
"stack_spill_bytes": 0,
45664566
"thread_occupancy": 100,
45674567
"uniform_registers_used": 6,
4568-
"work_registers_used": 21
4568+
"work_registers_used": 25
45694569
}
45704570
}
45714571
}

0 commit comments

Comments
 (0)