Wrong materials used when `GpuProcessingSupport` set to `GpuProcessingMode::None`
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
0.16.0-rc.2
## Relevant system information
```
SystemInfo { os: "Linux (Linux Mint 22.1)", kernel: "6.8.0-55-generic", cpu: "Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz", core_count: "4", memory: "31.2 GiB" }
AdapterInfo { name: "NVIDIA GeForce 940MX", vendor: 4318, device: 4941, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "535.183.01", backend: Vulkan }
```
## What you did
To illustrate, I modified the 3d_shapes example to disable GPU pre-processing by inserting the `GpuPreprocessorSupport` resource into the `RenderApp`.
```
use bevy::{
render_resource::{Extent3d, TextureDimension, TextureFormat},
},
};
+use bevy_render::{
+ batching::gpu_preprocessing::{GpuPreprocessingMode, GpuPreprocessingSupport},
+ RenderApp,
+};
fn main() {
- App::new()
diff --git a/examples/3d/3d_shapes.rs b/examples/3d/3d_shapes.rs
index 0346abd35..07208d653 100644
--- a/examples/3d/3d_shapes.rs
+++ b/examples/3d/3d_shapes.rs
@@ -16,15 +16,23 @@ use bevy::{
render_resource::{Extent3d, TextureDimension, TextureFormat},
},
};
+use bevy_render::{
+ batching::gpu_preprocessing::{GpuPreprocessingMode, GpuPreprocessingSupport},
+ RenderApp,
+};
fn main() {
- App::new()
- .add_plugins((
- DefaultPlugins.set(ImagePlugin::default_nearest()),
- #[cfg(not(target_arch = "wasm32"))]
- WireframePlugin,
- ))
- .add_systems(Startup, setup)
+ let mut app = App::new();
+ app.add_plugins((
+ DefaultPlugins.set(ImagePlugin::default_nearest()),
+ #[cfg(not(target_arch = "wasm32"))]
+ WireframePlugin,
+ ))
+ .sub_app_mut(RenderApp)
+ .insert_resource(GpuPreprocessingSupport {
+ max_supported_mode: GpuPreprocessingMode::None,
+ });
+ app.add_systems(Startup, setup)
.add_systems(
Update,
(
```
## What went wrong
I expected this to have no effect on the rendering of the scene.
What happened was that the grey material used for the background plane, was used for all the shapes themselves in place of their normal colourful texture.
## Additional information


Contributor guide
Research direction
Start with examples/3d/3d_shapes.rs and reproduce the scene after inserting GpuPreprocessingSupport with GpuPreprocessingMode::None into RenderApp. Trace the GPU preprocessing and material-selection path to determine why the background material is reused. Done means disabling GPU preprocessing leaves the shapes with their normal colourful materials.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100