mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 13:13:49 +00:00
10f5c92068
# 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.
101 lines
3.5 KiB
TOML
101 lines
3.5 KiB
TOML
[package]
|
|
name = "bevy_render"
|
|
version = "0.11.0-dev"
|
|
edition = "2021"
|
|
description = "Provides rendering functionality for Bevy Engine"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["bevy"]
|
|
|
|
[features]
|
|
png = ["image/png"]
|
|
exr = ["image/exr"]
|
|
hdr = ["image/hdr"]
|
|
tga = ["image/tga"]
|
|
jpeg = ["image/jpeg"]
|
|
bmp = ["image/bmp"]
|
|
webp = ["image/webp"]
|
|
dds = ["ddsfile"]
|
|
pnm = ["image/pnm"]
|
|
bevy_ci_testing = ["bevy_app/bevy_ci_testing"]
|
|
|
|
shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out"]
|
|
shader_format_spirv = ["wgpu/spirv", "naga/spv-in", "naga/spv-out"]
|
|
|
|
# For ktx2 supercompression
|
|
zlib = ["flate2"]
|
|
zstd = ["ruzstd"]
|
|
|
|
trace = ["profiling"]
|
|
tracing-tracy = []
|
|
wgpu_trace = ["wgpu/trace"]
|
|
ci_limits = []
|
|
webgl = ["wgpu/webgl"]
|
|
|
|
[dependencies]
|
|
# bevy
|
|
bevy_app = { path = "../bevy_app", version = "0.11.0-dev" }
|
|
bevy_asset = { path = "../bevy_asset", version = "0.11.0-dev" }
|
|
bevy_core = { path = "../bevy_core", version = "0.11.0-dev" }
|
|
bevy_derive = { path = "../bevy_derive", version = "0.11.0-dev" }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.11.0-dev" }
|
|
bevy_encase_derive = { path = "../bevy_encase_derive", version = "0.11.0-dev" }
|
|
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.11.0-dev" }
|
|
bevy_log = { path = "../bevy_log", version = "0.11.0-dev" }
|
|
bevy_math = { path = "../bevy_math", version = "0.11.0-dev" }
|
|
bevy_mikktspace = { path = "../bevy_mikktspace", version = "0.11.0-dev" }
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.11.0-dev", features = ["bevy"] }
|
|
bevy_render_macros = { path = "macros", version = "0.11.0-dev" }
|
|
bevy_time = { path = "../bevy_time", version = "0.11.0-dev" }
|
|
bevy_transform = { path = "../bevy_transform", version = "0.11.0-dev" }
|
|
bevy_window = { path = "../bevy_window", version = "0.11.0-dev" }
|
|
bevy_utils = { path = "../bevy_utils", version = "0.11.0-dev" }
|
|
bevy_tasks = { path = "../bevy_tasks", version = "0.11.0-dev" }
|
|
|
|
# rendering
|
|
image = { version = "0.24", default-features = false }
|
|
|
|
# misc
|
|
wgpu = { version = "0.16.0", features=["naga"] }
|
|
wgpu-hal = "0.16.0"
|
|
codespan-reporting = "0.11.0"
|
|
naga = { version = "0.12.0", features = ["wgsl-in"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
bitflags = "2.3"
|
|
bytemuck = { version = "1.5", features = ["derive"] }
|
|
smallvec = { version = "1.6", features = ["union", "const_generics"] }
|
|
once_cell = "1.4.1" # TODO: replace once_cell with std equivalent if/when this lands: https://github.com/rust-lang/rfcs/pull/2788
|
|
downcast-rs = "1.2.0"
|
|
thread_local = "1.1"
|
|
thiserror = "1.0"
|
|
futures-lite = "1.4.0"
|
|
anyhow = "1.0"
|
|
hexasphere = "9.0"
|
|
parking_lot = "0.12.1"
|
|
regex = "1.5"
|
|
ddsfile = { version = "0.5.0", optional = true }
|
|
ktx2 = { version = "0.3.0", optional = true }
|
|
naga_oil = "0.8"
|
|
# For ktx2 supercompression
|
|
flate2 = { version = "1.0.22", optional = true }
|
|
ruzstd = { version = "0.4.0", optional = true }
|
|
# For transcoding of UASTC/ETC1S universal formats, and for .basis file support
|
|
basis-universal = { version = "0.3.0", optional = true }
|
|
encase = { version = "0.6.1", features = ["glam"] }
|
|
# For wgpu profiling using tracing. Use `RUST_LOG=info` to also capture the wgpu spans.
|
|
profiling = { version = "1", features = ["profile-with-tracing"], optional = true }
|
|
async-channel = "1.8"
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
js-sys = "0.3"
|
|
web-sys = { version = "0.3", features = [
|
|
'Blob',
|
|
'Document',
|
|
'Element',
|
|
'HtmlElement',
|
|
'Node',
|
|
'Url',
|
|
'Window',
|
|
] }
|
|
wasm-bindgen = "0.2"
|