Skip to content

Commit

Permalink
Make ktx2 and zstd default features (bevyengine#7696)
Browse files Browse the repository at this point in the history
- Environment maps use these formats, and in the future rendering LUTs will need textures loaded by default in the engine

- Make ktx2 and zstd part of the default feature
- Let examples assume these features are enabled

---

- `ktx2` and `zstd` are now party of bevy's default enabled features

- If you used the `ktx2` or `zstd` features, you no longer need to explicitly enable them, as they are now part of bevy's default enabled features
  • Loading branch information
JMS55 authored and myreprise1 committed Feb 18, 2023
1 parent ce3068a commit a91f236
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ jobs:
- name: Build bevy
# this uses the same command as when running the example to ensure build is reused
run: |
TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome,ktx2,zstd"
TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome"
- name: Run examples
run: |
for example in .github/example-run/*.ron; do
example_name=`basename $example .ron`
echo -n $example_name > last_example_run
echo "running $example_name - "`date`
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome,ktx2,zstd"
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
sleep 10
done
zip traces.zip trace*.json
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validation-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ jobs:
shell: bash
# this uses the same command as when running the example to ensure build is reused
run: |
WGPU_BACKEND=dx12 CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,ktx2,zstd"
WGPU_BACKEND=dx12 CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing"
- name: Run examples
shell: bash
run: |
for example in .github/example-run/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing,ktx2,zstd"
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing"
sleep 10
done
Expand Down
12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ repository = "https://github.com/bevyengine/bevy"
rust-version = "1.67.0"

[workspace]
exclude = ["benches", "crates/bevy_ecs_compile_fail_tests", "crates/bevy_reflect_compile_fail_tests"]
exclude = [
"benches",
"crates/bevy_ecs_compile_fail_tests",
"crates/bevy_reflect_compile_fail_tests",
]
members = [
"crates/*",
"examples/mobile",
Expand Down Expand Up @@ -41,10 +45,12 @@ default = [
"bevy_ui",
"png",
"hdr",
"ktx2",
"zstd",
"vorbis",
"x11",
"filesystem_watcher",
"android_shared_stdcxx"
"android_shared_stdcxx",
]

# Force dynamic linking, which improves iterative compile times
Expand Down Expand Up @@ -428,7 +434,6 @@ wasm = true
[[example]]
name = "pbr"
path = "examples/3d/pbr.rs"
required-features = ["ktx2", "zstd"]

[package.metadata.example.pbr]
name = "Physically Based Rendering"
Expand Down Expand Up @@ -469,7 +474,6 @@ wasm = true
[[example]]
name = "skybox"
path = "examples/3d/skybox.rs"
required-features = ["ktx2", "zstd"]

[package.metadata.example.skybox]
name = "Skybox"
Expand Down
13 changes: 0 additions & 13 deletions crates/bevy_render/src/texture/image_texture_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,3 @@ impl std::fmt::Display for FileTextureError {
)
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
#[ignore = "ktx2 not supported by ImageFormat"]
fn test_supported_file_extensions() {
for ext in FILE_EXTENSIONS {
assert!(image::ImageFormat::from_extension(ext).is_some());
}
}
}
6 changes: 0 additions & 6 deletions examples/3d/load_gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,11 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
.looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
..default()
},
#[cfg(all(feature = "ktx2", feature = "zstd"))]
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
},
));
#[cfg(not(all(feature = "ktx2", feature = "zstd")))]
{
warn!("feature ktx2 or zstd wasn't enabled.");
warn!("rerun this example with `--features=\"ktx2 zstd\" to get environment maps for ambient light");
}

commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
Expand Down
6 changes: 0 additions & 6 deletions examples/tools/scene_viewer/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ fn setup_scene_after_load(
},
..default()
},
#[cfg(all(feature = "ktx2", feature = "zstd"))]
EnvironmentMapLight {
diffuse_map: asset_server
.load("assets/environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
Expand All @@ -137,11 +136,6 @@ fn setup_scene_after_load(
},
camera_controller,
));
#[cfg(not(all(feature = "ktx2", feature = "zstd")))]
{
warn!("feature ktx2 or zstd wasn't enabled.");
warn!("rerun this example with `--features=\"ktx2 zstd\" to get environment maps for ambient light");
}

// Spawn a default light if the scene does not have one
if !scene_handle.has_light {
Expand Down

0 comments on commit a91f236

Please sign in to comment.