From a48a42603605aac5d1e8dd73793d62337054e39c Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Tue, 24 Oct 2023 20:05:37 -0400 Subject: [PATCH 1/6] add ktx2 and zstd features to the tonemapping_luts feature --- crates/bevy_core_pipeline/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_core_pipeline/Cargo.toml b/crates/bevy_core_pipeline/Cargo.toml index 27825880d3473..dc118fdd33773 100644 --- a/crates/bevy_core_pipeline/Cargo.toml +++ b/crates/bevy_core_pipeline/Cargo.toml @@ -15,7 +15,7 @@ keywords = ["bevy"] [features] trace = [] webgl = [] -tonemapping_luts = [] +tonemapping_luts = ["bevy_render/ktx2", "bevy_render/zstd"] [dependencies] # bevy From e49b3603dd07d25c30c87f3810429f35e6f8d693 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Tue, 24 Oct 2023 20:31:23 -0400 Subject: [PATCH 2/6] log an error when the tonemapping_luts feature is disabled but required for the selected tonemapper --- Cargo.toml | 2 -- crates/bevy_core_pipeline/Cargo.toml | 1 + .../bevy_core_pipeline/src/tonemapping/mod.rs | 19 +++++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8dd252ffb8cd8..e4ea0472704e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,8 +47,6 @@ default = [ "multi-threaded", "png", "hdr", - "ktx2", - "zstd", "vorbis", "x11", "bevy_gizmos", diff --git a/crates/bevy_core_pipeline/Cargo.toml b/crates/bevy_core_pipeline/Cargo.toml index dc118fdd33773..53f8230e4d0f6 100644 --- a/crates/bevy_core_pipeline/Cargo.toml +++ b/crates/bevy_core_pipeline/Cargo.toml @@ -24,6 +24,7 @@ bevy_asset = { path = "../bevy_asset", version = "0.12.0-dev" } bevy_core = { path = "../bevy_core", version = "0.12.0-dev" } bevy_derive = { path = "../bevy_derive", version = "0.12.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.12.0-dev" } +bevy_log = { path = "../bevy_log", version = "0.12.0-dev" } bevy_reflect = { path = "../bevy_reflect", version = "0.12.0-dev" } bevy_render = { path = "../bevy_render", version = "0.12.0-dev" } bevy_transform = { path = "../bevy_transform", version = "0.12.0-dev" } diff --git a/crates/bevy_core_pipeline/src/tonemapping/mod.rs b/crates/bevy_core_pipeline/src/tonemapping/mod.rs index 6aada19c458e5..32752ef8d5e56 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/mod.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/mod.rs @@ -185,6 +185,7 @@ 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()), @@ -192,12 +193,26 @@ impl SpecializedRenderPipeline for TonemappingPipeline { 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"))] + bevy_log::error!("AgX tonemapping requires the `tonemapping_luts` feature."); + 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." + ); + 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." + ); shader_defs.push("TONEMAP_METHOD_BLENDER_FILMIC".into()); } } From 7e869d66c8d43a4ee8af0014c0027137521d3f35 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Wed, 25 Oct 2023 01:50:32 -0400 Subject: [PATCH 3/6] update cargo_features --- Cargo.toml | 4 ++-- docs/cargo_features.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e4ea0472704e7..170312b2df667 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -221,8 +221,8 @@ android_shared_stdcxx = ["bevy_internal/android_shared_stdcxx"] # Enable detailed trace event logging. These trace events are expensive even when off, thus they require compile time opt-in detailed_trace = ["bevy_internal/detailed_trace"] -# Include tonemapping Look Up Tables KTX2 files -tonemapping_luts = ["bevy_internal/tonemapping_luts"] +# Include tonemapping Look Up Tables KTX2 files. If everything is pink, you need to enable this feature or change the `Tonemapping` method on your `Camera2dBundle` or `Camera3dBundle`. +tonemapping_luts = ["bevy_internal/tonemapping_luts", "ktx2", "zstd"] # Enable AccessKit on Unix backends (currently only works with experimental screen readers and forks.) accesskit_unix = ["bevy_internal/accesskit_unix"] diff --git a/docs/cargo_features.md b/docs/cargo_features.md index 47ac836eb5b7f..f145af1efbab3 100644 --- a/docs/cargo_features.md +++ b/docs/cargo_features.md @@ -32,7 +32,7 @@ The default feature set enables most of the expected features of a game engine, |ktx2|KTX2 compressed texture support| |multi-threaded|Enables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.| |png|PNG image format support| -|tonemapping_luts|Include tonemapping Look Up Tables KTX2 files| +|tonemapping_luts|Include tonemapping Look Up Tables KTX2 files. If everything is pink, you need to enable this feature or change the `Tonemapping` method on your `Camera2dBundle` or `Camera3dBundle`.| |vorbis|OGG/VORBIS audio format support| |webgl2|Enable some limitations to be able to use WebGL2. If not enabled, it will default to WebGPU in Wasm. Please refer to the [WebGL2 and WebGPU](https://github.com/bevyengine/bevy/tree/latest/examples#webgl2-and-webgpu) section of the examples README for more information on how to run Wasm builds with WebGPU.| |x11|X11 display server support| From f0514d5738d732a5a6d693c4f1b44649cb3dcf10 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Wed, 25 Oct 2023 02:51:48 -0400 Subject: [PATCH 4/6] make the error message actionable --- crates/bevy_core_pipeline/src/tonemapping/mod.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/bevy_core_pipeline/src/tonemapping/mod.rs b/crates/bevy_core_pipeline/src/tonemapping/mod.rs index 32752ef8d5e56..1b0b962931dd7 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/mod.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/mod.rs @@ -195,7 +195,11 @@ impl SpecializedRenderPipeline for TonemappingPipeline { Tonemapping::AcesFitted => shader_defs.push("TONEMAP_METHOD_ACES_FITTED".into()), Tonemapping::AgX => { #[cfg(not(feature = "tonemapping_luts"))] - bevy_log::error!("AgX tonemapping requires the `tonemapping_luts` feature."); + 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 => { @@ -204,14 +208,18 @@ impl SpecializedRenderPipeline for TonemappingPipeline { Tonemapping::TonyMcMapface => { #[cfg(not(feature = "tonemapping_luts"))] bevy_log::error!( - "TonyMcMapFace tonemapping requires the `tonemapping_luts` feature." + "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." + "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()); } From 6fa398717a43268beae4d9e5a798e11915955b68 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Wed, 25 Oct 2023 03:23:31 -0400 Subject: [PATCH 5/6] appease ci --- crates/bevy_core_pipeline/src/tonemapping/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_core_pipeline/src/tonemapping/mod.rs b/crates/bevy_core_pipeline/src/tonemapping/mod.rs index 1b0b962931dd7..b9e905304c1f3 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/mod.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/mod.rs @@ -212,7 +212,7 @@ impl SpecializedRenderPipeline for TonemappingPipeline { 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()) + shader_defs.push("TONEMAP_METHOD_TONY_MC_MAPFACE".into()); } Tonemapping::BlenderFilmic => { #[cfg(not(feature = "tonemapping_luts"))] From 50ea38a61147d178ff5456d6b665e870e617a022 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Thu, 26 Oct 2023 21:45:04 -0400 Subject: [PATCH 6/6] better error message --- crates/bevy_core_pipeline/src/tonemapping/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/bevy_core_pipeline/src/tonemapping/mod.rs b/crates/bevy_core_pipeline/src/tonemapping/mod.rs index b9e905304c1f3..c23cb3b211ebc 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/mod.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/mod.rs @@ -197,8 +197,8 @@ impl SpecializedRenderPipeline for TonemappingPipeline { #[cfg(not(feature = "tonemapping_luts"))] 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." + Either enable the `tonemapping_luts` feature for bevy in `Cargo.toml` (recommended), + or use a different `Tonemapping` method in your `Camera2dBundle`/`Camera3dBundle`." ); shader_defs.push("TONEMAP_METHOD_AGX".into()); } @@ -209,8 +209,8 @@ impl SpecializedRenderPipeline for TonemappingPipeline { #[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." + Either enable the `tonemapping_luts` feature for bevy in `Cargo.toml` (recommended), + or use a different `Tonemapping` method in your `Camera2dBundle`/`Camera3dBundle`." ); shader_defs.push("TONEMAP_METHOD_TONY_MC_MAPFACE".into()); } @@ -218,8 +218,8 @@ impl SpecializedRenderPipeline for TonemappingPipeline { #[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." + Either enable the `tonemapping_luts` feature for bevy in `Cargo.toml` (recommended), + or use a different `Tonemapping` method in your `Camera2dBundle`/`Camera3dBundle`." ); shader_defs.push("TONEMAP_METHOD_BLENDER_FILMIC".into()); }