bevyengine / bevyengine/bevy

Extended Material breaks when using asset preprocessing

Open
#12,193 0 comments 0 reactions 0 assignees View on GitHub
A-Assets A-Rendering C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.13.0

## Relevant system information
```
AdapterInfo { name: "NVIDIA GeForce RTX 2070", vendor: 4318, device: 7938, device_type: DiscreteGpu, backend: Vulkan }`
```

## What you did

I copied the Material Extension example into a new project, and enabled Asset preprocessing
This is how I included bevy in cargo.toml:
`bevy = { version = "0.13.0", default-features = true, features=["dynamic_linking", "asset_processor", "file_watcher", "embedded_watcher"]}`
I then switched the main function to add
`DefaultPlugins.set(AssetPlugin{
mode: AssetMode::Processed,
..Default::default()
})`
instead of just DefaultPlugins.

## What went wrong

Instead of seeing the exact same output, the sphere doesnt get rendered at all. Just get a completely blank scene.
When I switch back to just DefaultPlugins, the program works as expected.

## Additional information

I came across this issue while working on a project, and I noticed a lot of wierd bugs happening with shaders, asset preprocessing, and pipelines. Any time I made a change to a shader I would have to run the program twice in order for the changes to appear. The app would also fail approximately 50% of the time, when a pipeline would fail to be built due to a shader compilation error. The shader complained about a missing shader import which had definitely been added to the app by calling AssetServer.load().

My best guess is that there is some sort of race condition where the pipelines get created while the shaders are still being processed by the asset server. This then either fails silently in the case of the material extension example, or fails while compiling the shader due to the shader import files not being processed yet.

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.