bevyengine / bevyengine/bevy

wgpu re-exports are inconsistent and confusing

Open
#3,823 8 comments 7 reactions 0 assignees View on GitHub
A-Rendering C-Code-Quality D-Straightforward S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

Some re-exports have conflicting names with bevy types. Sometimes these are renamed with a `Wgpu` prefix and other times they are renamed with a `Raw` prefix. The current mechanism re-exports each item individually and can easily fall out of date and miss things.

## What solution would you like?

It would be a lot nicer to simply re-export wgpu as a module instead of the individual items. In other words, use this:

```rust
pub use wgpu;
```

instead of this:

https://github.com/bevyengine/bevy/blob/4134577e646e0d1017064780bca34bb3fa096216/crates/bevy_render/src/render_resource/mod.rs#L23-L42

The `wgpu` crate name (and when re-exported wholesale as a module) is short enough that it is not tedious to simply always use the fully qualified name (e.g. `wgpu::Buffer`). This usage is pretty common in the wgpu ecosystem including other areas of bevy.

## What problem does this solve or what need does it fill?

Re-exporting the crate as a module makes things much more consistent and reduces the maintenance burden of having to add every wgpu type manually.

## What alternative(s) have you considered?

Leave things as they are.

## Additional context

I can draft a PR if there's interest in making this change.

Contributor guide

Open the contributing guide

Research direction

Start in crates/bevy_render/src/render_resource/mod.rs at the individual wgpu re-exports linked in the issue. Review nearby render-resource usage and check how the existing renamed exports are referenced. Done means wgpu is exposed as a module and the existing manual re-exports are no longer needed without breaking compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.