3.6 KiB
3.6 KiB
Workspace guide
Workspace
- Rust workspace uses the nightly toolchain (
rust-toolchain), edition 2024, resolver 2. - Members:
crates/renderer,crates/renderer/renderer_macros,crates/renderer_device,crates/renderer_resources,crates/window,crates/game,crates/text, andcrates/bevy_vulkan_render. - Dependency direction for Vulkan rendering:
bevy_vulkan_render→renderer→renderer_resources→renderer_device.renderer_macrossuppliesDeviceRefderives torendererand is a dev-dependency forrenderer_devicetests. rendererre-exports device, instance, queue, and sync modules and many root device types. Prefer its paths for downstream rendering code; its resource-module aliases remain crate-private.crates/renderer/renderer_macrosis the proc-macro crate used byrendererforDeviceRefderives.crates/renderer_deviceowns Vulkan instance/device setup, queues, sync primitives, and handle lifetimes.crates/renderer_resourcesowns public buffer, image, view, descriptor, sampler, shader-module, and pipeline resource APIs onrenderer_device.crates/rendererowns rendering orchestration, commands, swapchains, and render graph APIs; resource module aliases are internal, notrendererpublic modules.crates/bevy_vulkan_renderintegrates the renderer with Bevy.crates/window,crates/game, andcrates/textare separate workspace crates.- The workspace root package is
vidya; it also contains examples and depends onbevy_vulkan_render. renderer_resourcesdepends onrenderer_device, notrenderer; do not introduce a dependency cycle.rendererusesrenderer_devicefor device/instance ownership and accesses resource modules through crate-private aliases.renderer_macrosis nested under the renderer package directory but is a distinct workspace package.
Layout
- Workspace and shared dependency versions: root
Cargo.toml. - Per-crate manifests live beside crate source under
crates/. - Rendering shaders and assets are under
crates/renderer/shadersandassets/. - Root-level demos and examples are under
examples/; add shared dependencies under[workspace.dependencies]where appropriate. - The workspace uses Rust 2024 syntax;
rendererandrenderer_deviceuse nightly features.renderer_resourceshas no crate-level nightly feature attributes.
Conventions
- Keep changes local to the owning crate; preserve the device/rendering layer boundary.
- Follow existing Rust style and use the workspace dependency declarations in the root manifest when applicable.
- Keep the device/resource/rendering dependency boundaries described above; use
renderer's re-exported API in Bevy integration where possible. - Do not commit changes; the user owns commits.
- Read the crate-level instructions before changing rendering/device/resource boundaries:
Verification
cargo check --workspacechecks all workspace crates.cargo test -p renderer_deviceruns the device-layer tests.- Rendering code uses nightly features; use the pinned workspace toolchain for all Cargo commands.
- Run Cargo commands from the workspace root to use the pinned toolchain and shared workspace configuration.
- Use crate-scoped
cargo check -p <crate>orcargo test -p <crate>for focused checks, then workspace check for cross-crate API changes. - Review
git statusandgit diffbefore reporting changes; preserve unrelated user modifications.