Skip to content

Commit fa273f7

Browse files
committed
fmt
CI CI ci ci docs doc + notes Ci
1 parent b9af18f commit fa273f7

File tree

38 files changed

+285
-160
lines changed

38 files changed

+285
-160
lines changed

crates/bevy_core_pipeline/src/core_3d/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ pub fn prepare_core_3d_depth_textures(
846846
}
847847
}
848848

849+
/// A material can specify [`MaterialProperties::reads_view_transmission_texture`](`bevy_material::material::MaterialProperties`) to read from [`ViewTransmissionTexture`].
850+
///
851+
/// This allows taking color output from the [`Opaque3d`] pass as an input, (for screen-space transmission) but requires
852+
/// rendering to take place in a separate [`Transmissive3d`] pass.
849853
#[derive(Component)]
850854
pub struct ViewTransmissionTexture {
851855
pub texture: Texture,

crates/bevy_gizmos_render/src/pipeline_3d.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use bevy_ecs::{
2121
system::{Commands, Query, Res, ResMut},
2222
};
2323
use bevy_image::BevyDefault as _;
24-
use bevy_pbr::{MeshPipeline, MeshPipelineKey, SetMeshViewBindGroup};
24+
use bevy_pbr::{init_mesh_pipeline, MeshPipeline, MeshPipelineKey, SetMeshViewBindGroup};
2525
use bevy_render::{
2626
render_asset::{prepare_assets, RenderAssets},
2727
render_phase::{
@@ -56,7 +56,9 @@ impl Plugin for LineGizmo3dPlugin {
5656
)
5757
.add_systems(
5858
RenderStartup,
59-
init_line_gizmo_pipelines.after(init_line_gizmo_uniform_bind_group_layout),
59+
init_line_gizmo_pipelines
60+
.after(init_line_gizmo_uniform_bind_group_layout)
61+
.after(init_mesh_pipeline),
6062
)
6163
.add_systems(
6264
Render,

crates/bevy_internal/Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,7 @@ bevy_window = ["dep:bevy_window", "dep:bevy_a11y", "bevy_image"]
235235
bevy_winit = ["dep:bevy_winit", "bevy_window"]
236236
bevy_camera = ["dep:bevy_camera", "bevy_mesh", "bevy_window"]
237237
bevy_scene = ["dep:bevy_scene", "bevy_asset"]
238-
bevy_material = [
239-
"dep:bevy_material",
240-
"bevy_image",
241-
"bevy_shader",
242-
]
238+
bevy_material = ["dep:bevy_material", "bevy_image", "bevy_shader"]
243239
bevy_light = ["dep:bevy_light", "bevy_camera", "bevy_gizmos?/bevy_light"]
244240
bevy_render = [
245241
"dep:bevy_render",

crates/bevy_material/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Provides a material abstraction for bevy
2-
#![allow(missing_docs)]
2+
#![allow(missing_docs, reason = "Needs docs")]
33

44
extern crate alloc;
55

crates/bevy_material/src/material.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,27 @@ use crate::alpha::AlphaMode;
22
use crate::opaque::OpaqueRendererMethod;
33
use crate::render::MeshPipeline;
44
use crate::render::MeshPipelineKey;
5-
use crate::render_phase::{DrawFunctionId, DrawFunctionLabel, InternedDrawFunctionLabel, InternedShaderLabel, ShaderLabel};
6-
use crate::render_resource::{BindGroupLayoutDescriptor, RenderPipelineDescriptor, SpecializedMeshPipelineError};
5+
use crate::render_phase::{
6+
DrawFunctionId, DrawFunctionLabel, InternedDrawFunctionLabel, InternedShaderLabel, ShaderLabel,
7+
};
8+
use crate::render_resource::{
9+
BindGroupLayoutDescriptor, RenderPipelineDescriptor, SpecializedMeshPipelineError,
10+
};
711
use crate::*;
812
use alloc::sync::Arc;
913
use bevy_asset::Handle;
1014
use bevy_ecs::resource::Resource;
1115
use bevy_mesh::MeshVertexBufferLayoutRef;
1216
use bevy_platform::hash::FixedHasher;
1317
use bevy_shader::Shader;
14-
use smallvec::SmallVec;
1518
use core::any::{Any, TypeId};
16-
use core::hash::{BuildHasher, Hasher};
1719
use core::hash::Hash;
20+
use core::hash::{BuildHasher, Hasher};
21+
use smallvec::SmallVec;
1822

1923
pub const MATERIAL_BIND_GROUP_INDEX: usize = 3;
2024

21-
/// Render pipeline data for a given [`Material`].
25+
/// Render pipeline data for a given material.
2226
#[derive(Resource, Clone)]
2327
pub struct MaterialPipeline {
2428
pub mesh_pipeline: MeshPipeline,
@@ -110,7 +114,7 @@ impl Default for ErasedMaterialKey {
110114
}
111115
}
112116

113-
/// Common [`Material`] properties, calculated for a specific material instance.
117+
/// Common material properties, calculated for a specific material instance.
114118
#[derive(Default)]
115119
pub struct MaterialProperties {
116120
/// Is this material should be rendered by the deferred renderer when.
@@ -120,17 +124,16 @@ pub struct MaterialProperties {
120124
pub alpha_mode: AlphaMode,
121125
/// The bits in the [`MeshPipelineKey`] for this material.
122126
///
123-
/// These are precalculated so that we can just "or" them together in
124-
/// [`queue_material_meshes`].
127+
/// These are precalculated so that we can just "or" them together.
125128
pub mesh_pipeline_key_bits: MeshPipelineKey,
126129
/// Add a bias to the view depth of the mesh which can be used to force a specific render order
127130
/// for meshes with equal depth, to avoid z-fighting.
128131
/// The bias is in depth-texture units so large values may be needed to overcome small depth differences.
129132
pub depth_bias: f32,
130-
/// Whether the material would like to read from [`ViewTransmissionTexture`](bevy_core_pipeline::core_3d::ViewTransmissionTexture).
133+
/// Whether the material would like to read from a view transmission texture
131134
///
132-
/// This allows taking color output from the [`Opaque3d`] pass as an input, (for screen-space transmission) but requires
133-
/// rendering to take place in a separate [`Transmissive3d`] pass.
135+
/// This allows taking color output from the opaque 3d pass as an input, (for screen-space transmission) but requires
136+
/// rendering to take place in a separate transmissive 3d pass.
134137
pub reads_view_transmission_texture: bool,
135138
pub render_phase_type: RenderPhaseType,
136139
pub material_layout: Option<BindGroupLayoutDescriptor>,
@@ -197,4 +200,3 @@ pub enum RenderPhaseType {
197200
Transmissive,
198201
Transparent,
199202
}
200-

crates/bevy_material/src/render/mesh.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
use crate::{
2+
render::{
3+
MeshLayouts, MeshPipelineViewLayout, MeshPipelineViewLayoutKey, MeshPipelineViewLayouts,
4+
},
5+
render_resource::*,
6+
};
17
use bevy_asset::Handle;
28
use bevy_ecs::resource::Resource;
39
use bevy_mesh::BaseMeshPipelineKey;
410
use bevy_shader::Shader;
5-
use crate::{render::{MeshLayouts, MeshPipelineViewLayout, MeshPipelineViewLayoutKey, MeshPipelineViewLayouts}, render_resource::*};
611

712
use static_assertions::const_assert_eq;
813

9-
1014
/// How many textures are allowed in the view bind group layout (`@group(0)`) before
1115
/// broader compatibility with WebGL and WebGPU is at risk, due to the minimum guaranteed
1216
/// values for `MAX_TEXTURE_IMAGE_UNITS` (in WebGL) and `maxSampledTexturesPerShaderStage` (in WebGPU),
@@ -18,7 +22,6 @@ use static_assertions::const_assert_eq;
1822
#[cfg(debug_assertions)]
1923
pub const MESH_PIPELINE_VIEW_LAYOUT_SAFE_MAX_TEXTURES: usize = 10;
2024

21-
2225
/// All data needed to construct a pipeline for rendering 3D meshes.
2326
#[derive(Resource, Clone)]
2427
pub struct MeshPipeline {
@@ -223,4 +226,3 @@ const_assert_eq!(
223226
& MeshPipelineKey::ALL_RESERVED_BITS.bits(),
224227
0
225228
);
226-

crates/bevy_material/src/render/mesh_bindings.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
21
use crate::render_resource::BindGroupLayoutDescriptor;
32

4-
5-
/// All possible [`BindGroupLayout`]s in bevy's default mesh shader (`mesh.wgsl`).
3+
/// All possible [`BindGroupLayoutDescriptor`]s in bevy's default mesh shader (`mesh.wgsl`).
64
#[derive(Clone)]
75
pub struct MeshLayouts {
86
/// The mesh model uniform (transform) and nothing else.
@@ -18,19 +16,15 @@ pub struct MeshLayouts {
1816
/// frame's joint matrices, so that we can compute motion vectors.
1917
pub skinned_motion: BindGroupLayoutDescriptor,
2018

21-
/// Also includes the uniform and [`MorphAttributes`] for morph targets.
22-
///
23-
/// [`MorphAttributes`]: bevy_mesh::morph::MorphAttributes
19+
/// Also includes the uniform and [`MorphAttributes`](`bevy_mesh::morph::MorphAttributes`) for morph targets.
2420
pub morphed: BindGroupLayoutDescriptor,
2521

2622
/// Like [`MeshLayouts::morphed`], but includes a slot for the previous
2723
/// frame's morph weights, so that we can compute motion vectors.
2824
pub morphed_motion: BindGroupLayoutDescriptor,
2925

3026
/// Also includes both uniforms for skinning and morph targets, also the
31-
/// morph target [`MorphAttributes`] binding.
32-
///
33-
/// [`MorphAttributes`]: bevy_mesh::morph::MorphAttributes
27+
/// morph target [`MorphAttributes`](`bevy_mesh::morph::MorphAttributes`) binding.
3428
pub morphed_skinned: BindGroupLayoutDescriptor,
3529

3630
/// Like [`MeshLayouts::morphed_skinned`], but includes slots for the

crates/bevy_material/src/render/mesh_view_bindings.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1+
use crate::{render::MeshPipelineKey, render_resource::*};
12
use alloc::sync::Arc;
23
use bevy_derive::{Deref, DerefMut};
3-
use bevy_ecs::{
4-
resource::Resource,
5-
};
6-
use crate::{
7-
render::MeshPipelineKey, render_resource::*
8-
};
4+
use bevy_ecs::resource::Resource;
95

106
#[cfg(debug_assertions)]
117
use {crate::render::MESH_PIPELINE_VIEW_LAYOUT_SAFE_MAX_TEXTURES, bevy_utils::once, tracing::warn};
@@ -135,4 +131,3 @@ impl MeshPipelineViewLayouts {
135131
layout
136132
}
137133
}
138-
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use core::{fmt::Debug, hash::Hash};
22

33
// TODO: make this generic?
4-
/// An identifier for a [`Draw`] function stored in [`DrawFunctions`].
4+
/// An identifier for a draw functions stored.
55
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
66
pub struct DrawFunctionId(pub u32);
7-

crates/bevy_pbr/src/deferred/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ use crate::{
44
ViewLightProbesUniformOffset, ViewScreenSpaceReflectionsUniformOffset,
55
TONEMAPPING_LUT_SAMPLER_BINDING_INDEX, TONEMAPPING_LUT_TEXTURE_BINDING_INDEX,
66
};
7-
use crate::{DistanceFog, MeshPipelineKey, ViewFogUniformOffset, ViewLightsUniformOffset};
7+
use crate::{
8+
init_mesh_pipeline, DistanceFog, MeshPipelineKey, ViewFogUniformOffset, ViewLightsUniformOffset,
9+
};
810
use bevy_app::prelude::*;
911
use bevy_asset::{embedded_asset, load_embedded_asset, AssetServer, Handle};
1012
use bevy_core_pipeline::{
@@ -106,7 +108,10 @@ impl Plugin for DeferredPbrLightingPlugin {
106108

107109
render_app
108110
.init_resource::<SpecializedRenderPipelines<DeferredLightingLayout>>()
109-
.add_systems(RenderStartup, init_deferred_lighting_layout)
111+
.add_systems(
112+
RenderStartup,
113+
init_deferred_lighting_layout.after(init_mesh_pipeline),
114+
)
110115
.add_systems(
111116
Render,
112117
(prepare_deferred_lighting_pipelines.in_set(RenderSystems::Prepare),),

0 commit comments

Comments
 (0)