bevyengine / bevyengine/bevy

`MeshAllocator::mesh_index_slice()` mixes error and non-error codepath in return

Open
#18,906 2 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Code-Quality C-Usability D-Modest S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

`MeshAllocator::mesh_index_slice()` can return `None` if:
- the index buffer was not allocated, which means the mesh cannot be rendered at this time, so the application needs to skip further work related to that mesh and not issue rendering commands with it; and
- the mesh is a non-indexed mesh, which means (if the vertex buffer is otherwise allocated) that the mesh is ready for rendering and the application can proceed.

So there's no way to tell how the caller should behave when `None` is returned. For now I assume that if `mesh_vertex_slice()` returned a valid allocation then any index buffer was also successfully allocated, so I treat `None` as "the mesh was successfully allocated but is non-indexed". However it would be better if the API would make that unambiguous.

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.