Skip to content
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

In 0.14.0-rc.2, minimal app with bevy_core_pipeline crashes without ktx2, zstd, and bevy_pbr #13728

Closed
benfrankel opened this issue Jun 7, 2024 · 8 comments · Fixed by #14020
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Dependencies A change to the crates that Bevy depends on S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Milestone

Comments

@benfrankel
Copy link
Contributor

benfrankel commented Jun 7, 2024

Bevy version

0.14.0-rc.2

What you did

Note: The following setup runs fine in bevy 0.13.

In Cargo.toml:

[dependencies]
bevy = { version = "0.14.0-rc.2", default-features = false, features = [
    "bevy_core_pipeline",
    "bevy_winit",
    "x11",
] }

In main.rs:

use bevy::prelude::*;

fn main() {
    App::new().add_plugins(DefaultPlugins).run();
}

What went wrong

It runs but immediately crashes with error message:

Failed to load SMAA area LUT: UnsupportedTextureFormat("Ktx2")

After enabling the ktx2 feature, we get a new crash:

Failed to load SMAA area LUT: SuperDecompressionError("Unsupported supercompression scheme: Zstandard")

After enabling the zstd feature, we get a new crash:

Resource requested by bevy_core_pipeline::core_3d::extract_core_3d_camera_phases does not exist: bevy_render::render_phase::ViewBinnedRenderPhases<bevy_core_pipeline::core_3d::Opaque3d>

After enabling the bevy_pbr feature, there is no crash.

@benfrankel benfrankel added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 7, 2024
@benfrankel benfrankel changed the title 0.14.0-rc.2 minimal app crashes without ktx2, zstd, and bevy_pbr features enabled 0.14.0-rc.2 minimal app crashes unless ktx2, zstd, and bevy_pbr features are enabled Jun 7, 2024
@JMS55 JMS55 added this to the 0.14 milestone Jun 7, 2024
@JMS55 JMS55 added A-Rendering Drawing game state to the screen C-Dependencies A change to the crates that Bevy depends on and removed S-Needs-Triage This issue needs to be labelled labels Jun 7, 2024
@benfrankel benfrankel changed the title 0.14.0-rc.2 minimal app crashes unless ktx2, zstd, and bevy_pbr features are enabled In 0.14.0-rc.2, minimal app with bevy_core_pipeline crashes without ktx2, zstd, and bevy_pbr Jun 7, 2024
@jgayfer
Copy link
Contributor

jgayfer commented Jun 7, 2024

Related to #13571, though at the time I created that ticket it was only bevy_pbr that needed to be included.

@ChristopherBiscardi
Copy link
Contributor

This happened in the bevy_ecs_tilemap upgrade I'm working on when running the examples -- StarArawn/bevy_ecs_tilemap#537

ChristopherBiscardi added a commit to ChristopherBiscardi/bevy_ecs_tilemap that referenced this issue Jun 7, 2024
@bugsweeper
Copy link
Contributor

bugsweeper commented Jun 7, 2024

at the time I created that ticket it was only bevy_pbr that needed to be included.

That because you enabled only bevy_winit feature, but in this issue bevy_core_pipeline is also enabled, which adds SmaaPlugin, which loads ktx2 textures, which wants zstd zlib for supercompression

@bugsweeper
Copy link
Contributor

bugsweeper commented Jun 7, 2024

The question is: Do we want Smaa to be optional, or bevy_core_pipeline to require ktx2?

@aevyrie
Copy link
Member

aevyrie commented Jun 12, 2024

Ideally the SMAA LUTs should be behind a feature flag. I should be able to turn off default features and be able to run with a minimal feature set.

@knutsoned
Copy link

Using the published v0.14.0-rc.3 crate, I am seeing this issue if bevy_core_pipeline and multi_threaded are the only features enabled. Minimal reproduction: https://github.com/knutsoned/rc3-winit-example

@djeedai
Copy link
Contributor

djeedai commented Jun 23, 2024

Confirming I'm also hitting this in a trivial empty integration test for Hanabi.

@rparrett
Copy link
Contributor

This is an issue for several of my apps -- I don't want to compile bevy_pbr for a 2d game.

@alice-i-cecile alice-i-cecile added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Jun 25, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 26, 2024
# Objective

- Fixes #13728 

## Solution

- add a new feature `smaa_luts`. if enables, it also enables `ktx2` and
`zstd`. if not, it doesn't load the files but use placeholders instead
- adds all the resources needed in the same places that system that uses
them are added.
mockersf added a commit that referenced this issue Jun 26, 2024
# Objective

- Fixes #13728 

## Solution

- add a new feature `smaa_luts`. if enables, it also enables `ktx2` and
`zstd`. if not, it doesn't load the files but use placeholders instead
- adds all the resources needed in the same places that system that uses
them are added.
rparrett added a commit to StarArawn/bevy_ecs_tilemap that referenced this issue Jul 5, 2024
* Update to 0.14.0-rc.2

* [12997](bevyengine/bevy#12997): rename `multi-threaded` to `multi_threaded`

* RenderAssets<Image> is now RenderAssets<GpuImage>

Implemented in [12827](bevyengine/bevy#12827)

* FloatOrd is now in bevy_math

implemented in [12732](bevyengine/bevy#12732)

* convert Transparent2d::dynamic_offset to extra_index

[12889](bevyengine/bevy#12889) Gpu Frustum Culling removed the dynamic_offset of Transparent2d and it became `extra_index` with the special value `PhaseItemExtraIndex::NONE`, which indicates the `None` that was here previously

* RenderPhase<Transparent2d> -> ViewSortedRenderPhases<Transparent2d>

[12453](https://github.com/StarArawn/bevy_ecs_tilemap/pull/bevyengine/bevy#12453): Render phases are now binned or sorted.

Following the changes in the `mesh2d_manual` [example](https://github.com/bevyengine/bevy/blob/ecdd1624f302c5f71aaed95b0984cbbecf8880b7/examples/2d/mesh2d_manual.rs#L357-L358): use the `ViewSortedRenderPhases` resource.

* get_sub_app_mut is now an Option

in [9202](https://github.com/StarArawn/bevy_ecs_tilemap/pull/bevyengine/bevy/pull/9202) SubApp access has changed

* GpuImage::size f32 -> u32 via UVec2

[11698](bevyengine/bevy#11698) changed `GpuImage::size` to `UVec2`.

Right above this, `Extent3d` does the same thing, so I'm taking a small leap and assuming can `as`.

* GpuMesh::primitive_topology -> key_bits/BaseMeshPipeline

[12791](bevyengine/bevy#12791) the `primitive_topology` field on `GpuMesh` was removed in favor of `key_bits` which can be constructed using `BaseMeshPipeline::from_primitive_topology`

* RenderChunk2d::prepare requires &mut MeshVertexBufferLayouts now

[12216](bevyengine/bevy#12216) introduced an argument `&mut MeshVertexBufferLayouts` to `get_mesh_vertex_buffer_layout`, which bevy_ecs_tilemap calls in `RenderChunk2d::prepare`

* into_linear_f32 -> color.0.linear().to_f32_array(),

[12163](bevyengine/bevy#12163) bevy_color was created and Color handling has changed. Specifically Color::as_linear_rgba_f32 has been removed.

LinearRgba is now its own type that can be accessed via [`linear()`](https://docs.rs/bevy/0.14.0-rc.2/bevy/color/enum.Color.html#method.linear) and then converted.

* Must specify type of VisibleEntities when accessing

[12582](bevyengine/bevy#12582) divided `VisibleEntities` into separate lists. So now we have to specify which kind of entity we want. I think we want the Mesh here, and I think we can get rid of the `.index` calls on Entity since Entity [already compares bits](https://docs.rs/bevy_ecs/0.14.0-rc.2/src/bevy_ecs/entity/mod.rs.html#173) for optimized codegen purposes. Waiting to do that until the other changes are in though so as to not change functionality until post-upgrade.

* app.world access is functions now

- [9202](bevyengine/bevy#9202) changed world access to functions. [relevent line](https://github.com/bevyengine/bevy/pull/9202/files#diff-b2fba3a0c86e496085ce7f0e3f1de5960cb754c7d215ed0f087aa556e529f97fR640)
- This also surfaced [12655](bevyengine/bevy#12655) which removed `Into<AssetId<T>>` for `Handle<T>`. using a reference or .id() is the solution here.

* We don't need `World::cell`, and it doesn't exist anymore

In [12551](bevyengine/bevy#12551) `WorldCell` was removed.

...but it turns out we don't need it or its replacement anyway.

* examples error out unless this bevy bug is addressed with these features being added

bevyengine/bevy#13728

* check_visibility is required for the entity that is renderable

As a result of [12582](bevyengine/bevy#12582) `check_visibility` must be implemented for the "renderable" tilemap entities. Doing this is trivial by taking advantage of the
existing `check_visibility` type arguments, which accept a [`QF: QueryFilter + 'static`](https://docs.rs/bevy/0.14.0-rc.2/bevy/render/view/fn.check_visibility.html).

The same `QueryFilter`` is used when checking `VisibleEntities`. I've chosen `With<TilemapRenderSettings` because presumably if the entity doesn't have a `TilemapRenderSettings` then it will not be rendering, but this could be as sophisticated or simple as we want.

For example `WithLight` is currently implemented as

```rust
pub type WithLight = Or<(With<PointLight>, With<SpotLight>, With<DirectionalLight>)>;
```

* view.view_proj -> view.clip_from_world

[13289](bevyengine/bevy#13489) introduced matrix naming changes, including `view_proj` which becomes `clip_from_world`

* color changes to make tests runnable

* clippy fix

* Update Cargo.toml

Co-authored-by: Rob Parrett <robparrett@gmail.com>

* Update Cargo.toml

Co-authored-by: Rob Parrett <robparrett@gmail.com>

* final clippy fixes

* Update Cargo.toml

Co-authored-by: Rob Parrett <robparrett@gmail.com>

* Simplify async loading in ldtk/tiled helpers

See Bevy #12550

* remove second allow lint

* rc.3 bump

* bump version for major release

* remove unused features

---------

Co-authored-by: Rob Parrett <robparrett@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Dependencies A change to the crates that Bevy depends on S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants