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
more updates for capability.
  • Loading branch information
jonahwilliams committed Feb 13, 2024
commit f456c76e1fc940f9171dc2aa39e8d335dcd4c582
1 change: 1 addition & 0 deletions impeller/aiks/aiks_blur_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ TEST_P(AiksTest, GaussianBlurWithoutDecalSupport) {
FLT_FORWARD(mock_capabilities, old_capabilities, SupportsCompute);
FLT_FORWARD(mock_capabilities, old_capabilities,
SupportsTextureToTextureBlits);
FLT_FORWARD(mock_capabilities, old_capabilities, GetDefaultGlyphAtlasFormat);
ASSERT_TRUE(SetCapabilities(mock_capabilities).ok());

auto texture = std::make_shared<Image>(CreateTextureForFixture("boston.jpg"));
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/contents/text_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bool TextContents::Render(const ContentContext& renderer,
pass.SetCommandLabel("TextFrame");
auto opts = OptionsFromPassAndEntity(pass, entity);
opts.primitive_type = PrimitiveType::kTriangle;
if (type == GlyphAtlas::Type::kRedBitmap) {
if (type == GlyphAtlas::Type::kAlphaBitmap) {
pass.SetPipeline(renderer.GetGlyphAtlasPipeline(opts));
} else {
pass.SetPipeline(renderer.GetGlyphAtlasColorPipeline(opts));
Expand Down
9 changes: 4 additions & 5 deletions impeller/renderer/backend/gles/capabilities_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,12 @@ PixelFormat CapabilitiesGLES::GetDefaultDepthStencilFormat() const {
return PixelFormat::kD24UnormS8Uint;
}

<<<<<<< HEAD
PixelFormat CapabilitiesGLES::GetDefaultGlyphAtlasFormat() const {
return default_glyph_atlas_format_;
=======
bool CapabilitiesGLES::IsANGLE() const {
return is_angle_;
>>>>>>> 9b183870ff6ce2f928e86b45d82e06ddcef28423
}

PixelFormat CapabilitiesGLES::GetDefaultGlyphAtlasFormat() const {
return default_glyph_atlas_format_;
}

} // namespace impeller
9 changes: 0 additions & 9 deletions impeller/renderer/backend/vulkan/debug_report_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ DebugReportVK::Result DebugReportVK::OnDebugCallback(
return Result::kContinue;
}

// This is a real error but we can't fix it due to our headers being too
// old. More more details see:
// https://vulkan.lunarg.com/doc/view/1.3.224.1/mac/1.3-extensions/vkspec.html#VUID-VkImageViewCreateInfo-imageViewFormatSwizzle-04465
// This validation error currently only trips on macOS due to the use of
// texture swizzles.
if (data->messageIdNumber == static_cast<int32_t>(0x82ae5050)) {
return Result::kContinue;
}

std::vector<std::pair<std::string, std::string>> items;

items.emplace_back("Severity", vk::to_string(severity));
Expand Down
1 change: 1 addition & 0 deletions impeller/renderer/testing/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class MockCapabilities : public Capabilities {
MOCK_METHOD(PixelFormat, GetDefaultColorFormat, (), (const, override));
MOCK_METHOD(PixelFormat, GetDefaultStencilFormat, (), (const, override));
MOCK_METHOD(PixelFormat, GetDefaultDepthStencilFormat, (), (const, override));
MOCK_METHOD(PixelFormat, GetDefaultGlyphAtlasFormat, (), (const, override));
};

class MockCommandQueue : public CommandQueue {
Expand Down
2 changes: 1 addition & 1 deletion impeller/typographer/glyph_atlas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace impeller {

GlyphAtlasContext::GlyphAtlasContext()
: atlas_(std::make_shared<GlyphAtlas>(GlyphAtlas::Type::kRedBitmap)),
: atlas_(std::make_shared<GlyphAtlas>(GlyphAtlas::Type::kAlphaBitmap)),
atlas_size_(ISize(0, 0)) {}

GlyphAtlasContext::~GlyphAtlasContext() {}
Expand Down
4 changes: 3 additions & 1 deletion impeller/typographer/glyph_atlas.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ class GlyphAtlas {
enum class Type {
//--------------------------------------------------------------------------
/// The glyphs are reprsented at their requested size using only an 8-bit
/// alpha or red channel.
/// color channel.
///
/// This might be backed by a grey or red single channel texture, depending
/// on the backend capabilities.
kAlphaBitmap,

//--------------------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions impeller/typographer/lazy_glyph_atlas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LazyGlyphAtlas::~LazyGlyphAtlas() = default;

void LazyGlyphAtlas::AddTextFrame(const TextFrame& frame, Scalar scale) {
FML_DCHECK(alpha_atlas_ == nullptr && color_atlas_ == nullptr);
if (frame.GetAtlasType() == GlyphAtlas::Type::kRedBitmap) {
if (frame.GetAtlasType() == GlyphAtlas::Type::kAlphaBitmap) {
frame.CollectUniqueFontGlyphPairs(alpha_glyph_map_, scale);
} else {
frame.CollectUniqueFontGlyphPairs(color_glyph_map_, scale);
Expand All @@ -48,7 +48,7 @@ const std::shared_ptr<GlyphAtlas>& LazyGlyphAtlas::CreateOrGetGlyphAtlas(
Context& context,
GlyphAtlas::Type type) const {
{
if (type == GlyphAtlas::Type::kRedBitmap && alpha_atlas_) {
if (type == GlyphAtlas::Type::kAlphaBitmap && alpha_atlas_) {
return alpha_atlas_;
}
if (type == GlyphAtlas::Type::kColorBitmap && color_atlas_) {
Expand All @@ -67,17 +67,17 @@ const std::shared_ptr<GlyphAtlas>& LazyGlyphAtlas::CreateOrGetGlyphAtlas(
return kNullGlyphAtlas;
}

auto& glyph_map = type == GlyphAtlas::Type::kRedBitmap ? alpha_glyph_map_
auto& glyph_map = type == GlyphAtlas::Type::kAlphaBitmap ? alpha_glyph_map_
: color_glyph_map_;
const std::shared_ptr<GlyphAtlasContext>& atlas_context =
type == GlyphAtlas::Type::kRedBitmap ? alpha_context_ : color_context_;
type == GlyphAtlas::Type::kAlphaBitmap ? alpha_context_ : color_context_;
std::shared_ptr<GlyphAtlas> atlas = typographer_context_->CreateGlyphAtlas(
context, type, atlas_context, glyph_map);
if (!atlas || !atlas->IsValid()) {
VALIDATION_LOG << "Could not create valid atlas.";
return kNullGlyphAtlas;
}
if (type == GlyphAtlas::Type::kRedBitmap) {
if (type == GlyphAtlas::Type::kAlphaBitmap) {
alpha_atlas_ = std::move(atlas);
return alpha_atlas_;
}
Expand Down
2 changes: 1 addition & 1 deletion impeller/typographer/text_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const std::vector<TextRun>& TextFrame::GetRuns() const {

GlyphAtlas::Type TextFrame::GetAtlasType() const {
return has_color_ ? GlyphAtlas::Type::kColorBitmap
: GlyphAtlas::Type::kRedBitmap;
: GlyphAtlas::Type::kAlphaBitmap;
}

bool TextFrame::MaybeHasOverlapping() const {
Expand Down
20 changes: 10 additions & 10 deletions impeller/typographer/typographer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ TEST_P(TypographerTest, CanCreateGlyphAtlas) {
auto blob = SkTextBlob::MakeFromString("hello", sk_font);
ASSERT_TRUE(blob);
auto atlas = CreateGlyphAtlas(
*GetContext(), context.get(), GlyphAtlas::Type::kRedBitmap, 1.0f,
*GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f,
atlas_context, *MakeTextFrameFromTextBlobSkia(blob));
ASSERT_NE(atlas, nullptr);
ASSERT_NE(atlas->GetTexture(), nullptr);
ASSERT_EQ(atlas->GetType(), GlyphAtlas::Type::kRedBitmap);
ASSERT_EQ(atlas->GetType(), GlyphAtlas::Type::kAlphaBitmap);
ASSERT_EQ(atlas->GetGlyphCount(), 4llu);

std::optional<impeller::ScaledFont> first_scaled_font;
Expand Down Expand Up @@ -122,7 +122,7 @@ TEST_P(TypographerTest, LazyAtlasTracksColor) {
*GetContext(), GlyphAtlas::Type::kColorBitmap);

auto bitmap_atlas = lazy_atlas.CreateOrGetGlyphAtlas(
*GetContext(), GlyphAtlas::Type::kRedBitmap);
*GetContext(), GlyphAtlas::Type::kAlphaBitmap);

ASSERT_FALSE(color_atlas == bitmap_atlas);
}
Expand All @@ -135,7 +135,7 @@ TEST_P(TypographerTest, GlyphAtlasWithOddUniqueGlyphSize) {
auto blob = SkTextBlob::MakeFromString("AGH", sk_font);
ASSERT_TRUE(blob);
auto atlas = CreateGlyphAtlas(
*GetContext(), context.get(), GlyphAtlas::Type::kRedBitmap, 1.0f,
*GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f,
atlas_context, *MakeTextFrameFromTextBlobSkia(blob));
ASSERT_NE(atlas, nullptr);
ASSERT_NE(atlas->GetTexture(), nullptr);
Expand All @@ -152,7 +152,7 @@ TEST_P(TypographerTest, GlyphAtlasIsRecycledIfUnchanged) {
auto blob = SkTextBlob::MakeFromString("spooky skellingtons", sk_font);
ASSERT_TRUE(blob);
auto atlas = CreateGlyphAtlas(
*GetContext(), context.get(), GlyphAtlas::Type::kRedBitmap, 1.0f,
*GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f,
atlas_context, *MakeTextFrameFromTextBlobSkia(blob));
ASSERT_NE(atlas, nullptr);
ASSERT_NE(atlas->GetTexture(), nullptr);
Expand All @@ -161,7 +161,7 @@ TEST_P(TypographerTest, GlyphAtlasIsRecycledIfUnchanged) {
// now attempt to re-create an atlas with the same text blob.

auto next_atlas = CreateGlyphAtlas(
*GetContext(), context.get(), GlyphAtlas::Type::kRedBitmap, 1.0f,
*GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f,
atlas_context, *MakeTextFrameFromTextBlobSkia(blob));
ASSERT_EQ(atlas, next_atlas);
ASSERT_EQ(atlas_context->GetGlyphAtlas(), atlas);
Expand Down Expand Up @@ -189,7 +189,7 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) {
font_glyph_map, 0.6 * index);
};
auto atlas =
context->CreateGlyphAtlas(*GetContext(), GlyphAtlas::Type::kRedBitmap,
context->CreateGlyphAtlas(*GetContext(), GlyphAtlas::Type::kAlphaBitmap,
atlas_context, font_glyph_map);
ASSERT_NE(atlas, nullptr);
ASSERT_NE(atlas->GetTexture(), nullptr);
Expand Down Expand Up @@ -219,7 +219,7 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) {
auto blob = SkTextBlob::MakeFromString("spooky 1", sk_font);
ASSERT_TRUE(blob);
auto atlas = CreateGlyphAtlas(
*GetContext(), context.get(), GlyphAtlas::Type::kRedBitmap, 1.0f,
*GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f,
atlas_context, *MakeTextFrameFromTextBlobSkia(blob));
auto old_packer = atlas_context->GetRectPacker();

Expand All @@ -233,7 +233,7 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) {

auto blob2 = SkTextBlob::MakeFromString("spooky 2", sk_font);
auto next_atlas = CreateGlyphAtlas(
*GetContext(), context.get(), GlyphAtlas::Type::kRedBitmap, 1.0f,
*GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f,
atlas_context, *MakeTextFrameFromTextBlobSkia(blob2));
ASSERT_EQ(atlas, next_atlas);
auto* second_texture = next_atlas->GetTexture().get();
Expand All @@ -252,7 +252,7 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecreatedIfTypeChanges) {
auto blob = SkTextBlob::MakeFromString("spooky 1", sk_font);
ASSERT_TRUE(blob);
auto atlas = CreateGlyphAtlas(
*GetContext(), context.get(), GlyphAtlas::Type::kRedBitmap, 1.0f,
*GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f,
atlas_context, *MakeTextFrameFromTextBlobSkia(blob));
auto old_packer = atlas_context->GetRectPacker();

Expand Down