Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix premultiplication.
  • Loading branch information
jonahwilliams committed Apr 23, 2024
commit 2dfc0620e97ec18a5e23c0a7cba9b7f8a137dc5a
4 changes: 2 additions & 2 deletions impeller/entity/contents/filters/blend_filter_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <memory>
#include <optional>

#include "fml/logging.h"
#include "flutter/fml/logging.h"
#include "impeller/base/strings.h"
#include "impeller/core/formats.h"
#include "impeller/core/sampler_descriptor.h"
Expand Down Expand Up @@ -746,7 +746,7 @@ std::optional<Entity> BlendFilterContents::CreateFramebufferAdvancedBlend(
return false;
}

if (!src_texture->SetContents(foreground_color->ToR8G8B8A8().data(),
if (!src_texture->SetContents(foreground_color->Premultiply().ToR8G8B8A8().data(),
4u)) {
return false;
}
Expand Down
7 changes: 5 additions & 2 deletions impeller/entity/contents/filters/blend_filter_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ class BlendFilterContents : public ColorFilterContents {
ColorFilterContents::AbsorbOpacity absorb_opacity) const;

/// @brief Implements the advanced blends filters in terms of the framebuffer
/// blend filters.
/// blend filters.
///
/// This allows a substantial reduction in the number of bootstrapped filters.
/// This requires device support for frameuffer fetch,
/// `Capabilities::SupportsFramebufferFetch` must be true
/// This allows a substantial reduction in the number of bootstrapped
/// shaders.
std::optional<Entity> CreateFramebufferAdvancedBlend(
Copy link
Member

Choose a reason for hiding this comment

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

Also document the SupportsFramebufferFetch requirement?

Copy link
Member

Choose a reason for hiding this comment

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

Framebuffer advanced blends vs the other kind (pipeline blend?) I think are our own inventions of terminology (which totally make sense). But it would be good to point it out either here or in a glossary.

const FilterInput::Vector& inputs,
const ContentContext& renderer,
Expand Down
6 changes: 0 additions & 6 deletions impeller/entity/entity_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2685,12 +2685,6 @@ TEST_P(EntityTest, AdvancedBlendCoverageHintIsNotResetByEntityPass) {
<< "The ColorBurned texture wasn't allocated (100x100 scales up 2x)";
}

// glyph_atlas_pipelines_.CreateDefault(
// *context_, options,
// {static_cast<Scalar>(
// GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
// PixelFormat::kA8UNormInt)});

TEST_P(EntityTest, SpecializationConstantsAreAppliedToVariants) {
auto content_context = GetContentContext();

Expand Down