diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54adacae32..96068912a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -375,4 +375,26 @@ jobs: echo " Fix the issue by replacing 'bevy_internal' with 'bevy'" echo " Example: 'use bevy::sprite::MaterialMesh2dBundle;' instead of 'bevy_internal::sprite::MaterialMesh2dBundle;'" exit 1 - fi \ No newline at end of file + fi + check-cfg: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }} + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.NIGHTLY_TOOLCHAIN }} + - name: Install alsa and udev + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev + - name: Build and check cfg typos + # See tools/ci/src/main.rs for the commands this runs + run: cargo run -p ci -- cfg-check diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index 54a324a85f..5605d0c335 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -3,9 +3,8 @@ pub use bevy_derive::AppLabel; use bevy_ecs::{ prelude::*, schedule::{ - apply_state_transition, common_conditions::run_once as run_once_condition, - run_enter_schedule, InternedScheduleLabel, IntoSystemConfigs, IntoSystemSetConfigs, - ScheduleBuildSettings, ScheduleLabel, StateTransitionEvent, + common_conditions::run_once as run_once_condition, run_enter_schedule, + InternedScheduleLabel, ScheduleBuildSettings, ScheduleLabel, }, }; use bevy_utils::{intern::Interned, thiserror::Error, tracing::debug, HashMap, HashSet}; diff --git a/crates/bevy_color/src/lib.rs b/crates/bevy_color/src/lib.rs index acce271335..627cd6f195 100644 --- a/crates/bevy_color/src/lib.rs +++ b/crates/bevy_color/src/lib.rs @@ -98,6 +98,7 @@ pub use xyza::*; use bevy_render::color::LegacyColor; /// Describes the traits that a color should implement for consistency. +#[allow(dead_code)] // This is an internal marker trait used to ensure that our color types impl the required traits pub(crate) trait StandardColor where Self: core::fmt::Debug, diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index c49f08ab1f..7cf8da08b6 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -5,7 +5,7 @@ mod name; mod serde; mod task_pool_options; -use bevy_ecs::system::{ResMut, Resource}; +use bevy_ecs::system::Resource; pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable}; pub use name::*; pub use task_pool_options::*; diff --git a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs index e75349717d..5c512747e5 100644 --- a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs +++ b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs @@ -2,7 +2,6 @@ use std::sync::Mutex; use crate::contrast_adaptive_sharpening::ViewCASPipeline; use bevy_ecs::prelude::*; -use bevy_ecs::query::QueryState; use bevy_render::{ extract_component::{ComponentUniforms, DynamicUniformIndex}, render_graph::{Node, NodeRunError, RenderGraphContext}, diff --git a/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs b/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs index 8d9bc3470c..37c6da5a11 100644 --- a/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs +++ b/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs @@ -18,7 +18,6 @@ use bevy_render::{ use bevy_ecs::query::QueryItem; use bevy_render::{ render_graph::{NodeRunError, RenderGraphContext, ViewNode}, - render_resource::{Operations, PipelineCache, RenderPassDescriptor}, renderer::RenderContext, }; diff --git a/crates/bevy_core_pipeline/src/msaa_writeback.rs b/crates/bevy_core_pipeline/src/msaa_writeback.rs index 1cf6b02f39..b52bbd0e48 100644 --- a/crates/bevy_core_pipeline/src/msaa_writeback.rs +++ b/crates/bevy_core_pipeline/src/msaa_writeback.rs @@ -9,7 +9,6 @@ use bevy_render::{ camera::ExtractedCamera, color::LegacyColor, render_graph::{Node, NodeRunError, RenderGraphApp, RenderGraphContext}, - render_resource::BindGroupEntries, renderer::RenderContext, view::{Msaa, ViewTarget}, Render, RenderSet, diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index a1715fee58..3f397cf3dd 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -56,7 +56,7 @@ use crate::{ storage::{SparseSetIndex, TableId, TableRow}, }; use serde::{Deserialize, Serialize}; -use std::{convert::TryFrom, fmt, hash::Hash, mem, num::NonZeroU32, sync::atomic::Ordering}; +use std::{fmt, hash::Hash, mem, num::NonZeroU32, sync::atomic::Ordering}; #[cfg(target_has_atomic = "64")] use std::sync::atomic::AtomicI64 as AtomicIdCursor; diff --git a/crates/bevy_ecs/src/query/iter.rs b/crates/bevy_ecs/src/query/iter.rs index 8c38525a94..cc911c1b95 100644 --- a/crates/bevy_ecs/src/query/iter.rs +++ b/crates/bevy_ecs/src/query/iter.rs @@ -49,7 +49,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIter<'w, 's, D, F> { /// - `table` must match D and F /// - Both `D::IS_DENSE` and `F::IS_DENSE` must be true. #[inline] - #[cfg(all(not(target = "wasm32"), feature = "multi-threaded"))] + #[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))] pub(super) unsafe fn for_each_in_table_range( &mut self, func: &mut Func, @@ -73,7 +73,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIter<'w, 's, D, F> { /// - `archetype` must match D and F /// - Either `D::IS_DENSE` or `F::IS_DENSE` must be false. #[inline] - #[cfg(all(not(target = "wasm32"), feature = "multi-threaded"))] + #[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))] pub(super) unsafe fn for_each_in_archetype_range( &mut self, func: &mut Func, diff --git a/crates/bevy_ecs/src/query/par_iter.rs b/crates/bevy_ecs/src/query/par_iter.rs index 620e9175c9..0a7ec641d3 100644 --- a/crates/bevy_ecs/src/query/par_iter.rs +++ b/crates/bevy_ecs/src/query/par_iter.rs @@ -109,7 +109,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> { /// [`ComputeTaskPool`]: bevy_tasks::ComputeTaskPool #[inline] pub fn for_each) + Send + Sync + Clone>(self, func: FN) { - #[cfg(any(target = "wasm32", not(feature = "multi-threaded")))] + #[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))] { // SAFETY: // This method can only be called once per instance of QueryParIter, @@ -123,7 +123,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> { .for_each(func); } } - #[cfg(all(not(target = "wasm32"), feature = "multi-threaded"))] + #[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))] { let thread_count = bevy_tasks::ComputeTaskPool::get().thread_num(); if thread_count <= 1 { @@ -150,7 +150,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> { } } - #[cfg(all(not(target = "wasm32"), feature = "multi-threaded"))] + #[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))] fn get_batch_size(&self, thread_count: usize) -> usize { if self.batching_strategy.batch_size_limits.is_empty() { return self.batching_strategy.batch_size_limits.start; diff --git a/crates/bevy_ecs/src/query/state.rs b/crates/bevy_ecs/src/query/state.rs index e120d12496..3eb76d3d3d 100644 --- a/crates/bevy_ecs/src/query/state.rs +++ b/crates/bevy_ecs/src/query/state.rs @@ -1117,7 +1117,7 @@ impl QueryState { /// with a mismatched [`WorldId`] is unsound. /// /// [`ComputeTaskPool`]: bevy_tasks::ComputeTaskPool - #[cfg(all(not(target = "wasm32"), feature = "multi-threaded"))] + #[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))] pub(crate) unsafe fn par_for_each_unchecked_manual< 'w, FN: Fn(D::Item<'w>) + Send + Sync + Clone, diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index 82d26c92f1..2244fffd09 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -1,7 +1,6 @@ use std::{ collections::BTreeSet, fmt::{Debug, Write}, - result::Result, }; #[cfg(feature = "trace")] diff --git a/crates/bevy_pbr/Cargo.toml b/crates/bevy_pbr/Cargo.toml index 7e7dfc32d1..4fd611fa27 100644 --- a/crates/bevy_pbr/Cargo.toml +++ b/crates/bevy_pbr/Cargo.toml @@ -12,6 +12,9 @@ keywords = ["bevy"] webgl = [] webgpu = [] pbr_transmission_textures = [] +shader_format_glsl = ["bevy_render/shader_format_glsl"] +trace = ["bevy_render/trace"] +ios_simulator = ["bevy_render/ios_simulator"] [dependencies] # bevy diff --git a/crates/bevy_pbr/src/fog.rs b/crates/bevy_pbr/src/fog.rs index eacdf58c94..4a8af5a603 100644 --- a/crates/bevy_pbr/src/fog.rs +++ b/crates/bevy_pbr/src/fog.rs @@ -1,4 +1,3 @@ -use crate::ReflectComponent; use bevy_ecs::prelude::*; use bevy_math::Vec3; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; diff --git a/crates/bevy_pbr/src/light.rs b/crates/bevy_pbr/src/light.rs index a285f0a9cf..69a5958817 100644 --- a/crates/bevy_pbr/src/light.rs +++ b/crates/bevy_pbr/src/light.rs @@ -8,7 +8,6 @@ use bevy_math::{ use bevy_reflect::prelude::*; use bevy_render::{ camera::{Camera, CameraProjection}, - color::LegacyColor, extract_component::ExtractComponent, extract_resource::ExtractResource, primitives::{Aabb, CascadesFrusta, CubemapFrusta, Frustum, HalfSpace, Sphere}, diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 695f2db40b..57770c0448 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -1,6 +1,5 @@ use crate::*; -use bevy_app::{App, Plugin}; -use bevy_asset::{Asset, AssetApp, AssetEvent, AssetId, AssetServer, Assets, Handle}; +use bevy_asset::{Asset, AssetEvent, AssetId, AssetServer}; use bevy_core_pipeline::{ core_3d::{ AlphaMask3d, Camera3d, Opaque3d, ScreenSpaceTransmissionQuality, Transmissive3d, @@ -16,19 +15,17 @@ use bevy_ecs::{ }; use bevy_reflect::Reflect; use bevy_render::{ - camera::Projection, camera::TemporalJitter, extract_instances::{ExtractInstancesPlugin, ExtractedInstances}, extract_resource::ExtractResource, mesh::{Mesh, MeshVertexBufferLayout}, - prelude::Image, - render_asset::{prepare_assets, RenderAssets}, + render_asset::RenderAssets, render_phase::*, render_resource::*, renderer::RenderDevice, texture::FallbackImage, view::{ExtractedView, Msaa, VisibleEntities}, - Extract, ExtractSchedule, Render, RenderApp, RenderSet, + Extract, }; use bevy_utils::{tracing::error, HashMap, HashSet}; use std::marker::PhantomData; diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 29b271609c..c84dd6d077 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -1,10 +1,7 @@ -use bevy_asset::{Asset, Handle}; +use bevy_asset::Asset; use bevy_math::{Affine2, Vec2, Vec4}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -use bevy_render::{ - color::LegacyColor, mesh::MeshVertexBufferLayout, render_asset::RenderAssets, - render_resource::*, texture::Image, -}; +use bevy_render::{mesh::MeshVertexBufferLayout, render_asset::RenderAssets, render_resource::*}; use crate::deferred::DEFAULT_PBR_DEFERRED_LIGHTING_PASS_ID; use crate::*; diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index 8c2fb33d3b..6f44515341 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -3,8 +3,7 @@ mod prepass_bindings; use bevy_render::render_resource::binding_types::uniform_buffer; pub use prepass_bindings::*; -use bevy_app::{Plugin, PreUpdate}; -use bevy_asset::{load_internal_asset, AssetServer, Handle}; +use bevy_asset::{load_internal_asset, AssetServer}; use bevy_core_pipeline::{core_3d::CORE_3D_DEPTH_FORMAT, prelude::Camera3d}; use bevy_core_pipeline::{deferred::*, prepass::*}; use bevy_ecs::{ @@ -25,7 +24,7 @@ use bevy_render::{ render_resource::*, renderer::{RenderDevice, RenderQueue}, view::{ExtractedView, Msaa, ViewUniform, ViewUniformOffset, ViewUniforms, VisibleEntities}, - Extract, ExtractSchedule, Render, RenderApp, RenderSet, + Extract, }; use bevy_transform::prelude::GlobalTransform; use bevy_utils::tracing::error; diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index cc7cf9057c..1259665d58 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -4,7 +4,6 @@ use bevy_ecs::prelude::*; use bevy_math::{Mat4, UVec3, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles}; use bevy_render::{ camera::Camera, - color::LegacyColor, mesh::Mesh, primitives::{CascadesFrusta, CubemapFrusta, Frustum}, render_asset::RenderAssets, @@ -1213,7 +1212,7 @@ pub fn prepare_lights( // NOTE: iOS Simulator is missing CubeArray support so we use Cube instead. // See https://github.com/bevyengine/bevy/pull/12052 - remove if support is added. #[cfg(all( - not(ios_simulator), + not(feature = "ios_simulator"), any( not(feature = "webgl"), not(target_arch = "wasm32"), @@ -1222,7 +1221,7 @@ pub fn prepare_lights( ))] dimension: Some(TextureViewDimension::CubeArray), #[cfg(any( - ios_simulator, + feature = "ios_simulator", all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")) ))] dimension: Some(TextureViewDimension::Cube), diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index ab89ceb407..a512d4d8e0 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -1,11 +1,4 @@ -use crate::{ - AtomicMaterialBindGroupId, MaterialBindGroupId, NotShadowCaster, NotShadowReceiver, - PreviousGlobalTransform, Shadow, ViewFogUniformOffset, ViewLightProbesUniformOffset, - ViewLightsUniformOffset, CLUSTERED_FORWARD_STORAGE_BUFFER_COUNT, MAX_CASCADES_PER_LIGHT, - MAX_DIRECTIONAL_LIGHTS, -}; -use bevy_app::{Plugin, PostUpdate}; -use bevy_asset::{load_internal_asset, AssetId, Handle}; +use bevy_asset::{load_internal_asset, AssetId}; use bevy_core_pipeline::{ core_3d::{AlphaMask3d, Opaque3d, Transmissive3d, Transparent3d, CORE_3D_DEPTH_FORMAT}, deferred::{AlphaMask3dDeferred, Opaque3dDeferred}, @@ -28,11 +21,9 @@ use bevy_render::{ render_phase::{PhaseItem, RenderCommand, RenderCommandResult, TrackedRenderPass}, render_resource::*, renderer::{RenderDevice, RenderQueue}, - texture::{ - BevyDefault, DefaultImageSampler, GpuImage, Image, ImageSampler, TextureFormatPixelInfo, - }, + texture::{BevyDefault, DefaultImageSampler, GpuImage, ImageSampler, TextureFormatPixelInfo}, view::{ViewTarget, ViewUniformOffset, ViewVisibility}, - Extract, ExtractSchedule, Render, RenderApp, RenderSet, + Extract, }; use bevy_transform::components::GlobalTransform; use bevy_utils::{tracing::error, Entry, HashMap, Hashed}; @@ -46,8 +37,7 @@ use crate::render::{ morph::{ extract_morphs, no_automatic_morph_batching, prepare_morphs, MorphIndices, MorphUniform, }, - skin::{extract_skins, no_automatic_skin_batching, prepare_skins, SkinUniform}, - MeshLayouts, + skin::no_automatic_skin_batching, }; use crate::*; diff --git a/crates/bevy_pbr/src/render/mesh_view_bindings.rs b/crates/bevy_pbr/src/render/mesh_view_bindings.rs index e7d7a78c7a..7d8f129dab 100644 --- a/crates/bevy_pbr/src/render/mesh_view_bindings.rs +++ b/crates/bevy_pbr/src/render/mesh_view_bindings.rs @@ -23,12 +23,6 @@ use bevy_render::{ #[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))] use bevy_render::render_resource::binding_types::texture_cube; -#[cfg(any( - not(feature = "webgl"), - not(target_arch = "wasm32"), - feature = "webgpu" -))] -use bevy_render::render_resource::binding_types::{texture_2d_array, texture_cube_array}; use environment_map::EnvironmentMapLight; use crate::{ @@ -192,7 +186,7 @@ fn layout_entries( ( 2, #[cfg(all( - not(ios_simulator), + not(feature = "ios_simulator"), any( not(feature = "webgl"), not(target_arch = "wasm32"), @@ -201,7 +195,7 @@ fn layout_entries( ))] texture_cube_array(TextureSampleType::Depth), #[cfg(any( - ios_simulator, + feature = "ios_simulator", all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")) ))] texture_cube(TextureSampleType::Depth), diff --git a/crates/bevy_pbr/src/wireframe.rs b/crates/bevy_pbr/src/wireframe.rs index 563d952c1e..5f025ee429 100644 --- a/crates/bevy_pbr/src/wireframe.rs +++ b/crates/bevy_pbr/src/wireframe.rs @@ -4,11 +4,7 @@ use bevy_asset::{load_internal_asset, Asset, Assets, Handle}; use bevy_ecs::prelude::*; use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath}; use bevy_render::{ - color::LegacyColor, - extract_resource::ExtractResource, - mesh::{Mesh, MeshVertexBufferLayout}, - prelude::*, - render_resource::*, + extract_resource::ExtractResource, mesh::MeshVertexBufferLayout, prelude::*, render_resource::*, }; pub const WIREFRAME_SHADER_HANDLE: Handle = Handle::weak_from_u128(192598014480025766); diff --git a/crates/bevy_reflect/src/serde/de.rs b/crates/bevy_reflect/src/serde/de.rs index 6212a74d78..8fb1ad44ee 100644 --- a/crates/bevy_reflect/src/serde/de.rs +++ b/crates/bevy_reflect/src/serde/de.rs @@ -3,7 +3,7 @@ use crate::{ ArrayInfo, DynamicArray, DynamicEnum, DynamicList, DynamicMap, DynamicStruct, DynamicTuple, DynamicTupleStruct, DynamicVariant, EnumInfo, ListInfo, Map, MapInfo, NamedField, Reflect, ReflectDeserialize, StructInfo, StructVariantInfo, TupleInfo, TupleStructInfo, - TupleVariantInfo, TypeInfo, TypeRegistration, TypeRegistry, UnnamedField, VariantInfo, + TupleVariantInfo, TypeInfo, TypeRegistration, TypeRegistry, VariantInfo, }; use erased_serde::Deserializer; use serde::de::{ @@ -23,7 +23,6 @@ pub trait DeserializeValue { } trait StructLikeInfo { - fn get_path(&self) -> &str; fn get_field(&self, name: &str) -> Option<&NamedField>; fn field_at(&self, index: usize) -> Option<&NamedField>; fn get_field_len(&self) -> usize; @@ -31,8 +30,6 @@ trait StructLikeInfo { } trait TupleLikeInfo { - fn get_path(&self) -> &str; - fn get_field(&self, index: usize) -> Option<&UnnamedField>; fn get_field_len(&self) -> usize; } @@ -45,10 +42,6 @@ trait Container { } impl StructLikeInfo for StructInfo { - fn get_path(&self) -> &str { - self.type_path() - } - fn get_field(&self, name: &str) -> Option<&NamedField> { self.field(name) } @@ -84,10 +77,6 @@ impl Container for StructInfo { } impl StructLikeInfo for StructVariantInfo { - fn get_path(&self) -> &str { - self.name() - } - fn get_field(&self, name: &str) -> Option<&NamedField> { self.field(name) } @@ -123,14 +112,6 @@ impl Container for StructVariantInfo { } impl TupleLikeInfo for TupleInfo { - fn get_path(&self) -> &str { - self.type_path() - } - - fn get_field(&self, index: usize) -> Option<&UnnamedField> { - self.field_at(index) - } - fn get_field_len(&self) -> usize { self.field_len() } @@ -154,14 +135,6 @@ impl Container for TupleInfo { } impl TupleLikeInfo for TupleStructInfo { - fn get_path(&self) -> &str { - self.type_path() - } - - fn get_field(&self, index: usize) -> Option<&UnnamedField> { - self.field_at(index) - } - fn get_field_len(&self) -> usize { self.field_len() } @@ -185,14 +158,6 @@ impl Container for TupleStructInfo { } impl TupleLikeInfo for TupleVariantInfo { - fn get_path(&self) -> &str { - self.name() - } - - fn get_field(&self, index: usize) -> Option<&UnnamedField> { - self.field_at(index) - } - fn get_field_len(&self) -> usize { self.field_len() } diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 27351bd791..a89bf813ed 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -34,6 +34,7 @@ wgpu_trace = ["wgpu/trace"] ci_limits = [] webgl = ["wgpu/webgl"] webgpu = ["wgpu/webgpu"] +ios_simulator = [] [dependencies] # bevy diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 449702e6ec..4ac5c6d3be 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -3,7 +3,7 @@ use std::ops::{Div, DivAssign, Mul, MulAssign}; use crate::primitives::Frustum; use bevy_app::{App, Plugin, PostStartup, PostUpdate}; -use bevy_ecs::{prelude::*, reflect::ReflectComponent}; +use bevy_ecs::prelude::*; use bevy_math::{AspectRatio, Mat4, Rect, Vec2, Vec3A}; use bevy_reflect::{ std_traits::ReflectDefault, GetTypeRegistration, Reflect, ReflectDeserialize, ReflectSerialize, diff --git a/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs b/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs index f9d897159b..b877d38c02 100644 --- a/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs +++ b/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs @@ -354,7 +354,7 @@ pub mod binding_types { }; use encase::ShaderType; use std::num::NonZeroU64; - use wgpu::{BindingType, StorageTextureAccess, TextureFormat}; + use wgpu::{StorageTextureAccess, TextureFormat}; use super::*; diff --git a/crates/bevy_render/src/render_resource/pipeline_cache.rs b/crates/bevy_render/src/render_resource/pipeline_cache.rs index ab92102412..23822e5659 100644 --- a/crates/bevy_render/src/render_resource/pipeline_cache.rs +++ b/crates/bevy_render/src/render_resource/pipeline_cache.rs @@ -21,10 +21,7 @@ use std::{ use thiserror::Error; #[cfg(feature = "shader_format_spirv")] use wgpu::util::make_spirv; -use wgpu::{ - DownlevelFlags, Features, PipelineLayoutDescriptor, PushConstantRange, ShaderModuleDescriptor, - VertexBufferLayout as RawVertexBufferLayout, -}; +use wgpu::{DownlevelFlags, Features, VertexBufferLayout as RawVertexBufferLayout}; use crate::render_resource::resource_macros::*; @@ -288,7 +285,7 @@ impl ShaderCache { shader_defs.push("SIXTEEN_BYTE_ALIGNMENT".into()); } - if cfg!(ios_simulator) { + if cfg!(feature = "ios_simulator") { shader_defs.push("NO_CUBE_ARRAY_TEXTURES_SUPPORT".into()); } diff --git a/crates/bevy_render/src/render_resource/uniform_buffer.rs b/crates/bevy_render/src/render_resource/uniform_buffer.rs index 7666e7f6dd..72a673a503 100644 --- a/crates/bevy_render/src/render_resource/uniform_buffer.rs +++ b/crates/bevy_render/src/render_resource/uniform_buffer.rs @@ -277,7 +277,7 @@ impl DynamicUniformBuffer { device: &RenderDevice, queue: &'a RenderQueue, ) -> Option> { - let alignment = if cfg!(ios_simulator) { + let alignment = if cfg!(feature = "ios_simulator") { // On iOS simulator on silicon macs, metal validation check that the host OS alignment // is respected, but the device reports the correct value for iOS, which is smaller. // Use the larger value. diff --git a/crates/bevy_render/src/texture/fallback_image.rs b/crates/bevy_render/src/texture/fallback_image.rs index 0b80a87a6e..059cd32b2e 100644 --- a/crates/bevy_render/src/texture/fallback_image.rs +++ b/crates/bevy_render/src/texture/fallback_image.rs @@ -5,7 +5,6 @@ use bevy_ecs::{ system::{Resource, SystemParam}, }; use bevy_utils::HashMap; -use wgpu::{Extent3d, TextureFormat}; use crate::{ prelude::Image, diff --git a/crates/bevy_sprite/src/mesh2d/color_material.rs b/crates/bevy_sprite/src/mesh2d/color_material.rs index 899adf2560..2dcc378134 100644 --- a/crates/bevy_sprite/src/mesh2d/color_material.rs +++ b/crates/bevy_sprite/src/mesh2d/color_material.rs @@ -4,8 +4,7 @@ use bevy_asset::{load_internal_asset, Asset, AssetApp, Assets, Handle}; use bevy_math::Vec4; use bevy_reflect::prelude::*; use bevy_render::{ - color::LegacyColor, prelude::Shader, render_asset::RenderAssets, render_resource::*, - texture::Image, + color::LegacyColor, render_asset::RenderAssets, render_resource::*, texture::Image, }; pub const COLOR_MATERIAL_SHADER_HANDLE: Handle = diff --git a/crates/bevy_sprite/src/render/mod.rs b/crates/bevy_sprite/src/render/mod.rs index f998712451..96c1886765 100644 --- a/crates/bevy_sprite/src/render/mod.rs +++ b/crates/bevy_sprite/src/render/mod.rs @@ -24,7 +24,7 @@ use bevy_render::{ }, render_resource::{ binding_types::{sampler, texture_2d, uniform_buffer}, - BindGroupEntries, *, + *, }, renderer::{RenderDevice, RenderQueue}, texture::{ diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index a82d3edc4e..df6add7152 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -6,10 +6,7 @@ use bevy_core_pipeline::core_2d::graph::{Core2d, Node2d}; use bevy_core_pipeline::core_3d::graph::{Core3d, Node3d}; use bevy_core_pipeline::{core_2d::Camera2d, core_3d::Camera3d}; use bevy_hierarchy::Parent; -use bevy_render::{ - render_phase::PhaseItem, render_resource::BindGroupEntries, view::ViewVisibility, - ExtractSchedule, Render, -}; +use bevy_render::{render_phase::PhaseItem, view::ViewVisibility, ExtractSchedule, Render}; use bevy_sprite::{SpriteAssetEvents, TextureAtlas}; pub use pipeline::*; pub use render_pass::*; diff --git a/crates/bevy_ui/src/render/ui_material_pipeline.rs b/crates/bevy_ui/src/render/ui_material_pipeline.rs index 21dbe62f0c..2172b73ff4 100644 --- a/crates/bevy_ui/src/render/ui_material_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_material_pipeline.rs @@ -1,16 +1,13 @@ use std::{hash::Hash, marker::PhantomData, ops::Range}; -use bevy_app::{App, Plugin}; use bevy_asset::*; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::{ - prelude::{Component, Entity, EventReader}, - query::{ROQueryItem, With}, - schedule::IntoSystemConfigs, + prelude::Component, + query::ROQueryItem, storage::SparseSet, system::lifetimeless::{Read, SRes}, system::*, - world::{FromWorld, World}, }; use bevy_math::{Mat4, Rect, Vec2, Vec4Swizzles}; use bevy_render::{ @@ -22,7 +19,7 @@ use bevy_render::{ renderer::{RenderDevice, RenderQueue}, texture::{BevyDefault, FallbackImage, Image}, view::*, - Extract, ExtractSchedule, Render, RenderApp, RenderSet, + Extract, ExtractSchedule, Render, RenderSet, }; use bevy_transform::prelude::GlobalTransform; use bevy_utils::{FloatOrd, HashMap, HashSet}; diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index d778d18162..c485f50954 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -20,7 +20,7 @@ pub use winit_config::*; pub use winit_windows::*; use bevy_app::{App, AppExit, Last, Plugin, PluginsState}; -use bevy_ecs::event::{Events, ManualEventReader}; +use bevy_ecs::event::ManualEventReader; use bevy_ecs::prelude::*; use bevy_ecs::system::SystemState; use bevy_input::{ diff --git a/examples/mobile/.cargo/config.toml b/examples/mobile/.cargo/config.toml index 19a634093d..27767cc6e1 100644 --- a/examples/mobile/.cargo/config.toml +++ b/examples/mobile/.cargo/config.toml @@ -2,4 +2,4 @@ # This needs some workarounds for now # See https://github.com/bevyengine/bevy/pull/10178 - remove if it's not needed anymore. [target.aarch64-apple-ios-sim] -rustflags = ["--cfg=ios_simulator"] +features = ["bevy_render/ios_simulator"] diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index 173d6af9de..c01112987b 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -16,6 +16,7 @@ bitflags! { const BENCH_CHECK = 0b01000000; const EXAMPLE_CHECK = 0b10000000; const COMPILE_CHECK = 0b100000000; + const CFG_CHECK = 0b1000000000; } } @@ -38,6 +39,7 @@ fn main() { ("compile-fail", Check::COMPILE_FAIL), ("bench-check", Check::BENCH_CHECK), ("example-check", Check::EXAMPLE_CHECK), + ("cfg-check", Check::CFG_CHECK), ("doc-check", Check::DOC_CHECK), ("doc-test", Check::DOC_TEST), ]; @@ -155,4 +157,12 @@ fn main() { .run() .expect("Please fix compiler errors in output above."); } + + if what_to_run.contains(Check::CFG_CHECK) { + // Check cfg and imports + std::env::set_var("RUSTFLAGS", "-D warnings"); + cmd!(sh, "cargo check -Zcheck-cfg --workspace") + .run() + .expect("Please fix failing cfg checks in output above."); + } }