Repository navigation
webgl: Add feature guard - #47200
Merged
Merged
webgl: Add feature guard#47200
Conversation
jdm
reviewed
Aug 12, 2026
jschwe
reviewed
Aug 12, 2026
jschwe
reviewed
Aug 12, 2026
jdm
approved these changes
Aug 12, 2026
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
janeoa
force-pushed
the
webgl-feature-guard
branch
from
August 13, 2026 12:28
95eb412 to
7400b08
Compare
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 13, 2026
Closed
RichardTjokroutomo
pushed a commit
to RichardTjokroutomo/servo
that referenced
this pull request
Oct 6, 2026
Add webgl feature guard, so that we can build without it. Testing: has no automated tests, but can verify by building without the webgl using `./mach build --no-default-features --features bundled,gamepad,webgpu,max_log_level,js_jit` Fixes: servo#47184 This PR does a lot of small changes: - adds `webgl = []` as features to script, servoshell, servo, constellation, paint - adds a lot of `#[cfg(feature = "webgl")]` - make webxr depend on webgl `webxr = ["webgl",` (as previouslty webgl was non optional) - adds `// skip-unless CARGO_FEATURE_WEBGL` to the `.webdl`'s The .webdl part was tricky as it had: ``` typedef (OffscreenCanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext or WebGL2RenderingContext ) OffscreenRenderingContext; ``` and as the WebGLRenderingContext is now optional, I had to introduce ``` typedef (OffscreenCanvasRenderingContext2D or ImageBitmapRenderingContext // skip-unless CARGO_FEATURE_WEBGL begin or WebGLRenderingContext or WebGL2RenderingContext // skip-unless CARGO_FEATURE_WEBGL end ) OffscreenRenderingContext; ``` I though about making it a separate PR, but I guess it should stay here, as the separate PR would need a working example anyway. --- I made sure that this would still compile with and without webgl, and currently webxr forces webgl as a dependency --------- Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-servo__servo
that referenced
this pull request
Oct 12, 2026
This PR feature guards the devtools Just like in the servo#47200 I introduced a new feature `devtools`. It is now optional and requires `debugging` (under the same feature guard as a direct dependency). This feature guard preserves `console`. PR also introduces a small `default_tooling = ["servo/default_tooling"]` along to the already present `default_web_features` ```toml ... default_tooling = ["devtools"] ... ``` (Cargo.toml of servoshell:) ```toml default = ["default_without_allocator", "servo-allocator/use-jemalloc"] default_without_allocator = ["bundled", "default_web_features", "default_tooling", "max_log_level", "js_jit"] default_web_features = ["servo/default_web_features", "gamepad", "webgpu", "webxr"] default_tooling = ["servo/default_tooling"] ``` Testing: `./mach build --no-default-features --features bundled,gamepad,webgpu,max_log_level,js_jit` Builds that pass: - `./mach build --no-default-features --features bundled,gamepad,webgpu,max_log_level,js_jit` - `./mach build` - `./mach build --features devtools` - `./mach build --features webgl` Fixes: [47187](servo#47187) P.S. I've left a bunch of "dead_code" warnings unaddressed. Could be a future PR candidate, but I guess the `production` profile would optimize them away anyway and them extra feature guards might cause more clutter in the default build? --------- Signed-off-by: Asset Malik <5373400+janeoa@users.noreply.github.com>
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.
Add webgl feature guard, so that we can build without it.
Testing: has no automated tests, but can verify by building without the webgl using
./mach build --no-default-features --features bundled,gamepad,webgpu,max_log_level,js_jitFixes: #47184
This PR does a lot of small changes:
webgl = []as features to script, servoshell, servo, constellation, paint#[cfg(feature = "webgl")]webxr = ["webgl",(as previouslty webgl was non optional)// skip-unless CARGO_FEATURE_WEBGLto the.webdl'sThe .webdl part was tricky as it had:
and as the WebGLRenderingContext is now optional, I had to introduce
I though about making it a separate PR, but I guess it should stay here, as the separate PR would need a working example anyway.
I made sure that this would still compile with and without webgl, and currently webxr forces webgl as a dependency