|
18 | 18 | #include "flutter/display_list/dl_paint.h" |
19 | 19 | #include "flutter/impeller/display_list/dl_image_impeller.h" |
20 | 20 | #include "flutter/impeller/geometry/scalar.h" |
21 | | -#include "fml/synchronization/count_down_latch.h" |
22 | | -#include "impeller/core/device_buffer.h" |
23 | 21 | #include "impeller/display_list/aiks_context.h" |
24 | 22 | #include "impeller/display_list/dl_dispatcher.h" |
25 | 23 | #include "impeller/playground/playground.h" |
@@ -829,91 +827,6 @@ TEST_P(AiksTest, FramebufferAdvancedBlendCoverage) { |
829 | 827 | ASSERT_TRUE(OpenPlaygroundHere(builder.Build())); |
830 | 828 | } |
831 | 829 |
|
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 | | - |
917 | 830 | TEST_P(AiksTest, ColorWheel) { |
918 | 831 | // Compare with https://fiddle.skia.org/c/@BlendModes |
919 | 832 |
|
|
0 commit comments