-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Log a warning when the tonemapping_luts
feature is disabled but required for the selected tonemapper.
#10253
Changes from 5 commits
a48a426
e49b360
7e869d6
f0514d5
6fa3987
50ea38a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,19 +185,42 @@ impl SpecializedRenderPipeline for TonemappingPipeline { | |
if let DebandDither::Enabled = key.deband_dither { | ||
shader_defs.push("DEBAND_DITHER".into()); | ||
} | ||
|
||
match key.tonemapping { | ||
Tonemapping::None => shader_defs.push("TONEMAP_METHOD_NONE".into()), | ||
Tonemapping::Reinhard => shader_defs.push("TONEMAP_METHOD_REINHARD".into()), | ||
Tonemapping::ReinhardLuminance => { | ||
shader_defs.push("TONEMAP_METHOD_REINHARD_LUMINANCE".into()); | ||
} | ||
Tonemapping::AcesFitted => shader_defs.push("TONEMAP_METHOD_ACES_FITTED".into()), | ||
Tonemapping::AgX => shader_defs.push("TONEMAP_METHOD_AGX".into()), | ||
Tonemapping::AgX => { | ||
#[cfg(not(feature = "tonemapping_luts"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why warn instead of gating the actual enum variants behind the flag? That way we'd make the invalid states not representable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather not change the default tonemapper depending on what features are enabled, and this avoids users wondering why their bevy library or game (with default features disabled) looks different than everyone else's. |
||
bevy_log::error!( | ||
"AgX tonemapping requires the `tonemapping_luts` feature. | ||
Either enable the `tonemapping_luts` feature for bevy in `Cargo.toml`, | ||
or use a different tonemapping method in your CameraBundle." | ||
); | ||
shader_defs.push("TONEMAP_METHOD_AGX".into()); | ||
} | ||
Tonemapping::SomewhatBoringDisplayTransform => { | ||
shader_defs.push("TONEMAP_METHOD_SOMEWHAT_BORING_DISPLAY_TRANSFORM".into()); | ||
} | ||
Tonemapping::TonyMcMapface => shader_defs.push("TONEMAP_METHOD_TONY_MC_MAPFACE".into()), | ||
Tonemapping::TonyMcMapface => { | ||
#[cfg(not(feature = "tonemapping_luts"))] | ||
bevy_log::error!( | ||
"TonyMcMapFace tonemapping requires the `tonemapping_luts` feature. | ||
Either enable the `tonemapping_luts` feature for bevy in `Cargo.toml`, | ||
or use a different tonemapping method in your CameraBundle." | ||
); | ||
shader_defs.push("TONEMAP_METHOD_TONY_MC_MAPFACE".into()); | ||
} | ||
Tonemapping::BlenderFilmic => { | ||
#[cfg(not(feature = "tonemapping_luts"))] | ||
bevy_log::error!( | ||
"BlenderFilmic tonemapping requires the `tonemapping_luts` feature. | ||
Either enable the `tonemapping_luts` feature for bevy in `Cargo.toml`, | ||
or use a different tonemapping method in your CameraBundle." | ||
); | ||
shader_defs.push("TONEMAP_METHOD_BLENDER_FILMIC".into()); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit ugly (since tonemapping_luts already depends on them in bevy_core_pipeline's cargo.toml), but stops the ktx2 and zstd features from appearing as optional features in the cargo_features doc when they're already enabled.