2020-04-25 00:46:54 +00:00
|
|
|
[package]
|
|
|
|
name = "bevy_pbr"
|
2023-07-09 08:43:47 +00:00
|
|
|
version = "0.11.0"
|
2021-10-27 00:12:14 +00:00
|
|
|
edition = "2021"
|
2020-08-10 00:24:27 +00:00
|
|
|
description = "Adds PBR rendering to Bevy Engine"
|
|
|
|
homepage = "https://bevyengine.org"
|
|
|
|
repository = "https://github.com/bevyengine/bevy"
|
2021-07-23 21:11:51 +00:00
|
|
|
license = "MIT OR Apache-2.0"
|
2020-08-10 00:24:27 +00:00
|
|
|
keywords = ["bevy"]
|
2020-04-25 00:46:54 +00:00
|
|
|
|
2021-12-22 20:59:48 +00:00
|
|
|
[features]
|
|
|
|
webgl = []
|
|
|
|
|
2020-04-25 00:46:54 +00:00
|
|
|
[dependencies]
|
2021-05-17 22:29:10 +00:00
|
|
|
# bevy
|
2023-07-09 08:43:47 +00:00
|
|
|
bevy_app = { path = "../bevy_app", version = "0.11.0" }
|
|
|
|
bevy_asset = { path = "../bevy_asset", version = "0.11.0" }
|
|
|
|
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.11.0" }
|
|
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.11.0" }
|
|
|
|
bevy_math = { path = "../bevy_math", version = "0.11.0" }
|
|
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.11.0", features = ["bevy"] }
|
|
|
|
bevy_render = { path = "../bevy_render", version = "0.11.0" }
|
|
|
|
bevy_transform = { path = "../bevy_transform", version = "0.11.0" }
|
|
|
|
bevy_utils = { path = "../bevy_utils", version = "0.11.0" }
|
|
|
|
bevy_window = { path = "../bevy_window", version = "0.11.0" }
|
|
|
|
bevy_derive = { path = "../bevy_derive", version = "0.11.0" }
|
2021-05-17 22:29:10 +00:00
|
|
|
|
|
|
|
# other
|
2023-06-01 08:41:42 +00:00
|
|
|
bitflags = "2.3"
|
2021-05-17 22:29:10 +00:00
|
|
|
# direct dependency required for derive macro
|
|
|
|
bytemuck = { version = "1", features = ["derive"] }
|
Allow unbatched render phases to use unstable sorts (#5049)
# Objective
Partially addresses #4291.
Speed up the sort phase for unbatched render phases.
## Solution
Split out one of the optimizations in #4899 and allow implementors of `PhaseItem` to change what kind of sort is used when sorting the items in the phase. This currently includes Stable, Unstable, and Unsorted. Each of these corresponds to `Vec::sort_by_key`, `Vec::sort_unstable_by_key`, and no sorting at all. The default is `Unstable`. The last one can be used as a default if users introduce a preliminary depth prepass.
## Performance
This will not impact the performance of any batched phases, as it is still using a stable sort. 2D's only phase is unchanged. All 3D phases are unbatched currently, and will benefit from this change.
On `many_cubes`, where the primary phase is opaque, this change sees a speed up from 907.02us -> 477.62us, a 47.35% reduction.
![image](https://user-images.githubusercontent.com/3137680/174471253-22424874-30d5-4db5-b5b4-65fb2c612a9c.png)
## Future Work
There were prior discussions to add support for faster radix sorts in #4291, which in theory should be a `O(n)` instead of a `O(nlog(n))` time. [`voracious`](https://crates.io/crates/voracious_radix_sort) has been proposed, but it seems to be optimize for use cases with more than 30,000 items, which may be atypical for most systems.
Another optimization included in #4899 is to reduce the size of a few of the IDs commonly used in `PhaseItem` implementations to shrink the types to make swapping/sorting faster. Both `CachedPipelineId` and `DrawFunctionId` could be reduced to `u32` instead of `usize`.
Ideally, this should automatically change to use stable sorts when `BatchedPhaseItem` is implemented on the same phase item type, but this requires specialization, which may not land in stable Rust for a short while.
---
## Changelog
Added: `PhaseItem::sort`
## Migration Guide
RenderPhases now default to a unstable sort (via `slice::sort_unstable_by_key`). This can typically improve sort phase performance, but may produce incorrect batching results when implementing `BatchedPhaseItem`. To revert to the older stable sort, manually implement `PhaseItem::sort` to implement a stable sort (i.e. via `slice::sort_by_key`).
Co-authored-by: Federico Rinaldi <gisquerin@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: colepoirier <colepoirier@gmail.com>
2022-06-23 10:52:49 +00:00
|
|
|
radsort = "0.1"
|
improve shader import model (#5703)
# Objective
operate on naga IR directly to improve handling of shader modules.
- give codespan reporting into imported modules
- allow glsl to be used from wgsl and vice-versa
the ultimate objective is to make it possible to
- provide user hooks for core shader functions (to modify light
behaviour within the standard pbr pipeline, for example)
- make automatic binding slot allocation possible
but ... since this is already big, adds some value and (i think) is at
feature parity with the existing code, i wanted to push this now.
## Solution
i made a crate called naga_oil (https://github.com/robtfm/naga_oil -
unpublished for now, could be part of bevy) which manages modules by
- building each module independantly to naga IR
- creating "header" files for each supported language, which are used to
build dependent modules/shaders
- make final shaders by combining the shader IR with the IR for imported
modules
then integrated this into bevy, replacing some of the existing shader
processing stuff. also reworked examples to reflect this.
## Migration Guide
shaders that don't use `#import` directives should work without changes.
the most notable user-facing difference is that imported
functions/variables/etc need to be qualified at point of use, and
there's no "leakage" of visible stuff into your shader scope from the
imports of your imports, so if you used things imported by your imports,
you now need to import them directly and qualify them.
the current strategy of including/'spreading' `mesh_vertex_output`
directly into a struct doesn't work any more, so these need to be
modified as per the examples (e.g. color_material.wgsl, or many others).
mesh data is assumed to be in bindgroup 2 by default, if mesh data is
bound into bindgroup 1 instead then the shader def `MESH_BINDGROUP_1`
needs to be added to the pipeline shader_defs.
2023-06-27 00:29:22 +00:00
|
|
|
naga_oil = "0.8"
|