feat: expose Engine backend and feature level to JS#337
Open
AndyCross wants to merge 1 commit intomargelo:mainfrom
Open
feat: expose Engine backend and feature level to JS#337AndyCross wants to merge 1 commit intomargelo:mainfrom
AndyCross wants to merge 1 commit intomargelo:mainfrom
Conversation
Bridge three existing C++ Engine getters through the JSI layer:
- getBackend(): returns the resolved graphics backend ("opengl", "vulkan", "metal")
- getSupportedFeatureLevel(): returns the highest GPU feature level (0-3)
- getActiveFeatureLevel(): returns the currently active feature level
These are zero-cost const getters that already exist on filament::Engine
but were not accessible from JavaScript. They enable adaptive quality
decisions, device profiling, and telemetry without requiring additional
native modules or GL context creation.
See docs/engine-info.md for usage examples.
35288a0 to
a1b752d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We're using react-native-filament and needed a way to adapt rendering quality based on actual GPU capability. Right now there's no way to query anything about the graphics backend from JavaScript — you're stuck guessing from CPU benchmarks and RAM, which is particularly unreliable on budget Android devices where the GPU often punches well above the CPU's weight class.
Filament's C++ Engine already has
getBackend(),getSupportedFeatureLevel(), andgetActiveFeatureLevel()sitting right there as const getters. This PR just bridges them through the existing JSI layer so they're callable from JS.getBackend()returns"opengl"/"vulkan"/"metal"— useful for diagnostics and knowing what you're actually running on.getSupportedFeatureLevel()returns 0–3 mapping to OpenGL ES capability tiers. This turned out to be the signal we were after — a device at level 2+ has a meaningfully more capable GPU than one at 0–1, and it maps directly to what Filament can actually do on that hardware.The implementation follows the existing
EngineImpl→EngineWrapper→ TypeScript pattern exactly, and reusesEnumMapper::convertEnumToJSUnionfromRNFEngineBackendEnum.hfor the backend conversion. Six files touched, 166 lines added, nothing removed. Added adocs/engine-info.mdwith the full API reference and usage examples.