Conversation
`dioxus_renderer.rs` picks a renderer with a `cfg_if` chain - vello, vello-cpu-base, skia, vello-hybrid - and only the two wgpu arms define `InnerRendererOptions` or re-export `Features`/`Limits`. The items that use those types were gated on `any(feature = "vello", feature = "vello-hybrid")`, which asks whether a wgpu renderer is *enabled* rather than which one was *selected*. The two disagree whenever a CPU or Skia feature is on alongside a wgpu one - and since `vello-hybrid` is a default feature and `dioxus`'s `native` feature takes `dioxus-native` with its defaults, that is the only arrangement a consumer of `dioxus` can produce. The CPU and Skia arms were therefore unreachable downstream. Replace that predicate with one that mirrors the `cfg_if` chain. The `DeviceHandle` re-export keeps the original condition, because that pair is exactly what gates the optional `wgpu_context` dependency. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jcuffney
marked this pull request as ready for review
September 18, 2026 21:28
Member
|
The correct fix for this is adding a mode the CLI that allows you to use the |
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.
The problem
dioxus-native's renderer armsvello-cpu-base,vello-cpu-pixels,vello-cpu-softbufferandskiacannot be compiled by anything that depends ondioxus. Selecting one is a hard compile error, so in practicevelloandvello-hybridare the only two renderers that exist.src/dioxus_renderer.rspicks a renderer with acfg_ifchain, in priorityorder
vello→vello-cpu-base→skia→vello-hybrid. Only the two wgpuarms define
InnerRendererOptionsor re-exportFeatures/Limits— the CPU andSkia arms have no wgpu to name, which is correct.
But the five places that use those types are gated on
any(feature = "vello", feature = "vello-hybrid"). That predicate asks whether awgpu renderer is enabled. The
cfg_ifasks which renderer was selected.The two disagree as soon as a CPU or Skia feature is enabled alongside a wgpu
one.
That is not a strange combination to be in — it is the only one available:
vello-hybridis indioxus-native'sdefaultfeature set.dioxus'snativefeature declaresdioxus-nativewithoutdefault-features = false.So no downstream crate can turn
vello-hybridoff, and asking forvello-cpu-softbuffergets both.cfg_ifcorrectly selects the CPU arm, theany(...)gates fire anyway, and they name items that arm never defined.default-features = falseon a directdioxus-nativedependency does not helpeither, because the
dioxus→dioxus-nativeedge still carries the defaults.The change
One predicate, meaning the selected arm is a wgpu arm, mirroring the
cfg_ifchain:
applied at
dioxus_renderer.rs'swith_features_and_limitsand at the foursites in
lib.rs(the config bindings, thetry_read_config!block, and bothrenderer constructors — the last two stay exact complements of each other).
lib.rs's singlepub usehad to split in two.wgpu_context::DeviceHandlekeeps the original
any(vello, vello-hybrid)condition, because that pair isexactly what gates the optional
wgpu_contextdependency; onlydioxus_renderer::{Features, Limits}moves to the selected-arm predicate.Gating both the same way would be wrong in one direction or the other.
Not a breaking change
vello(± anything)velloarm;Features/Limitsexportedfeature = "vello"disjunct is still true — identicalvello-hybridalonevello-hybridarm; exportedall(vello-hybrid, not cpu, not skia)is true — identicalvello-cpu-baseand/orskia, no wgpu armvello-hybrid+vello-cpu-baseand/orskiaFeatures/Limitsnot exportedOnly the last row changes, and only from "does not build" to "builds". Every
configuration that compiles today keeps an identical public API.
What I ran
notes/CONTRIBUTING.mdasks forcargo test --workspace --tests. I did not runthe full workspace suite — it needs the webkit system dependencies and builds the
whole monorepo.
cargo test -p dioxus-nativepasses but the crate ships notests, so it is not evidence of anything; the matrix below is.
cargo check -p dioxus-native --features <arm>, on this branch's base commit andthen on this branch. Defaults left on, since that is what downstream actually
resolves:
--featuresvellovello-hybridvello-cpu-softbuffervello-cpu-pixelsskiaThe two arms that worked before are unchanged; the three that were hard compile
errors now build. That is the whole behavioural difference.
cargo fmtclean.Why I went looking
On a Pixel 10 (PowerVR D-Series) both wgpu arms are unusable. Release builds
abort on
render_surface.device().poll(wgpu::PollType::wait_indefinitely()).unwrap()returning
Err(Timeout)— the driver accepts the submission and never signalscompletion. I have proposed a fix for that separately in
DioxusLabs/anyrender#96. The app survives roughly 2 launches in 8.
The CPU arm sidesteps the driver entirely, because it never opens a wgpu device.
With this patch applied I get 10 launches out of 10, rendering correctly —
layout, fonts,
position: fixed, nested routing, theme switching — at ~2–3% ofone core when idle. That is the difference between
dioxus-nativeworking onthis device and not, and it was unreachable.
Notes
would rather have a
build.rscargo::rustc-check-cfgalias, or a singleinternal feature the arms resolve against, say so and I will redo it that way -
I have no attachment to this shape, only to the five sites agreeing with the
cfg_if.exactly what catches this class of bug.
🤖 Generated with Claude Code