Skip to content

Commit 90f8b16

Browse files
committed
Merge remote-tracking branch 'origin/main' into pbr-ssr
2 parents 025577f + 7ca7b97 commit 90f8b16

File tree

264 files changed

+4718
-1647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+4718
-1647
lines changed

Cargo.toml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ common_api = [
217217
"bevy_image",
218218
"bevy_mesh",
219219
"bevy_shader",
220+
"bevy_material",
220221
"bevy_text",
221222
"hdr",
222223
"png",
@@ -374,6 +375,9 @@ bevy_light = ["bevy_internal/bevy_light"]
374375
# Provides shaders usable through asset handles.
375376
bevy_shader = ["bevy_internal/bevy_shader"]
376377

378+
# Provides materials.
379+
bevy_material = ["bevy_internal/bevy_material"]
380+
377381
# Adds support for gizmos
378382
bevy_gizmos = ["bevy_internal/bevy_gizmos"]
379383

@@ -1250,6 +1254,19 @@ description = "Showcases different blend modes"
12501254
category = "3D Rendering"
12511255
wasm = true
12521256

1257+
[[example]]
1258+
name = "contact_shadows"
1259+
path = "examples/3d/contact_shadows.rs"
1260+
# Causes an ICE on docs.rs
1261+
doc-scrape-examples = false
1262+
required-features = ["bluenoise_texture"]
1263+
1264+
[package.metadata.example.contact_shadows]
1265+
name = "Contact Shadows"
1266+
description = "Showcases how contact shadows add shadow detail"
1267+
category = "3D Rendering"
1268+
wasm = true
1269+
12531270
[[example]]
12541271
name = "lighting"
12551272
path = "examples/3d/lighting.rs"
@@ -4499,7 +4516,7 @@ doc-scrape-examples = false
44994516
name = "glTF extension AnimationGraph"
45004517
description = "Uses glTF data to build an AnimationGraph via extension processing"
45014518
category = "glTF"
4502-
wasm = true
4519+
wasm = false
45034520

45044521
[[example]]
45054522
name = "gltf_extension_mesh_2d"
@@ -4511,7 +4528,7 @@ doc-scrape-examples = false
45114528
name = "glTF extension processing to build Mesh2ds from glTF data"
45124529
description = "Uses glTF extension data to convert incoming Mesh3d/MeshMaterial3d assets to 2d"
45134530
category = "glTF"
4514-
wasm = true
4531+
wasm = false
45154532

45164533
[[example]]
45174534
name = "query_gltf_primitives"

benches/benches/bevy_reflect/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use core::{hint::black_box, iter, time::Duration};
22

33
use benches::bench;
4-
use bevy_reflect::{DynamicList, List};
4+
use bevy_reflect::list::{DynamicList, List};
55
use criterion::{
66
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
77
Criterion, PlotConfiguration, Throughput,

benches/benches/bevy_reflect/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::{fmt::Write, hint::black_box, iter, time::Duration};
22

33
use benches::bench;
44
use bevy_platform::collections::HashMap;
5-
use bevy_reflect::{DynamicMap, Map};
5+
use bevy_reflect::map::{DynamicMap, Map};
66
use criterion::{
77
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
88
Criterion, PlotConfiguration, Throughput,

benches/benches/bevy_reflect/struct.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use core::{hint::black_box, time::Duration};
22

33
use benches::bench;
4-
use bevy_reflect::{DynamicStruct, GetField, PartialReflect, Reflect, Struct};
4+
use bevy_reflect::{
5+
structs::{DynamicStruct, GetField, Struct},
6+
PartialReflect, Reflect,
7+
};
58
use criterion::{
69
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
710
Criterion, PlotConfiguration, Throughput,

crates/bevy_animation/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ impl<'a> Iterator for TriggeredEventsIter<'a> {
15221522
#[cfg(test)]
15231523
mod tests {
15241524
use crate as bevy_animation;
1525-
use bevy_reflect::{DynamicMap, Map};
1525+
use bevy_reflect::map::{DynamicMap, Map};
15261526

15271527
use super::*;
15281528

crates/bevy_asset/src/io/wasm.rs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ use crate::io::{
33
};
44
use alloc::{borrow::ToOwned, boxed::Box, format};
55
use js_sys::{Uint8Array, JSON};
6-
use std::path::{Path, PathBuf};
6+
use std::{
7+
borrow::Cow,
8+
path::{Path, PathBuf},
9+
};
710
use tracing::error;
811
use wasm_bindgen::{prelude::wasm_bindgen, JsCast, JsValue};
912
use wasm_bindgen_futures::JsFuture;
@@ -27,15 +30,27 @@ extern "C" {
2730
/// Reader implementation for loading assets via HTTP in Wasm.
2831
pub struct HttpWasmAssetReader {
2932
root_path: PathBuf,
33+
request_mapper: Option<Box<dyn Fn(&str) -> Cow<str> + Send + Sync + 'static>>,
3034
}
3135

3236
impl HttpWasmAssetReader {
3337
/// Creates a new `WasmAssetReader`. The path provided will be used to build URLs to query for assets.
3438
pub fn new<P: AsRef<Path>>(path: P) -> Self {
3539
Self {
3640
root_path: path.as_ref().to_owned(),
41+
request_mapper: None,
3742
}
3843
}
44+
45+
/// Sets a mapper function to modify the request URL for each asset fetch. This can be used to
46+
/// add query parameters or modify the path in any way.
47+
pub fn with_request_mapper<F>(mut self, mapper: F) -> Self
48+
where
49+
F: Fn(&str) -> Cow<str> + Send + Sync + 'static,
50+
{
51+
self.request_mapper = Some(Box::new(mapper));
52+
self
53+
}
3954
}
4055

4156
fn js_value_to_err(context: &str) -> impl FnOnce(JsValue) -> std::io::Error + '_ {
@@ -57,14 +72,20 @@ impl HttpWasmAssetReader {
5772
&self,
5873
path: PathBuf,
5974
) -> Result<impl Reader + use<>, AssetReaderError> {
75+
let path = path.to_str().unwrap();
76+
let fetch_path = self
77+
.request_mapper
78+
.as_ref()
79+
.map_or_else(|| Cow::Borrowed(path), |mapper| mapper(path));
80+
6081
// The JS global scope includes a self-reference via a specializing name, which can be used to determine the type of global context available.
6182
let global: Global = js_sys::global().unchecked_into();
6283
let promise = if !global.window().is_undefined() {
6384
let window: web_sys::Window = global.unchecked_into();
64-
window.fetch_with_str(path.to_str().unwrap())
85+
window.fetch_with_str(&fetch_path)
6586
} else if !global.worker().is_undefined() {
6687
let worker: web_sys::WorkerGlobalScope = global.unchecked_into();
67-
worker.fetch_with_str(path.to_str().unwrap())
88+
worker.fetch_with_str(&fetch_path)
6889
} else {
6990
let error = std::io::Error::other("Unsupported JavaScript global context");
7091
return Err(AssetReaderError::Io(error.into()));
@@ -85,7 +106,7 @@ impl HttpWasmAssetReader {
85106
// Some web servers, including itch.io's CDN, return 403 when a requested file isn't present.
86107
// TODO: remove handling of 403 as not found when it's easier to configure
87108
// see https://github.com/bevyengine/bevy/pull/19268#pullrequestreview-2882410105
88-
403 | 404 => Err(AssetReaderError::NotFound(path)),
109+
403 | 404 => Err(AssetReaderError::NotFound((*fetch_path).into())),
89110
status => Err(AssetReaderError::HttpError(status)),
90111
}
91112
}

crates/bevy_core_pipeline/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ bevy_platform = { path = "../bevy_platform", version = "0.18.0-dev", default-fea
4040
bitflags = "2.3"
4141
radsort = "0.1"
4242
nonmax = "0.5"
43-
serde = { version = "1", default-features = false, features = ["derive"] }
44-
smallvec = { version = "1", default-features = false }
45-
thiserror = { version = "2", default-features = false }
4643
tracing = { version = "0.1", default-features = false, features = ["std"] }
4744

4845
[lints]

crates/bevy_core_pipeline/src/mip_generation/experimental/depth.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,19 @@ use bevy_ecs::{
2222
use bevy_math::{uvec2, UVec2, Vec4Swizzles as _};
2323
use bevy_render::{
2424
batching::gpu_preprocessing::GpuPreprocessingSupport,
25-
render_resource::BindGroupLayoutDescriptor,
26-
};
27-
use bevy_render::{
2825
experimental::occlusion_culling::{
2926
OcclusionCulling, OcclusionCullingSubview, OcclusionCullingSubviewEntities,
3027
},
3128
render_graph::{Node, NodeRunError, RenderGraphContext},
3229
render_resource::{
3330
binding_types::{sampler, texture_2d, texture_2d_multisampled, texture_storage_2d},
34-
BindGroup, BindGroupEntries, BindGroupLayout, BindGroupLayoutEntries,
35-
CachedComputePipelineId, ComputePassDescriptor, ComputePipeline, ComputePipelineDescriptor,
36-
Extent3d, IntoBinding, PipelineCache, PushConstantRange, Sampler, SamplerBindingType,
37-
SamplerDescriptor, ShaderStages, SpecializedComputePipeline, SpecializedComputePipelines,
38-
StorageTextureAccess, TextureAspect, TextureDescriptor, TextureDimension, TextureFormat,
39-
TextureSampleType, TextureUsages, TextureView, TextureViewDescriptor, TextureViewDimension,
31+
BindGroup, BindGroupEntries, BindGroupLayout, BindGroupLayoutDescriptor,
32+
BindGroupLayoutEntries, CachedComputePipelineId, ComputePassDescriptor, ComputePipeline,
33+
ComputePipelineDescriptor, Extent3d, IntoBinding, PipelineCache, PushConstantRange,
34+
Sampler, SamplerBindingType, SamplerDescriptor, ShaderStages, SpecializedComputePipeline,
35+
SpecializedComputePipelines, StorageTextureAccess, TextureAspect, TextureDescriptor,
36+
TextureDimension, TextureFormat, TextureSampleType, TextureUsages, TextureView,
37+
TextureViewDescriptor, TextureViewDimension,
4038
},
4139
renderer::{RenderContext, RenderDevice},
4240
texture::TextureCache,

crates/bevy_core_pipeline/src/mip_generation/mod.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,21 @@ use bevy_render::{
3636
diagnostic::RecordDiagnostics as _,
3737
render_asset::RenderAssets,
3838
render_resource::{
39-
binding_types::uniform_buffer, BindGroupLayoutDescriptor, FilterMode, ShaderType,
40-
TextureFormatFeatureFlags, UniformBuffer,
39+
binding_types::{sampler, texture_2d, texture_storage_2d, uniform_buffer},
40+
BindGroup, BindGroupEntries, BindGroupLayoutDescriptor, BindGroupLayoutEntries,
41+
CachedComputePipelineId, ComputePassDescriptor, ComputePipelineDescriptor, Extent3d,
42+
FilterMode, PipelineCache, Sampler, SamplerBindingType, SamplerDescriptor, ShaderStages,
43+
ShaderType, SpecializedComputePipelines, StorageTextureAccess, TextureAspect,
44+
TextureDescriptor, TextureDimension, TextureFormat, TextureFormatFeatureFlags,
45+
TextureUsages, TextureView, TextureViewDescriptor, TextureViewDimension, UniformBuffer,
4146
},
42-
renderer::{RenderAdapter, RenderQueue},
47+
renderer::{RenderAdapter, RenderContext, RenderDevice, RenderQueue},
4348
settings::WgpuFeatures,
4449
texture::GpuImage,
4550
RenderStartup,
4651
};
4752
use bevy_render::{
4853
render_graph::{Node, NodeRunError, RenderGraphContext, RenderGraphExt},
49-
render_resource::{
50-
binding_types::{sampler, texture_2d, texture_storage_2d},
51-
BindGroup, BindGroupEntries, BindGroupLayoutEntries, CachedComputePipelineId,
52-
ComputePassDescriptor, ComputePipelineDescriptor, Extent3d, PipelineCache, Sampler,
53-
SamplerBindingType, SamplerDescriptor, ShaderStages, SpecializedComputePipelines,
54-
StorageTextureAccess, TextureAspect, TextureDescriptor, TextureDimension, TextureFormat,
55-
TextureUsages, TextureView, TextureViewDescriptor, TextureViewDimension,
56-
},
57-
renderer::{RenderContext, RenderDevice},
5854
Render, RenderApp, RenderSystems,
5955
};
6056
use bevy_shader::{Shader, ShaderDefVal};

crates/bevy_core_pipeline/src/skybox/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ impl ExtractComponent for Skybox {
124124
brightness: skybox.brightness * exposure,
125125
transform: Transform::from_rotation(skybox.rotation.inverse()).to_matrix(),
126126
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
127-
_wasm_padding_8b: 0,
127+
_webgl2_padding_8b: 0,
128128
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
129-
_wasm_padding_12b: 0,
129+
_webgl2_padding_12b: 0,
130130
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
131-
_wasm_padding_16b: 0,
131+
_webgl2_padding_16b: 0,
132132
},
133133
))
134134
}
@@ -140,11 +140,11 @@ pub struct SkyboxUniforms {
140140
brightness: f32,
141141
transform: Mat4,
142142
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
143-
_wasm_padding_8b: u32,
143+
_webgl2_padding_8b: u32,
144144
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
145-
_wasm_padding_12b: u32,
145+
_webgl2_padding_12b: u32,
146146
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
147-
_wasm_padding_16b: u32,
147+
_webgl2_padding_16b: u32,
148148
}
149149

150150
#[derive(Resource)]

0 commit comments

Comments
 (0)