SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 59 Rust

Remove `DUMMY_MESH_MATERIAL` (#22981)

## Objective

Progress #19024 by avoiding `AssetId::invalid`. This helps
assets-as-entities, and may help with future render optimizations as
it's one step towards reducing `AssetId` to an `Entity`.

## Solution

Previously, `RenderMeshInstances::mesh_material` would return an
`UntypedAssetId`. If the material was not found, it would return the
magic value `DUMMY_MESH_MATERIAL`, which was equal to
`AssetId::invalid()`.

After this PR, `RenderMeshInstances::mesh_material` returns
`Option<UntypedAssetId>` - "not found" becomes `None`, so
`DUMMY_MESH_MATERIAL` is no longer needed.

## Testing

Tested on Native/Win10 and WASM/Chrome/Win10/WebGL. This covers both the
CPU and GPU mesh paths.

```sh
cargo run --example specialized_mesh_pipeline
cargo run --example testbed_3d
cargo run --example meshlet --features "meshlet meshlet_processor https free_camera"
```

## Performance

Tested `many_foxes` with CPU and GPU mesh paths. Difference was below
the noise floor (<5%). Probably a very minor optimization if it replaces
a full `UntypedAssetId` comparison with an `is_none`.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
G
Greeble committed
88c74343607714bb10c4700adbf905014ac4f910
Parent: 5ec83e1
Committed by GitHub <noreply@github.com> on 5/21/2026, 3:15:58 PM