bevyengine / bevyengine/bevy

Conditionally compile rendering features

Open
#12,108 0 comments 4 reactions 0 assignees View on GitHub
A-Rendering C-Code-Quality C-Feature
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

`bevy_rendering` is getting _quite large_, and increases compile time and code size steadily, as more and more features are added to it.

## What solution would you like?

I would like to only compile rendering features I use. For example, why do I need irradiance volumes if I don't use it? Same for TAA, light transmission, environment maps. Not only is this a lot of rust code, but also shader files embedded in the final binary.

For this, I think, cargo feature flags would be a solution.

## What alternative(s) have you considered?

Would it be conceivable to split `bevy_pbr` by feature? So we would have `bevy_pbr_environment_map`, `bevy_pbr_transmission`, etc. This would fix the conditional compilation issue.

## Additional context

See also this discussion of the Destiny render graph presentation: https://github.com/bevyengine/bevy/issues/1504#issuecomment-808793629

Drawbacks:

* Feature flags makes testing much harder, compilation may fail without CI failing.
* How does this work with shader imports?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.