8000 Switch filament and backend to Abseil logging by bejado · Pull Request #8691 · google/filament · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Switch filament and backend to Abseil logging #8691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 11, 2025
Merged

Switch filament and backend to Abseil logging #8691

merged 11 commits into from
Jun 11, 2025

Conversation

bejado
Copy link
Member
@bejado bejado commented May 2, 2025

This switches everything under filament/ to Abseil logging. The following mapping between utils::slog and Abseil severity is used:

slog.d  ->  DLOG(INFO)
slog.i  ->  LOG(INFO)
slog.v  ->  LOG(INFO)
slog.w  ->  LOG(WARNING)
slog.e  ->  LOG(ERROR)

@pixelflinger
Copy link
Collaborator

Will you be able to check how this affect the binary size on a release build?

@bejado
Copy link
Member Author
bejado commented May 6, 2025

Will you be able to check how this affect the binary size on a release build?

Yes, I'm planning on check that. Unfortunately I think Abseil log uses std iostream, so we may see a binary size increase.

@@ -772,26 +774,25 @@ UTILS_NOINLINE
} else {
line = shader.substr(start, end - start);
}
out << lc++ << ": " << line.c_str() << '\n';
LOG(ERROR) << lc++ << ": " << line.c_str();
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should be a utils/std::stream, and then output to LOG(ERROR) at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I thought about that. The difference is that with LOG(ERROR), Abseil prepends metadata for each line. I guess we have to decide which style we prefer.

@bejado bejado force-pushed the bjd/abseil-logging branch from 0585a5d to 3359ef4 Compare May 13, 2025 22:00
@bejado
Copy link
Member Author
bejado commented May 13, 2025

Unfortunately with Abseil, I'm seeing a 1.23 MiB binary size increase on Android. I'll need to investigate this some more to see what's going on. I was previously comparing main to an older branch which was skewing the results.

I'm seeing a 208.84 KiB binary size increase on Android.

jni/arm64-v8a/libfilament-jni.so:

Configuration Size (bytes)
Before Abseil 3459984
With Abseil 3673832

@bejado bejado force-pushed the bjd/abseil-logging branch from 3359ef4 to bd1cfba Compare May 14, 2025 22:52
@bejado bejado marked this pull request as ready for review May 14, 2025 22:53
@bejado bejado requested a review from poweifeng June 5, 2025 19:15
LogLine& operator=(const LogLine&) = delete;
LogLine& operator=(LogLine&&) = delete;

~LogLine() noexcept { mStream << utils::io::endl; }
Copy link
Contributor

Choose a reason for hiding this comment

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

The semantics here is a little different from the old since it'll be flushed when the LogLine goes out of scope, as oppose to when <<utils::io::endl is used in the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe that's ok?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the semantics are indeed different. I did my best to find all the places we weren't using utils::io::endl and instead use a stringstream first to concatenate. IMO the way we did it explicitly with utils::io::endl is a better API, but this is just how Abseil works. I really wish Abseil had a LOG_NOENDLINE-style macro, but it doesn't.

Copy link
Contributor
@poweifeng poweifeng left a comment

Choose a reason for hiding this comment

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

lgtm but web build seems to be failing

@bejado bejado merged commit 3ea8e52 into main Jun 11, 2025
15 of 16 checks passed
@bejado bejado deleted the bjd/abseil-logging branch June 11, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0