Remove tracing re-export from bevy_utils (#17161)
# Objective - Contributes to #11478 ## Solution - Made `bevy_utils::tracing` `doc(hidden)` - Re-exported `tracing` from `bevy_log` for end-users - Added `tracing` directly to crates that need it. ## Testing - CI --- ## Migration Guide If you were importing `tracing` via `bevy::utils::tracing`, instead use `bevy::log::tracing`. Note that many items within `tracing` are also directly re-exported from `bevy::log` as well, so you may only need `bevy::log` for the most common items (e.g., `warn!`, `trace!`, etc.). This also applies to the `log_once!` family of macros. ## Notes - While this doesn't reduce the line-count in `bevy_utils`, it further decouples the internal crates from `bevy_utils`, making its eventual removal more feasible in the future. - I have just imported `tracing` as we do for all dependencies. However, a workspace dependency may be more appropriate for version management.
This commit is contained in:
parent
0e36abc180
commit
a371ee3019
@ -39,6 +39,7 @@ either = "1.13"
|
||||
thread_local = "1"
|
||||
uuid = { version = "1.7", features = ["v4"] }
|
||||
smallvec = "1"
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -44,13 +44,11 @@ use bevy_math::FloatOrd;
|
||||
use bevy_reflect::{prelude::ReflectDefault, Reflect, TypePath};
|
||||
use bevy_time::Time;
|
||||
use bevy_transform::TransformSystem;
|
||||
use bevy_utils::{
|
||||
tracing::{trace, warn},
|
||||
HashMap, NoOpHash, PreHashMap, PreHashMapExt, TypeIdMap,
|
||||
};
|
||||
use bevy_utils::{HashMap, NoOpHash, PreHashMap, PreHashMapExt, TypeIdMap};
|
||||
use petgraph::graph::NodeIndex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thread_local::ThreadLocal;
|
||||
use tracing::{trace, warn};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// The animation prelude.
|
||||
|
||||
@ -47,6 +47,7 @@ serde = { version = "1", features = ["derive"] }
|
||||
thiserror = { version = "2", default-features = false }
|
||||
derive_more = { version = "1", default-features = false, features = ["from"] }
|
||||
uuid = { version = "1.0", features = ["v4"] }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
bevy_window = { path = "../bevy_window", version = "0.15.0-dev" }
|
||||
|
||||
@ -13,10 +13,10 @@ use bevy_ecs::{
|
||||
storage::{Table, TableRow},
|
||||
world::unsafe_world_cell::UnsafeWorldCell,
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use bevy_utils::HashMap;
|
||||
use core::marker::PhantomData;
|
||||
use disqualified::ShortName;
|
||||
use tracing::error;
|
||||
|
||||
/// A resource that stores the last tick an asset was changed. This is used by
|
||||
/// the [`AssetChanged`] filter to determine if an asset has changed since the last time
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use crate::io::{get_meta_path, AssetReader, AssetReaderError, PathStream, Reader, VecReader};
|
||||
use bevy_utils::tracing::error;
|
||||
use futures_lite::stream;
|
||||
use std::{ffi::CString, path::Path};
|
||||
use tracing::error;
|
||||
|
||||
/// [`AssetReader`] implementation for Android devices, built on top of Android's [`AssetManager`].
|
||||
///
|
||||
|
||||
@ -4,7 +4,7 @@ use crate::io::{
|
||||
AssetSourceEvent, AssetWatcher,
|
||||
};
|
||||
use alloc::sync::Arc;
|
||||
use bevy_utils::{tracing::warn, HashMap};
|
||||
use bevy_utils::HashMap;
|
||||
use core::time::Duration;
|
||||
use notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, RecommendedCache};
|
||||
use parking_lot::RwLock;
|
||||
@ -13,6 +13,7 @@ use std::{
|
||||
io::{BufReader, Read},
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use tracing::warn;
|
||||
|
||||
/// A watcher for assets stored in the `embedded` asset source. Embedded assets are assets whose
|
||||
/// bytes have been embedded into the Rust binary using the [`embedded_asset`](crate::embedded_asset) macro.
|
||||
|
||||
@ -2,7 +2,6 @@ use crate::{
|
||||
io::{AssetSourceEvent, AssetWatcher},
|
||||
path::normalize_path,
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use core::time::Duration;
|
||||
use crossbeam_channel::Sender;
|
||||
use notify_debouncer_full::{
|
||||
@ -15,6 +14,7 @@ use notify_debouncer_full::{
|
||||
DebounceEventResult, Debouncer, RecommendedCache,
|
||||
};
|
||||
use std::path::{Path, PathBuf};
|
||||
use tracing::error;
|
||||
|
||||
/// An [`AssetWatcher`] that watches the filesystem for changes to asset files in a given root folder and emits [`AssetSourceEvent`]
|
||||
/// for each relevant change. This uses [`notify_debouncer_full`] to retrieve "debounced" filesystem events.
|
||||
|
||||
@ -6,9 +6,9 @@ mod file_asset;
|
||||
#[cfg(not(feature = "multi_threaded"))]
|
||||
mod sync_file_asset;
|
||||
|
||||
use bevy_utils::tracing::{debug, error};
|
||||
#[cfg(feature = "file_watcher")]
|
||||
pub use file_watcher::*;
|
||||
use tracing::{debug, error};
|
||||
|
||||
use std::{
|
||||
env,
|
||||
|
||||
@ -5,10 +5,10 @@ use crate::{
|
||||
};
|
||||
use alloc::sync::Arc;
|
||||
use async_lock::RwLockReadGuardArc;
|
||||
use bevy_utils::tracing::trace;
|
||||
use core::{pin::Pin, task::Poll};
|
||||
use futures_io::AsyncRead;
|
||||
use std::path::Path;
|
||||
use tracing::trace;
|
||||
|
||||
use super::{AsyncSeekForward, ErasedAssetReader};
|
||||
|
||||
|
||||
@ -5,12 +5,10 @@ use crate::{
|
||||
use alloc::sync::Arc;
|
||||
use atomicow::CowArc;
|
||||
use bevy_ecs::system::Resource;
|
||||
use bevy_utils::{
|
||||
tracing::{error, warn},
|
||||
HashMap,
|
||||
};
|
||||
use bevy_utils::HashMap;
|
||||
use core::{fmt::Display, hash::Hash, time::Duration};
|
||||
use thiserror::Error;
|
||||
use tracing::{error, warn};
|
||||
|
||||
use super::{ErasedAssetReader, ErasedAssetWriter};
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use crate::io::{
|
||||
get_meta_path, AssetReader, AssetReaderError, EmptyPathStream, PathStream, Reader, VecReader,
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use js_sys::{Uint8Array, JSON};
|
||||
use std::path::{Path, PathBuf};
|
||||
use tracing::error;
|
||||
use wasm_bindgen::{prelude::wasm_bindgen, JsCast, JsValue};
|
||||
use wasm_bindgen_futures::JsFuture;
|
||||
use web_sys::Response;
|
||||
|
||||
@ -215,8 +215,9 @@ use bevy_ecs::{
|
||||
world::FromWorld,
|
||||
};
|
||||
use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath};
|
||||
use bevy_utils::{tracing::error, HashSet};
|
||||
use bevy_utils::HashSet;
|
||||
use core::any::TypeId;
|
||||
use tracing::error;
|
||||
|
||||
#[cfg(all(feature = "file_watcher", not(feature = "multi_threaded")))]
|
||||
compile_error!(
|
||||
|
||||
@ -2,10 +2,10 @@ use crate::{
|
||||
self as bevy_asset, loader::AssetLoader, processor::Process, Asset, AssetPath,
|
||||
DeserializeMetaError, VisitAssetDependencies,
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use downcast_rs::{impl_downcast, Downcast};
|
||||
use ron::ser::PrettyConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::error;
|
||||
|
||||
pub const META_FORMAT_VERSION: &str = "1.0";
|
||||
pub type MetaTransform = Box<dyn Fn(&mut dyn AssetMetaDyn) + Send + Sync>;
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
use crate::AssetPath;
|
||||
use async_fs::File;
|
||||
use bevy_utils::{tracing::error, HashSet};
|
||||
use bevy_utils::HashSet;
|
||||
use futures_lite::{AsyncReadExt, AsyncWriteExt};
|
||||
use std::path::PathBuf;
|
||||
use thiserror::Error;
|
||||
use tracing::error;
|
||||
|
||||
/// An in-memory representation of a single [`ProcessorTransactionLog`] entry.
|
||||
#[derive(Debug)]
|
||||
|
||||
@ -61,17 +61,15 @@ use bevy_ecs::prelude::*;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_tasks::ConditionalSendFuture;
|
||||
use bevy_tasks::IoTaskPool;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::{info_span, instrument::Instrument};
|
||||
use bevy_utils::{
|
||||
tracing::{debug, error, trace, warn},
|
||||
HashMap, HashSet,
|
||||
};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use futures_io::ErrorKind;
|
||||
use futures_lite::{AsyncReadExt, AsyncWriteExt, StreamExt};
|
||||
use parking_lot::RwLock;
|
||||
use std::path::{Path, PathBuf};
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, error, trace, warn};
|
||||
#[cfg(feature = "trace")]
|
||||
use tracing::{info_span, instrument::Instrument};
|
||||
|
||||
/// A "background" asset processor that reads asset values from a source [`AssetSource`] (which corresponds to an [`AssetReader`](crate::io::AssetReader) / [`AssetWriter`](crate::io::AssetWriter) pair),
|
||||
/// processes them in some way, and writes them to a destination [`AssetSource`].
|
||||
|
||||
@ -7,11 +7,12 @@ use crate::{
|
||||
use alloc::sync::{Arc, Weak};
|
||||
use bevy_ecs::world::World;
|
||||
use bevy_tasks::Task;
|
||||
use bevy_utils::{tracing::warn, Entry, HashMap, HashSet, TypeIdMap};
|
||||
use bevy_utils::{Entry, HashMap, HashSet, TypeIdMap};
|
||||
use core::{any::TypeId, task::Waker};
|
||||
use crossbeam_channel::Sender;
|
||||
use either::Either;
|
||||
use thiserror::Error;
|
||||
use tracing::warn;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct AssetInfo {
|
||||
|
||||
@ -7,11 +7,12 @@ use async_broadcast::RecvError;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_tasks::ConditionalSendFuture;
|
||||
use bevy_tasks::IoTaskPool;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::{info_span, instrument::Instrument};
|
||||
use bevy_utils::{tracing::warn, HashMap, TypeIdMap};
|
||||
use bevy_utils::{HashMap, TypeIdMap};
|
||||
use core::any::TypeId;
|
||||
use thiserror::Error;
|
||||
use tracing::warn;
|
||||
#[cfg(feature = "trace")]
|
||||
use tracing::{info_span, instrument::Instrument};
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct AssetLoaders {
|
||||
|
||||
@ -21,10 +21,7 @@ use alloc::sync::Arc;
|
||||
use atomicow::CowArc;
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_tasks::IoTaskPool;
|
||||
use bevy_utils::{
|
||||
tracing::{error, info},
|
||||
HashSet,
|
||||
};
|
||||
use bevy_utils::HashSet;
|
||||
use core::{any::TypeId, future::Future, panic::AssertUnwindSafe, task::Poll};
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use either::Either;
|
||||
@ -34,6 +31,7 @@ use loaders::*;
|
||||
use parking_lot::{RwLock, RwLockWriteGuard};
|
||||
use std::path::{Path, PathBuf};
|
||||
use thiserror::Error;
|
||||
use tracing::{error, info};
|
||||
|
||||
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`](crate::io::AssetReader). This can be used to kick off new asset loads and
|
||||
/// retrieve their current load states.
|
||||
|
||||
@ -20,10 +20,10 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [
|
||||
] }
|
||||
bevy_transform = { path = "../bevy_transform", version = "0.15.0-dev" }
|
||||
bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||
|
||||
# other
|
||||
rodio = { version = "0.20", default-features = false }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
cpal = { version = "0.15", optional = true }
|
||||
|
||||
@ -7,8 +7,8 @@ use bevy_ecs::{prelude::*, system::SystemParam};
|
||||
use bevy_hierarchy::DespawnRecursiveExt;
|
||||
use bevy_math::Vec3;
|
||||
use bevy_transform::prelude::GlobalTransform;
|
||||
use bevy_utils::tracing::warn;
|
||||
use rodio::{OutputStream, OutputStreamHandle, Sink, Source, SpatialSink};
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{AudioSink, AudioSinkPlayback};
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ radsort = "0.1"
|
||||
nonmax = "0.5"
|
||||
smallvec = "1"
|
||||
thiserror = { version = "2", default-features = false }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -9,9 +9,9 @@ use bevy_render::{
|
||||
renderer::RenderContext,
|
||||
view::{ViewDepthTexture, ViewTarget},
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use tracing::info_span;
|
||||
|
||||
use super::AlphaMask2d;
|
||||
|
||||
|
||||
@ -9,9 +9,9 @@ use bevy_render::{
|
||||
renderer::RenderContext,
|
||||
view::{ViewDepthTexture, ViewTarget},
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use tracing::info_span;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MainTransparentPass2dNode {}
|
||||
|
||||
@ -12,9 +12,9 @@ use bevy_render::{
|
||||
renderer::RenderContext,
|
||||
view::{ViewDepthTexture, ViewTarget, ViewUniformOffset},
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use tracing::info_span;
|
||||
|
||||
use super::AlphaMask3d;
|
||||
|
||||
|
||||
@ -9,10 +9,10 @@ use bevy_render::{
|
||||
renderer::RenderContext,
|
||||
view::{ViewDepthTexture, ViewTarget},
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use core::ops::Range;
|
||||
use tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use tracing::info_span;
|
||||
|
||||
/// A [`bevy_render::render_graph::Node`] that runs the [`Transmissive3d`]
|
||||
/// [`ViewSortedRenderPhases`].
|
||||
|
||||
@ -9,9 +9,9 @@ use bevy_render::{
|
||||
renderer::RenderContext,
|
||||
view::{ViewDepthTexture, ViewTarget},
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use tracing::info_span;
|
||||
|
||||
/// A [`bevy_render::render_graph::Node`] that runs the [`Transparent3d`]
|
||||
/// [`ViewSortedRenderPhases`].
|
||||
|
||||
@ -101,8 +101,9 @@ use bevy_render::{
|
||||
view::{ExtractedView, ViewDepthTexture, ViewTarget},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{tracing::warn, HashMap};
|
||||
use bevy_utils::HashMap;
|
||||
use nonmax::NonMaxU32;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{
|
||||
core_3d::main_transmissive_pass_3d_node::MainTransmissivePass3dNode,
|
||||
|
||||
@ -9,9 +9,9 @@ use bevy_render::{
|
||||
renderer::RenderContext,
|
||||
view::ViewDepthTexture,
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use tracing::info_span;
|
||||
|
||||
use crate::prepass::ViewPrepassTextures;
|
||||
|
||||
|
||||
@ -56,8 +56,9 @@ use bevy_render::{
|
||||
},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{info_once, prelude::default, warn_once};
|
||||
use bevy_utils::{default, once};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::{info, warn};
|
||||
|
||||
use crate::{
|
||||
core_3d::{
|
||||
@ -381,7 +382,9 @@ impl ViewNode for DepthOfFieldNode {
|
||||
auxiliary_dof_texture,
|
||||
view_bind_group_layouts.dual_input.as_ref(),
|
||||
) else {
|
||||
warn_once!("Should have created the auxiliary depth of field texture by now");
|
||||
once!(warn!(
|
||||
"Should have created the auxiliary depth of field texture by now"
|
||||
));
|
||||
continue;
|
||||
};
|
||||
render_context.render_device().create_bind_group(
|
||||
@ -423,7 +426,9 @@ impl ViewNode for DepthOfFieldNode {
|
||||
// `prepare_auxiliary_depth_of_field_textures``.
|
||||
if pipeline_render_info.is_dual_output {
|
||||
let Some(auxiliary_dof_texture) = auxiliary_dof_texture else {
|
||||
warn_once!("Should have created the auxiliary depth of field texture by now");
|
||||
once!(warn!(
|
||||
"Should have created the auxiliary depth of field texture by now"
|
||||
));
|
||||
continue;
|
||||
};
|
||||
color_attachments.push(Some(RenderPassColorAttachment {
|
||||
@ -815,9 +820,9 @@ fn extract_depth_of_field_settings(
|
||||
mut query: Extract<Query<(RenderEntity, &DepthOfField, &Projection)>>,
|
||||
) {
|
||||
if !DEPTH_TEXTURE_SAMPLING_SUPPORTED {
|
||||
info_once!(
|
||||
once!(info!(
|
||||
"Disabling depth of field on this platform because depth textures aren't supported correctly"
|
||||
);
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -16,15 +16,13 @@ use bevy_render::{
|
||||
view::Msaa,
|
||||
Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{
|
||||
tracing::{trace, warn},
|
||||
HashSet, Instant,
|
||||
};
|
||||
use bevy_utils::{HashSet, Instant};
|
||||
use bevy_window::PrimaryWindow;
|
||||
use resolve::{
|
||||
node::{OitResolveNode, OitResolvePass},
|
||||
OitResolvePlugin,
|
||||
};
|
||||
use tracing::{trace, warn};
|
||||
|
||||
use crate::core_3d::{
|
||||
graph::{Core3d, Node3d},
|
||||
|
||||
@ -22,7 +22,7 @@ use bevy_render::{
|
||||
view::{ExtractedView, ViewTarget, ViewUniform, ViewUniforms},
|
||||
Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::tracing::warn;
|
||||
use tracing::warn;
|
||||
|
||||
use super::OitBuffers;
|
||||
|
||||
|
||||
@ -8,9 +8,9 @@ use bevy_render::{
|
||||
renderer::RenderContext,
|
||||
view::{ViewDepthTexture, ViewUniformOffset},
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use tracing::info_span;
|
||||
|
||||
use crate::skybox::prepass::{RenderSkyboxPrepassPipeline, SkyboxPrepassBindGroup};
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ use bevy_render::{
|
||||
view::{ExtractedView, Msaa, ViewTarget},
|
||||
ExtractSchedule, MainWorld, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::tracing::warn;
|
||||
use tracing::warn;
|
||||
|
||||
const TAA_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(656865235226276);
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@ use bevy_render::{
|
||||
view::{ExtractedView, ViewTarget, ViewUniform},
|
||||
Render, RenderApp, RenderSet,
|
||||
};
|
||||
#[cfg(not(feature = "tonemapping_luts"))]
|
||||
use bevy_utils::tracing::error;
|
||||
use bitflags::bitflags;
|
||||
#[cfg(not(feature = "tonemapping_luts"))]
|
||||
use tracing::error;
|
||||
|
||||
mod node;
|
||||
|
||||
|
||||
@ -24,13 +24,13 @@ bevy_render = { path = "../bevy_render", version = "0.15.0-dev" }
|
||||
bevy_time = { path = "../bevy_time", version = "0.15.0-dev" }
|
||||
bevy_text = { path = "../bevy_text", version = "0.15.0-dev" }
|
||||
bevy_ui = { path = "../bevy_ui", version = "0.15.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||
bevy_window = { path = "../bevy_window", version = "0.15.0-dev" }
|
||||
bevy_state = { path = "../bevy_state", version = "0.15.0-dev" }
|
||||
|
||||
# other
|
||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
ron = { version = "0.8.0", optional = true }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -2,7 +2,7 @@ use super::config::*;
|
||||
use bevy_app::AppExit;
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_render::view::screenshot::{save_to_disk, Screenshot};
|
||||
use bevy_utils::tracing::{debug, info};
|
||||
use tracing::{debug, info};
|
||||
|
||||
pub(crate) fn send_events(world: &mut World, mut current_frame: Local<u32>) {
|
||||
let mut config = world.resource_mut::<CiTestingConfig>();
|
||||
|
||||
@ -19,7 +19,6 @@ use bevy_ui::{
|
||||
widget::{Text, TextUiWriter},
|
||||
GlobalZIndex, Node, PositionType,
|
||||
};
|
||||
use bevy_utils::default;
|
||||
|
||||
/// [`GlobalZIndex`] used to render the fps overlay.
|
||||
///
|
||||
@ -74,7 +73,7 @@ impl Default for FpsOverlayConfig {
|
||||
text_config: TextFont {
|
||||
font: Handle::<Font>::default(),
|
||||
font_size: 32.0,
|
||||
..default()
|
||||
..Default::default()
|
||||
},
|
||||
text_color: Color::WHITE,
|
||||
enabled: true,
|
||||
@ -91,7 +90,7 @@ fn setup(mut commands: Commands, overlay_config: Res<FpsOverlayConfig>) {
|
||||
Node {
|
||||
// We need to make sure the overlay doesn't affect the position of other UI nodes
|
||||
position_type: PositionType::Absolute,
|
||||
..default()
|
||||
..Default::default()
|
||||
},
|
||||
// Render overlay on top of everything
|
||||
GlobalZIndex(FPS_OVERLAY_ZINDEX),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
use bevy_ecs::event::EventReader;
|
||||
use bevy_state::state::{StateTransitionEvent, States};
|
||||
use bevy_utils::tracing::info;
|
||||
use tracing::info;
|
||||
|
||||
/// Logs state transitions into console.
|
||||
///
|
||||
|
||||
@ -22,8 +22,10 @@ bevy_time = { path = "../bevy_time", version = "0.15.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||
bevy_tasks = { path = "../bevy_tasks", version = "0.15.0-dev" }
|
||||
|
||||
# other
|
||||
const-fnv1a-hash = "1.1.0"
|
||||
serde = { version = "1.0", optional = true }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
# macOS
|
||||
[target.'cfg(all(target_os="macos"))'.dependencies]
|
||||
|
||||
@ -2,8 +2,8 @@ use super::{Diagnostic, DiagnosticPath, DiagnosticsStore};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_time::{Real, Time, Timer, TimerMode};
|
||||
use bevy_utils::tracing::{debug, info};
|
||||
use core::time::Duration;
|
||||
use tracing::{debug, info};
|
||||
|
||||
/// An App Plugin that logs diagnostics to the console.
|
||||
///
|
||||
|
||||
@ -66,8 +66,8 @@ pub mod internal {
|
||||
use bevy_app::{App, First, Startup, Update};
|
||||
use bevy_ecs::system::Resource;
|
||||
use bevy_tasks::{available_parallelism, block_on, poll_once, AsyncComputeTaskPool, Task};
|
||||
use bevy_utils::tracing::info;
|
||||
use sysinfo::{CpuRefreshKind, MemoryRefreshKind, RefreshKind, System};
|
||||
use tracing::info;
|
||||
|
||||
use crate::{Diagnostic, Diagnostics, DiagnosticsStore};
|
||||
|
||||
@ -210,7 +210,7 @@ pub mod internal {
|
||||
}
|
||||
|
||||
fn setup_system() {
|
||||
bevy_utils::tracing::warn!("This platform and/or configuration is not supported!");
|
||||
tracing::warn!("This platform and/or configuration is not supported!");
|
||||
}
|
||||
|
||||
impl Default for super::SystemInfo {
|
||||
|
||||
@ -32,7 +32,7 @@ reflect_functions = ["bevy_reflect", "bevy_reflect/functions"]
|
||||
|
||||
## Enables `tracing` integration, allowing spans and other metrics to be reported
|
||||
## through that framework.
|
||||
trace = ["std", "dep:tracing", "bevy_utils/tracing"]
|
||||
trace = ["std", "dep:tracing"]
|
||||
|
||||
## Enables a more detailed set of traces which may be noisy if left on by default.
|
||||
detailed_trace = ["trace"]
|
||||
|
||||
@ -13,11 +13,11 @@ use crate::{
|
||||
};
|
||||
|
||||
use alloc::vec::Vec;
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::Span;
|
||||
use core::{fmt, mem::MaybeUninit, ptr};
|
||||
use fixedbitset::FixedBitSet;
|
||||
use log::warn;
|
||||
#[cfg(feature = "trace")]
|
||||
use tracing::Span;
|
||||
|
||||
use super::{
|
||||
NopWorldQuery, QueryBuilder, QueryData, QueryEntityError, QueryFilter, QueryManyIter,
|
||||
|
||||
@ -19,6 +19,7 @@ bevy_time = { path = "../bevy_time", version = "0.15.0-dev" }
|
||||
# other
|
||||
gilrs = "0.11.0"
|
||||
thiserror = { version = "2", default-features = false }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -18,10 +18,11 @@ use bevy_app::{App, Plugin, PostUpdate, PreStartup, PreUpdate};
|
||||
use bevy_ecs::entity::EntityHashMap;
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_input::InputSystem;
|
||||
use bevy_utils::{synccell::SyncCell, tracing::error, HashMap};
|
||||
use bevy_utils::{synccell::SyncCell, HashMap};
|
||||
use gilrs::GilrsBuilder;
|
||||
use gilrs_system::{gilrs_event_startup_system, gilrs_event_system};
|
||||
use rumble::{play_gilrs_rumble, RunningRumbleEffects};
|
||||
use tracing::error;
|
||||
|
||||
#[cfg_attr(not(target_arch = "wasm32"), derive(Resource))]
|
||||
pub(crate) struct Gilrs(pub SyncCell<gilrs::Gilrs>);
|
||||
|
||||
@ -5,17 +5,14 @@ use bevy_ecs::prelude::{EventReader, Res, ResMut, Resource};
|
||||
use bevy_ecs::system::NonSendMut;
|
||||
use bevy_input::gamepad::{GamepadRumbleIntensity, GamepadRumbleRequest};
|
||||
use bevy_time::{Real, Time};
|
||||
use bevy_utils::{
|
||||
synccell::SyncCell,
|
||||
tracing::{debug, warn},
|
||||
HashMap,
|
||||
};
|
||||
use bevy_utils::{synccell::SyncCell, HashMap};
|
||||
use core::time::Duration;
|
||||
use gilrs::{
|
||||
ff::{self, BaseEffect, BaseEffectType, Repeat, Replay},
|
||||
GamepadId,
|
||||
};
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
/// A rumble effect that is currently in effect.
|
||||
struct RunningRumble {
|
||||
|
||||
@ -31,7 +31,9 @@ bevy_transform = { path = "../bevy_transform", version = "0.15.0-dev" }
|
||||
bevy_gizmos_macros = { path = "macros", version = "0.15.0-dev" }
|
||||
bevy_time = { path = "../bevy_time", version = "0.15.0-dev" }
|
||||
|
||||
# other
|
||||
bytemuck = "1.0"
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -189,16 +189,16 @@ impl Plugin for GizmoPlugin {
|
||||
if app.is_plugin_added::<bevy_sprite::SpritePlugin>() {
|
||||
app.add_plugins(pipeline_2d::LineGizmo2dPlugin);
|
||||
} else {
|
||||
bevy_utils::tracing::warn!("bevy_sprite feature is enabled but bevy_sprite::SpritePlugin was not detected. Are you sure you loaded GizmoPlugin after SpritePlugin?");
|
||||
tracing::warn!("bevy_sprite feature is enabled but bevy_sprite::SpritePlugin was not detected. Are you sure you loaded GizmoPlugin after SpritePlugin?");
|
||||
}
|
||||
#[cfg(feature = "bevy_pbr")]
|
||||
if app.is_plugin_added::<bevy_pbr::PbrPlugin>() {
|
||||
app.add_plugins(pipeline_3d::LineGizmo3dPlugin);
|
||||
} else {
|
||||
bevy_utils::tracing::warn!("bevy_pbr feature is enabled but bevy_pbr::PbrPlugin was not detected. Are you sure you loaded GizmoPlugin after PbrPlugin?");
|
||||
tracing::warn!("bevy_pbr feature is enabled but bevy_pbr::PbrPlugin was not detected. Are you sure you loaded GizmoPlugin after PbrPlugin?");
|
||||
}
|
||||
} else {
|
||||
bevy_utils::tracing::warn!("bevy_render feature is enabled but RenderApp was not detected. Are you sure you loaded GizmoPlugin after RenderPlugin?");
|
||||
tracing::warn!("bevy_render feature is enabled but RenderApp was not detected. Are you sure you loaded GizmoPlugin after RenderPlugin?");
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,8 +419,9 @@ fn extract_gizmo_data(
|
||||
handles: Extract<Res<GizmoHandles>>,
|
||||
config: Extract<Res<GizmoConfigStore>>,
|
||||
) {
|
||||
use bevy_utils::warn_once;
|
||||
use bevy_utils::once;
|
||||
use config::GizmoLineStyle;
|
||||
use tracing::warn;
|
||||
|
||||
for (group_type_id, handle) in &handles.handles {
|
||||
let Some((config, _)) = config.get_config_dyn(group_type_id) else {
|
||||
@ -447,10 +448,10 @@ fn extract_gizmo_data(
|
||||
} = config.line.style
|
||||
{
|
||||
if gap_scale <= 0.0 {
|
||||
warn_once!("When using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the gap scale should be greater than zero.");
|
||||
once!(warn!("When using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the gap scale should be greater than zero."));
|
||||
}
|
||||
if line_scale <= 0.0 {
|
||||
warn_once!("When using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the line scale should be greater than zero.");
|
||||
once!(warn!("When using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the line scale should be greater than zero."));
|
||||
}
|
||||
(gap_scale, line_scale)
|
||||
} else {
|
||||
|
||||
@ -27,7 +27,7 @@ use bevy_render::{
|
||||
Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_sprite::{Mesh2dPipeline, Mesh2dPipelineKey, SetMesh2dViewBindGroup};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
|
||||
pub struct LineGizmo2dPlugin;
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ use bevy_render::{
|
||||
view::{ExtractedView, Msaa, RenderLayers, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
|
||||
pub struct LineGizmo3dPlugin;
|
||||
impl Plugin for LineGizmo3dPlugin {
|
||||
|
||||
@ -106,7 +106,8 @@ pub(crate) fn extract_linegizmos(
|
||||
) {
|
||||
use bevy_math::Affine3;
|
||||
use bevy_render::sync_world::{MainEntity, TemporaryRenderEntity};
|
||||
use bevy_utils::warn_once;
|
||||
use bevy_utils::once;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::config::GizmoLineStyle;
|
||||
|
||||
@ -124,10 +125,10 @@ pub(crate) fn extract_linegizmos(
|
||||
} = gizmo.line_config.style
|
||||
{
|
||||
if gap_scale <= 0.0 {
|
||||
warn_once!("when using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the gap scale should be greater than zero");
|
||||
once!(warn!("when using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the gap scale should be greater than zero"));
|
||||
}
|
||||
if line_scale <= 0.0 {
|
||||
warn_once!("when using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the line scale should be greater than zero");
|
||||
once!(warn!("when using gizmos with the line style `GizmoLineStyle::Dashed{{..}}` the line scale should be greater than zero"));
|
||||
}
|
||||
(gap_scale, line_scale)
|
||||
} else {
|
||||
|
||||
@ -59,6 +59,7 @@ percent-encoding = "2.1"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
smallvec = "1.11"
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[dev-dependencies]
|
||||
bevy_log = { path = "../bevy_log", version = "0.15.0-dev" }
|
||||
|
||||
@ -41,10 +41,7 @@ use bevy_scene::Scene;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use bevy_tasks::IoTaskPool;
|
||||
use bevy_transform::components::Transform;
|
||||
use bevy_utils::{
|
||||
tracing::{error, info_span, warn},
|
||||
HashMap, HashSet,
|
||||
};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use gltf::{
|
||||
accessor::Iter,
|
||||
image::Source,
|
||||
@ -60,6 +57,7 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use thiserror::Error;
|
||||
use tracing::{error, info_span, warn};
|
||||
#[cfg(feature = "bevy_animation")]
|
||||
use {
|
||||
bevy_animation::{prelude::*, AnimationTarget, AnimationTargetId},
|
||||
@ -704,17 +702,15 @@ async fn load_gltf<'a, 'b, 'c>(
|
||||
if mesh.attribute(Mesh::ATTRIBUTE_NORMAL).is_none()
|
||||
&& matches!(mesh.primitive_topology(), PrimitiveTopology::TriangleList)
|
||||
{
|
||||
bevy_utils::tracing::debug!(
|
||||
"Automatically calculating missing vertex normals for geometry."
|
||||
);
|
||||
tracing::debug!("Automatically calculating missing vertex normals for geometry.");
|
||||
let vertex_count_before = mesh.count_vertices();
|
||||
mesh.duplicate_vertices();
|
||||
mesh.compute_flat_normals();
|
||||
let vertex_count_after = mesh.count_vertices();
|
||||
if vertex_count_before != vertex_count_after {
|
||||
bevy_utils::tracing::debug!("Missing vertex normals in indexed geometry, computing them as flat. Vertex count increased from {} to {}", vertex_count_before, vertex_count_after);
|
||||
tracing::debug!("Missing vertex normals in indexed geometry, computing them as flat. Vertex count increased from {} to {}", vertex_count_before, vertex_count_after);
|
||||
} else {
|
||||
bevy_utils::tracing::debug!(
|
||||
tracing::debug!(
|
||||
"Missing vertex normals in indexed geometry, computing them as flat."
|
||||
);
|
||||
}
|
||||
@ -728,7 +724,7 @@ async fn load_gltf<'a, 'b, 'c>(
|
||||
} else if mesh.attribute(Mesh::ATTRIBUTE_NORMAL).is_some()
|
||||
&& material_needs_tangents(&primitive.material())
|
||||
{
|
||||
bevy_utils::tracing::debug!(
|
||||
tracing::debug!(
|
||||
"Missing vertex tangents for {}, computing them using the mikktspace algorithm. Consider using a tool such as Blender to pre-compute the tangents.", file_name
|
||||
);
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ flate2 = { version = "1.0.22", optional = true }
|
||||
ruzstd = { version = "0.7.0", optional = true }
|
||||
# For transcoding of UASTC/ETC1S universal formats, and for .basis file support
|
||||
basis-universal = { version = "0.3.0", optional = true }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
//! [DirectDraw Surface](https://en.wikipedia.org/wiki/DirectDraw_Surface) functionality.
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
use bevy_utils::warn_once;
|
||||
use ddsfile::{Caps2, D3DFormat, Dds, DxgiFormat};
|
||||
use std::io::Cursor;
|
||||
use wgpu::TextureViewDescriptor;
|
||||
use wgpu_types::{Extent3d, TextureDimension, TextureFormat, TextureViewDimension};
|
||||
#[cfg(debug_assertions)]
|
||||
use {bevy_utils::once, tracing::warn};
|
||||
|
||||
use super::{CompressedImageFormats, Image, TextureError};
|
||||
|
||||
@ -53,10 +53,10 @@ pub fn dds_buffer_to_image(
|
||||
let mip_map_level = match dds.get_num_mipmap_levels() {
|
||||
0 => {
|
||||
#[cfg(debug_assertions)]
|
||||
warn_once!(
|
||||
once!(warn!(
|
||||
"Mipmap levels for texture {} are 0, bumping them to 1",
|
||||
name
|
||||
);
|
||||
));
|
||||
1
|
||||
}
|
||||
t => t,
|
||||
|
||||
@ -72,7 +72,7 @@ macro_rules! feature_gate {
|
||||
($feature: tt, $value: ident) => {{
|
||||
#[cfg(not(feature = $feature))]
|
||||
{
|
||||
bevy_utils::tracing::warn!("feature \"{}\" is not enabled", $feature);
|
||||
tracing::warn!("feature \"{}\" is not enabled", $feature);
|
||||
return None;
|
||||
}
|
||||
#[cfg(feature = $feature)]
|
||||
|
||||
@ -10,14 +10,16 @@ keywords = ["bevy"]
|
||||
rust-version = "1.83.0"
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.15.0-dev", default-features = false }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev", default-features = false }
|
||||
bevy_input = { path = "../bevy_input", version = "0.15.0-dev", default-features = false }
|
||||
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev", default-features = false }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev", default-features = false }
|
||||
bevy_window = { path = "../bevy_window", version = "0.15.0-dev", default-features = false }
|
||||
|
||||
# other
|
||||
thiserror = { version = "2", default-features = false }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[dev-dependencies]
|
||||
smol_str = "0.2"
|
||||
|
||||
@ -36,9 +36,9 @@ use bevy_input::{
|
||||
keyboard::{KeyCode, KeyboardInput},
|
||||
ButtonInput, ButtonState,
|
||||
};
|
||||
use bevy_utils::tracing::warn;
|
||||
use bevy_window::PrimaryWindow;
|
||||
use thiserror::Error;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{FocusedInput, InputFocus, InputFocusVisible};
|
||||
|
||||
|
||||
@ -13,10 +13,12 @@ trace = ["tracing-error"]
|
||||
trace_tracy_memory = ["dep:tracy-client"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.15.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" }
|
||||
|
||||
# other
|
||||
tracing-subscriber = { version = "0.3.1", features = [
|
||||
"registry",
|
||||
"env-filter",
|
||||
@ -24,6 +26,7 @@ tracing-subscriber = { version = "0.3.1", features = [
|
||||
tracing-chrome = { version = "0.7.0", optional = true }
|
||||
tracing-log = "0.2.0"
|
||||
tracing-error = { version = "0.2.0", optional = true }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
# Tracy dependency compatibility table:
|
||||
# https://github.com/nagisa/rust_tracy_client
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
use alloc::ffi::CString;
|
||||
use bevy_utils::tracing::{
|
||||
use core::fmt::{Debug, Write};
|
||||
use tracing::{
|
||||
field::Field,
|
||||
span::{Attributes, Record},
|
||||
Event, Id, Level, Subscriber,
|
||||
};
|
||||
use core::fmt::{Debug, Write};
|
||||
use tracing_subscriber::{field::Visit, layer::Context, registry::LookupSpan, Layer};
|
||||
|
||||
#[derive(Default)]
|
||||
|
||||
@ -22,6 +22,7 @@ use core::error::Error;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod android_tracing;
|
||||
mod once;
|
||||
|
||||
#[cfg(feature = "trace_tracy_memory")]
|
||||
#[global_allocator]
|
||||
@ -33,21 +34,21 @@ static GLOBAL: tracy_client::ProfiledAllocator<std::alloc::System> =
|
||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||
pub mod prelude {
|
||||
#[doc(hidden)]
|
||||
pub use bevy_utils::tracing::{
|
||||
pub use tracing::{
|
||||
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,
|
||||
};
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use bevy_utils::{debug_once, error_once, info_once, once, trace_once, warn_once};
|
||||
pub use crate::{debug_once, error_once, info_once, trace_once, warn_once};
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use bevy_utils::once;
|
||||
}
|
||||
|
||||
pub use bevy_utils::{
|
||||
debug_once, error_once, info_once, once, trace_once,
|
||||
tracing::{
|
||||
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,
|
||||
Level,
|
||||
},
|
||||
warn_once,
|
||||
pub use bevy_utils::once;
|
||||
pub use tracing::{
|
||||
self, debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn,
|
||||
warn_span, Level,
|
||||
};
|
||||
pub use tracing_subscriber;
|
||||
|
||||
@ -89,7 +90,7 @@ pub(crate) struct FlushGuard(SyncCell<tracing_chrome::FlushGuard>);
|
||||
/// ```no_run
|
||||
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, PluginGroup};
|
||||
/// # use bevy_log::LogPlugin;
|
||||
/// # use bevy_utils::tracing::Level;
|
||||
/// # use tracing::Level;
|
||||
/// fn main() {
|
||||
/// App::new()
|
||||
/// .add_plugins(DefaultPlugins.set(LogPlugin {
|
||||
@ -232,7 +233,7 @@ pub struct LogPlugin {
|
||||
/// Because [`BoxedLayer`] takes a `dyn Layer`, `Vec<Layer>` is also an acceptable return value.
|
||||
///
|
||||
/// Access to [`App`] is also provided to allow for communication between the
|
||||
/// [`Subscriber`](bevy_utils::tracing::Subscriber) and the [`App`].
|
||||
/// [`Subscriber`](tracing::Subscriber) and the [`App`].
|
||||
///
|
||||
/// Please see the `examples/log_layers.rs` for a complete example.
|
||||
pub custom_layer: fn(app: &mut App) -> Option<BoxedLayer>,
|
||||
@ -364,7 +365,7 @@ impl Plugin for LogPlugin {
|
||||
|
||||
let logger_already_set = LogTracer::init().is_err();
|
||||
let subscriber_already_set =
|
||||
bevy_utils::tracing::subscriber::set_global_default(finished_subscriber).is_err();
|
||||
tracing::subscriber::set_global_default(finished_subscriber).is_err();
|
||||
|
||||
match (logger_already_set, subscriber_already_set) {
|
||||
(true, true) => error!(
|
||||
|
||||
49
crates/bevy_log/src/once.rs
Normal file
49
crates/bevy_log/src/once.rs
Normal file
@ -0,0 +1,49 @@
|
||||
/// Call [`trace!`](crate::trace) once per call site.
|
||||
///
|
||||
/// Useful for logging within systems which are called every frame.
|
||||
#[macro_export]
|
||||
macro_rules! trace_once {
|
||||
($($arg:tt)+) => ({
|
||||
$crate::once!($crate::trace!($($arg)+))
|
||||
});
|
||||
}
|
||||
|
||||
/// Call [`debug!`](crate::debug) once per call site.
|
||||
///
|
||||
/// Useful for logging within systems which are called every frame.
|
||||
#[macro_export]
|
||||
macro_rules! debug_once {
|
||||
($($arg:tt)+) => ({
|
||||
$crate::once!($crate::debug!($($arg)+))
|
||||
});
|
||||
}
|
||||
|
||||
/// Call [`info!`](crate::info) once per call site.
|
||||
///
|
||||
/// Useful for logging within systems which are called every frame.
|
||||
#[macro_export]
|
||||
macro_rules! info_once {
|
||||
($($arg:tt)+) => ({
|
||||
$crate::once!($crate::info!($($arg)+))
|
||||
});
|
||||
}
|
||||
|
||||
/// Call [`warn!`](crate::warn) once per call site.
|
||||
///
|
||||
/// Useful for logging within systems which are called every frame.
|
||||
#[macro_export]
|
||||
macro_rules! warn_once {
|
||||
($($arg:tt)+) => ({
|
||||
$crate::once!($crate::warn!($($arg)+))
|
||||
});
|
||||
}
|
||||
|
||||
/// Call [`error!`](crate::error) once per call site.
|
||||
///
|
||||
/// Useful for logging within systems which are called every frame.
|
||||
#[macro_export]
|
||||
macro_rules! error_once {
|
||||
($($arg:tt)+) => ({
|
||||
$crate::once!($crate::error!($($arg)+))
|
||||
});
|
||||
}
|
||||
@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0"
|
||||
keywords = ["bevy"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
bevy_asset = { path = "../bevy_asset", version = "0.15.0-dev" }
|
||||
bevy_image = { path = "../bevy_image", version = "0.15.0-dev" }
|
||||
bevy_math = { path = "../bevy_math", version = "0.15.0-dev" }
|
||||
@ -21,13 +22,14 @@ bevy_mikktspace = { path = "../bevy_mikktspace", version = "0.15.0-dev" }
|
||||
bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||
|
||||
# misc
|
||||
# other
|
||||
bitflags = { version = "2.3", features = ["serde"] }
|
||||
bytemuck = { version = "1.5" }
|
||||
wgpu-types = { version = "23", default-features = false }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
hexasphere = "15.0"
|
||||
thiserror = { version = "2", default-features = false }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -13,8 +13,8 @@ use bevy_asset::{Asset, Handle, RenderAssetUsages};
|
||||
use bevy_image::Image;
|
||||
use bevy_math::{primitives::Triangle3d, *};
|
||||
use bevy_reflect::Reflect;
|
||||
use bevy_utils::tracing::warn;
|
||||
use bytemuck::cast_slice;
|
||||
use tracing::warn;
|
||||
use wgpu_types::{VertexAttribute, VertexFormat, VertexStepMode};
|
||||
|
||||
pub const INDEX_BUFFER_ASSET_INDEX: u64 = 0;
|
||||
|
||||
@ -48,7 +48,6 @@ bevy_transform = { path = "../bevy_transform", version = "0.15.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||
bevy_window = { path = "../bevy_window", version = "0.15.0-dev" }
|
||||
|
||||
|
||||
# other
|
||||
bitflags = "2.3"
|
||||
fixedbitset = "0.5"
|
||||
@ -70,6 +69,7 @@ radsort = "0.1"
|
||||
smallvec = "1.6"
|
||||
nonmax = "0.5"
|
||||
static_assertions = "1"
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -17,7 +17,8 @@ use bevy_render::{
|
||||
view::{RenderLayers, ViewVisibility},
|
||||
};
|
||||
use bevy_transform::components::GlobalTransform;
|
||||
use bevy_utils::{prelude::default, tracing::warn};
|
||||
use bevy_utils::prelude::default;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{
|
||||
prelude::EnvironmentMapLight, ClusterConfig, ClusterFarZMode, Clusters, ExtractedPointLight,
|
||||
|
||||
@ -23,7 +23,8 @@ use bevy_render::{
|
||||
sync_world::RenderEntity,
|
||||
Extract,
|
||||
};
|
||||
use bevy_utils::{tracing::warn, HashSet};
|
||||
use bevy_utils::HashSet;
|
||||
use tracing::warn;
|
||||
|
||||
pub(crate) use crate::cluster::assign::assign_objects_to_clusters;
|
||||
use crate::MeshPipeline;
|
||||
|
||||
@ -28,7 +28,8 @@ use bevy_render::{
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_transform::{components::Transform, prelude::GlobalTransform};
|
||||
use bevy_utils::{tracing::error, HashMap};
|
||||
use bevy_utils::HashMap;
|
||||
use tracing::error;
|
||||
|
||||
use core::{hash::Hash, ops::Deref};
|
||||
|
||||
|
||||
@ -57,9 +57,10 @@ use bevy_render::{
|
||||
Extract, ExtractSchedule, RenderApp,
|
||||
};
|
||||
use bevy_render::{renderer::RenderDevice, sync_world::MainEntityHashMap};
|
||||
use bevy_utils::{default, tracing::error, HashSet};
|
||||
use bevy_utils::{default, HashSet};
|
||||
use fixedbitset::FixedBitSet;
|
||||
use nonmax::{NonMaxU16, NonMaxU32};
|
||||
use tracing::error;
|
||||
|
||||
use crate::{binding_arrays_are_usable, ExtractMeshesSet};
|
||||
|
||||
|
||||
@ -42,8 +42,9 @@ use bevy_render::{
|
||||
};
|
||||
use bevy_render::{mesh::allocator::MeshAllocator, sync_world::MainEntityHashMap};
|
||||
use bevy_render::{texture::FallbackImage, view::RenderVisibleEntities};
|
||||
use bevy_utils::{hashbrown::hash_map::Entry, tracing::error};
|
||||
use bevy_utils::hashbrown::hash_map::Entry;
|
||||
use core::{hash::Hash, marker::PhantomData};
|
||||
use tracing::error;
|
||||
|
||||
/// Materials are used alongside [`MaterialPlugin`], [`Mesh3d`], and [`MeshMaterial3d`]
|
||||
/// to spawn entities that are rendered with a specific [`Material`] type. They serve as an easy to use high level
|
||||
|
||||
@ -21,8 +21,9 @@ use bevy_render::{
|
||||
renderer::RenderDevice,
|
||||
texture::FallbackImage,
|
||||
};
|
||||
use bevy_utils::{default, tracing::error, HashMap};
|
||||
use bevy_utils::{default, HashMap};
|
||||
use core::{any, iter, marker::PhantomData, num::NonZero};
|
||||
use tracing::error;
|
||||
|
||||
/// An object that creates and stores bind groups for a single material type.
|
||||
///
|
||||
|
||||
@ -83,8 +83,8 @@ use bevy_render::{
|
||||
ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_transform::components::Transform;
|
||||
use bevy_utils::tracing::error;
|
||||
use derive_more::From;
|
||||
use tracing::error;
|
||||
|
||||
const MESHLET_BINDINGS_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(1325134235233421);
|
||||
const MESHLET_MESH_MATERIAL_SHADER_HANDLE: Handle<Shader> =
|
||||
|
||||
@ -36,7 +36,7 @@ use bevy_render::{
|
||||
Extract,
|
||||
};
|
||||
use bevy_transform::prelude::GlobalTransform;
|
||||
use bevy_utils::tracing::error;
|
||||
use tracing::error;
|
||||
|
||||
#[cfg(feature = "meshlet")]
|
||||
use crate::meshlet::{
|
||||
|
||||
@ -36,9 +36,9 @@ use bevy_render::{
|
||||
view::{NoIndirectDrawing, ViewUniform, ViewUniformOffset, ViewUniforms},
|
||||
Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::tracing::warn;
|
||||
use bitflags::bitflags;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{
|
||||
graph::NodePbr, MeshCullingData, MeshCullingDataBuffer, MeshInputUniform, MeshUniform,
|
||||
|
||||
@ -35,14 +35,11 @@ use bevy_render::{
|
||||
sync_world::{MainEntity, RenderEntity},
|
||||
};
|
||||
use bevy_transform::{components::GlobalTransform, prelude::Transform};
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use bevy_utils::{
|
||||
default,
|
||||
tracing::{error, warn},
|
||||
HashMap,
|
||||
};
|
||||
use bevy_utils::{default, HashMap};
|
||||
use core::{hash::Hash, ops::Range};
|
||||
#[cfg(feature = "trace")]
|
||||
use tracing::info_span;
|
||||
use tracing::{error, warn};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct ExtractedPointLight {
|
||||
|
||||
@ -43,14 +43,10 @@ use bevy_render::{
|
||||
Extract,
|
||||
};
|
||||
use bevy_transform::components::GlobalTransform;
|
||||
use bevy_utils::{
|
||||
default,
|
||||
hashbrown::hash_map::Entry,
|
||||
tracing::{error, warn},
|
||||
HashMap, Parallel,
|
||||
};
|
||||
use bevy_utils::{default, hashbrown::hash_map::Entry, HashMap, Parallel};
|
||||
use material_bind_groups::MaterialBindingId;
|
||||
use render::skin::{self, SkinIndex};
|
||||
use tracing::{error, warn};
|
||||
|
||||
use crate::{
|
||||
render::{
|
||||
|
||||
@ -21,7 +21,7 @@ use bevy_render::{
|
||||
globals::{GlobalsBuffer, GlobalsUniform},
|
||||
render_asset::RenderAssets,
|
||||
render_resource::{binding_types::*, *},
|
||||
renderer::RenderDevice,
|
||||
renderer::{RenderAdapter, RenderDevice},
|
||||
texture::{FallbackImage, FallbackImageMsaa, FallbackImageZero, GpuImage},
|
||||
view::{
|
||||
Msaa, RenderVisibilityRanges, ViewUniform, ViewUniforms,
|
||||
@ -29,16 +29,8 @@ use bevy_render::{
|
||||
},
|
||||
};
|
||||
use core::{array, num::NonZero};
|
||||
|
||||
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
|
||||
use bevy_render::render_resource::binding_types::texture_cube;
|
||||
use bevy_render::renderer::RenderAdapter;
|
||||
#[cfg(debug_assertions)]
|
||||
use bevy_utils::warn_once;
|
||||
use environment_map::EnvironmentMapLight;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
use crate::MESH_PIPELINE_VIEW_LAYOUT_SAFE_MAX_TEXTURES;
|
||||
use crate::{
|
||||
environment_map::{self, RenderViewEnvironmentMapBindGroupEntries},
|
||||
irradiance_volume::{
|
||||
@ -52,6 +44,12 @@ use crate::{
|
||||
ViewClusterBindings, ViewShadowBindings, CLUSTERED_FORWARD_STORAGE_BUFFER_COUNT,
|
||||
};
|
||||
|
||||
#[cfg(all(feature = "webgl", target_arch = "wasm32", not(feature = "webgpu")))]
|
||||
use bevy_render::render_resource::binding_types::texture_cube;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
use {crate::MESH_PIPELINE_VIEW_LAYOUT_SAFE_MAX_TEXTURES, bevy_utils::once, tracing::warn};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MeshPipelineViewLayout {
|
||||
pub bind_group_layout: BindGroupLayout,
|
||||
@ -445,7 +443,7 @@ impl MeshPipelineViewLayouts {
|
||||
#[cfg(debug_assertions)]
|
||||
if layout.texture_count > MESH_PIPELINE_VIEW_LAYOUT_SAFE_MAX_TEXTURES {
|
||||
// Issue our own warning here because Naga's error message is a bit cryptic in this situation
|
||||
warn_once!("Too many textures in mesh pipeline view layout, this might cause us to hit `wgpu::Limits::max_sampled_textures_per_shader_stage` in some environments.");
|
||||
once!(warn!("Too many textures in mesh pipeline view layout, this might cause us to hit `wgpu::Limits::max_sampled_textures_per_shader_stage` in some environments."));
|
||||
}
|
||||
|
||||
&layout.bind_group_layout
|
||||
|
||||
@ -34,11 +34,9 @@ use bevy_render::{
|
||||
view::{Msaa, ViewUniform, ViewUniformOffset, ViewUniforms},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{
|
||||
prelude::default,
|
||||
tracing::{error, warn},
|
||||
};
|
||||
use bevy_utils::prelude::default;
|
||||
use core::mem;
|
||||
use tracing::{error, warn};
|
||||
|
||||
const PREPROCESS_DEPTH_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(102258915420479);
|
||||
const SSAO_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(253938746510568);
|
||||
|
||||
@ -38,7 +38,8 @@ use bevy_render::{
|
||||
view::{ExtractedView, Msaa, ViewTarget, ViewUniformOffset},
|
||||
Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{info_once, prelude::default};
|
||||
use bevy_utils::{once, prelude::default};
|
||||
use tracing::info;
|
||||
|
||||
use crate::{
|
||||
binding_arrays_are_usable, graph::NodePbr, prelude::EnvironmentMapLight,
|
||||
@ -502,10 +503,10 @@ impl ExtractComponent for ScreenSpaceReflections {
|
||||
|
||||
fn extract_component(settings: QueryItem<'_, Self::QueryData>) -> Option<Self::Out> {
|
||||
if !DEPTH_TEXTURE_SAMPLING_SUPPORTED {
|
||||
info_once!(
|
||||
once!(info!(
|
||||
"Disabling screen-space reflections on this platform because depth textures \
|
||||
aren't supported correctly"
|
||||
);
|
||||
));
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ license = "MIT OR Apache-2.0"
|
||||
bevy_mesh_picking_backend = ["dep:bevy_mesh", "dep:crossbeam-channel"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.15.0-dev" }
|
||||
bevy_asset = { path = "../bevy_asset", version = "0.15.0-dev" }
|
||||
bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
|
||||
@ -27,8 +28,10 @@ bevy_transform = { path = "../bevy_transform", version = "0.15.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||
bevy_window = { path = "../bevy_window", version = "0.15.0-dev" }
|
||||
|
||||
# other
|
||||
crossbeam-channel = { version = "0.5", optional = true }
|
||||
uuid = { version = "1.1", features = ["v4"] }
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -44,8 +44,9 @@ use bevy_hierarchy::Parent;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_reflect::prelude::*;
|
||||
use bevy_render::camera::NormalizedRenderTarget;
|
||||
use bevy_utils::{tracing::debug, HashMap, Instant};
|
||||
use bevy_utils::{HashMap, Instant};
|
||||
use bevy_window::Window;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::{
|
||||
backend::{prelude::PointerLocation, HitData},
|
||||
|
||||
@ -22,8 +22,9 @@ use bevy_input::{
|
||||
use bevy_math::Vec2;
|
||||
use bevy_reflect::prelude::*;
|
||||
use bevy_render::camera::RenderTarget;
|
||||
use bevy_utils::{tracing::debug, HashMap, HashSet};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use bevy_window::{PrimaryWindow, WindowEvent, WindowRef};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::pointer::{
|
||||
Location, PointerAction, PointerButton, PointerId, PointerInput, PointerLocation,
|
||||
|
||||
@ -18,7 +18,7 @@ use bevy_ecs::{prelude::*, system::lifetimeless::Read, system::SystemParam};
|
||||
use bevy_math::FloatOrd;
|
||||
use bevy_render::{prelude::*, primitives::Aabb};
|
||||
use bevy_transform::components::GlobalTransform;
|
||||
use bevy_utils::tracing::*;
|
||||
use tracing::*;
|
||||
|
||||
/// How a ray cast should handle [`Visibility`].
|
||||
#[derive(Clone, Copy, Reflect)]
|
||||
|
||||
@ -92,6 +92,7 @@ nonmax = "0.5"
|
||||
smallvec = { version = "1.11", features = ["const_new"] }
|
||||
offset-allocator = "0.2"
|
||||
variadics_please = "1.1"
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# Omit the `glsl` feature in non-WebAssembly by default.
|
||||
|
||||
@ -9,9 +9,10 @@ use bevy_ecs::{
|
||||
world::{FromWorld, World},
|
||||
};
|
||||
use bevy_encase_derive::ShaderType;
|
||||
use bevy_utils::{default, tracing::error};
|
||||
use bevy_utils::default;
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use nonmax::NonMaxU32;
|
||||
use tracing::error;
|
||||
use wgpu::{BindingResource, BufferUsages, DownlevelFlags, Features};
|
||||
|
||||
use crate::{
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
use bevy_derive::{Deref, DerefMut};
|
||||
use bevy_ecs::system::{Res, ResMut, Resource, StaticSystemParam};
|
||||
use bevy_utils::tracing::error;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use tracing::error;
|
||||
use wgpu::BindingResource;
|
||||
|
||||
use crate::{
|
||||
|
||||
@ -32,13 +32,14 @@ use bevy_math::{ops, vec2, Dir3, FloatOrd, Mat4, Ray3d, Rect, URect, UVec2, UVec
|
||||
use bevy_reflect::prelude::*;
|
||||
use bevy_render_macros::ExtractComponent;
|
||||
use bevy_transform::components::{GlobalTransform, Transform};
|
||||
use bevy_utils::{tracing::warn, HashMap, HashSet};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use bevy_window::{
|
||||
NormalizedWindowRef, PrimaryWindow, Window, WindowCreated, WindowRef, WindowResized,
|
||||
WindowScaleFactorChanged,
|
||||
};
|
||||
use core::ops::Range;
|
||||
use derive_more::derive::From;
|
||||
use tracing::warn;
|
||||
use wgpu::{BlendState, TextureFormat, TextureUsages};
|
||||
|
||||
/// Render viewport configuration for the [`Camera`] component.
|
||||
|
||||
@ -71,7 +71,7 @@ impl Node for CameraDriverNode {
|
||||
};
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
let _span = bevy_utils::tracing::info_span!("no_camera_clear_pass").entered();
|
||||
let _span = tracing::info_span!("no_camera_clear_pass").entered();
|
||||
let pass_descriptor = RenderPassDescriptor {
|
||||
label: Some("no_camera_clear_pass"),
|
||||
color_attachments: &[Some(RenderPassColorAttachment {
|
||||
|
||||
@ -7,7 +7,7 @@ use std::thread::{self, ThreadId};
|
||||
|
||||
use bevy_diagnostic::{Diagnostic, DiagnosticMeasurement, DiagnosticPath, DiagnosticsStore};
|
||||
use bevy_ecs::system::{Res, ResMut, Resource};
|
||||
use bevy_utils::{tracing, Instant};
|
||||
use bevy_utils::Instant;
|
||||
use std::sync::Mutex;
|
||||
use wgpu::{
|
||||
Buffer, BufferDescriptor, BufferUsages, CommandEncoder, ComputePass, Features, MapMode,
|
||||
|
||||
@ -3,6 +3,8 @@ use core::marker::PhantomData;
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_ecs::prelude::*;
|
||||
pub use bevy_render_macros::ExtractResource;
|
||||
use bevy_utils::once;
|
||||
use tracing::{error, warn};
|
||||
|
||||
use crate::{Extract, ExtractSchedule, RenderApp};
|
||||
|
||||
@ -34,10 +36,10 @@ impl<R: ExtractResource> Plugin for ExtractResourcePlugin<R> {
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
render_app.add_systems(ExtractSchedule, extract_resource::<R>);
|
||||
} else {
|
||||
bevy_utils::error_once!(
|
||||
once!(error!(
|
||||
"Render app did not exist when trying to add `extract_resource` for <{}>.",
|
||||
core::any::type_name::<R>()
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -56,11 +58,11 @@ pub fn extract_resource<R: ExtractResource>(
|
||||
} else {
|
||||
#[cfg(debug_assertions)]
|
||||
if !main_resource.is_added() {
|
||||
bevy_utils::warn_once!(
|
||||
once!(warn!(
|
||||
"Removing resource {} from render world not expected, adding using `Commands`.
|
||||
This may decrease performance",
|
||||
core::any::type_name::<R>()
|
||||
);
|
||||
));
|
||||
}
|
||||
commands.insert_resource(R::extract_resource(main_resource));
|
||||
}
|
||||
|
||||
@ -23,10 +23,11 @@ use bevy_ecs::{
|
||||
use bevy_image::{Image, TextureFormatPixelInfo};
|
||||
use bevy_reflect::Reflect;
|
||||
use bevy_render_macros::ExtractComponent;
|
||||
use bevy_utils::{tracing::warn, HashMap};
|
||||
use bevy_utils::HashMap;
|
||||
use encase::internal::ReadFrom;
|
||||
use encase::private::Reader;
|
||||
use encase::ShaderType;
|
||||
use tracing::warn;
|
||||
use wgpu::CommandEncoder;
|
||||
|
||||
/// A plugin that enables reading back gpu buffers and textures to the cpu.
|
||||
|
||||
@ -98,9 +98,9 @@ use alloc::sync::Arc;
|
||||
use bevy_app::{App, AppLabel, Plugin, SubApp};
|
||||
use bevy_asset::{load_internal_asset, AssetApp, AssetServer, Handle};
|
||||
use bevy_ecs::{prelude::*, schedule::ScheduleLabel};
|
||||
use bevy_utils::tracing::debug;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
use std::sync::Mutex;
|
||||
use tracing::debug;
|
||||
|
||||
/// Contains the default Bevy rendering backend based on wgpu.
|
||||
///
|
||||
@ -486,7 +486,7 @@ unsafe fn initialize_render_app(app: &mut App) {
|
||||
render_app.set_extract(|main_world, render_world| {
|
||||
{
|
||||
#[cfg(feature = "trace")]
|
||||
let _stage_span = bevy_utils::tracing::info_span!("entity_sync").entered();
|
||||
let _stage_span = tracing::info_span!("entity_sync").entered();
|
||||
entity_sync_system(main_world, render_world);
|
||||
}
|
||||
|
||||
|
||||
@ -15,8 +15,9 @@ use bevy_ecs::{
|
||||
system::{Res, ResMut, Resource},
|
||||
world::{FromWorld, World},
|
||||
};
|
||||
use bevy_utils::{default, tracing::error, HashMap, HashSet};
|
||||
use bevy_utils::{default, HashMap, HashSet};
|
||||
use offset_allocator::{Allocation, Allocator};
|
||||
use tracing::error;
|
||||
use wgpu::{
|
||||
BufferDescriptor, BufferSize, BufferUsages, CommandEncoderDescriptor, DownlevelFlags,
|
||||
COPY_BUFFER_ALIGNMENT,
|
||||
|
||||
@ -148,7 +148,7 @@ impl Plugin for PipelinedRenderingPlugin {
|
||||
|
||||
std::thread::spawn(move || {
|
||||
#[cfg(feature = "trace")]
|
||||
let _span = bevy_utils::tracing::info_span!("render thread").entered();
|
||||
let _span = tracing::info_span!("render thread").entered();
|
||||
|
||||
let compute_task_pool = ComputeTaskPool::get();
|
||||
loop {
|
||||
@ -164,8 +164,7 @@ impl Plugin for PipelinedRenderingPlugin {
|
||||
|
||||
{
|
||||
#[cfg(feature = "trace")]
|
||||
let _sub_app_span =
|
||||
bevy_utils::tracing::info_span!("sub app", name = ?RenderApp).entered();
|
||||
let _sub_app_span = tracing::info_span!("sub app", name = ?RenderApp).entered();
|
||||
render_app.update();
|
||||
}
|
||||
|
||||
@ -174,7 +173,7 @@ impl Plugin for PipelinedRenderingPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
bevy_utils::tracing::debug!("exiting pipelined rendering thread");
|
||||
tracing::debug!("exiting pipelined rendering thread");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,12 +11,10 @@ use bevy_ecs::{
|
||||
world::{FromWorld, Mut},
|
||||
};
|
||||
use bevy_render_macros::ExtractResource;
|
||||
use bevy_utils::{
|
||||
tracing::{debug, error},
|
||||
HashMap, HashSet,
|
||||
};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use core::marker::PhantomData;
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, error};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum PrepareAssetError<E: Send + Sync + 'static> {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use bevy_app::{App, SubApp};
|
||||
use bevy_ecs::world::FromWorld;
|
||||
use bevy_utils::tracing::warn;
|
||||
use tracing::warn;
|
||||
|
||||
use super::{IntoRenderNodeArray, Node, RenderGraph, RenderLabel, RenderSubGraph};
|
||||
|
||||
|
||||
@ -8,10 +8,13 @@ use crate::{
|
||||
renderer::RenderDevice,
|
||||
};
|
||||
use bevy_color::LinearRgba;
|
||||
use bevy_utils::{default, detailed_trace};
|
||||
use bevy_utils::default;
|
||||
use core::ops::Range;
|
||||
use wgpu::{IndexFormat, QuerySet, RenderPass};
|
||||
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
use tracing::trace;
|
||||
|
||||
/// Tracks the state of a [`TrackedRenderPass`].
|
||||
///
|
||||
/// This is used to skip redundant operations on the [`TrackedRenderPass`] (e.g. setting an already
|
||||
@ -164,7 +167,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
///
|
||||
/// Subsequent draw calls will exhibit the behavior defined by the `pipeline`.
|
||||
pub fn set_render_pipeline(&mut self, pipeline: &'a RenderPipeline) {
|
||||
detailed_trace!("set pipeline: {:?}", pipeline);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("set pipeline: {:?}", pipeline);
|
||||
if self.state.is_pipeline_set(pipeline.id()) {
|
||||
return;
|
||||
}
|
||||
@ -189,7 +193,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
.state
|
||||
.is_bind_group_set(index, bind_group.id(), dynamic_uniform_indices)
|
||||
{
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"set bind_group {} (already set): {:?} ({:?})",
|
||||
index,
|
||||
bind_group,
|
||||
@ -197,7 +202,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
);
|
||||
return;
|
||||
}
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"set bind_group {}: {:?} ({:?})",
|
||||
index,
|
||||
bind_group,
|
||||
@ -222,7 +228,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
/// [`draw_indexed`]: TrackedRenderPass::draw_indexed
|
||||
pub fn set_vertex_buffer(&mut self, slot_index: usize, buffer_slice: BufferSlice<'a>) {
|
||||
if self.state.is_vertex_buffer_set(slot_index, &buffer_slice) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"set vertex buffer {} (already set): {:?} (offset = {}, size = {})",
|
||||
slot_index,
|
||||
buffer_slice.id(),
|
||||
@ -231,7 +238,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
);
|
||||
return;
|
||||
}
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"set vertex buffer {}: {:?} (offset = {}, size = {})",
|
||||
slot_index,
|
||||
buffer_slice.id(),
|
||||
@ -258,14 +266,16 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
.state
|
||||
.is_index_buffer_set(buffer_slice.id(), offset, index_format)
|
||||
{
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"set index buffer (already set): {:?} ({})",
|
||||
buffer_slice.id(),
|
||||
offset
|
||||
);
|
||||
return;
|
||||
}
|
||||
detailed_trace!("set index buffer: {:?} ({})", buffer_slice.id(), offset);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("set index buffer: {:?} ({})", buffer_slice.id(), offset);
|
||||
self.pass.set_index_buffer(*buffer_slice, index_format);
|
||||
self.state
|
||||
.set_index_buffer(buffer_slice.id(), offset, index_format);
|
||||
@ -275,7 +285,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
///
|
||||
/// The active vertex buffer(s) can be set with [`TrackedRenderPass::set_vertex_buffer`].
|
||||
pub fn draw(&mut self, vertices: Range<u32>, instances: Range<u32>) {
|
||||
detailed_trace!("draw: {:?} {:?}", vertices, instances);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("draw: {:?} {:?}", vertices, instances);
|
||||
self.pass.draw(vertices, instances);
|
||||
}
|
||||
|
||||
@ -284,7 +295,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
/// The active index buffer can be set with [`TrackedRenderPass::set_index_buffer`], while the
|
||||
/// active vertex buffer(s) can be set with [`TrackedRenderPass::set_vertex_buffer`].
|
||||
pub fn draw_indexed(&mut self, indices: Range<u32>, base_vertex: i32, instances: Range<u32>) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"draw indexed: {:?} {} {:?}",
|
||||
indices,
|
||||
base_vertex,
|
||||
@ -311,7 +323,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
/// }
|
||||
/// ```
|
||||
pub fn draw_indirect(&mut self, indirect_buffer: &'a Buffer, indirect_offset: u64) {
|
||||
detailed_trace!("draw indirect: {:?} {}", indirect_buffer, indirect_offset);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("draw indirect: {:?} {}", indirect_buffer, indirect_offset);
|
||||
self.pass.draw_indirect(indirect_buffer, indirect_offset);
|
||||
}
|
||||
|
||||
@ -335,7 +348,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
/// }
|
||||
/// ```
|
||||
pub fn draw_indexed_indirect(&mut self, indirect_buffer: &'a Buffer, indirect_offset: u64) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"draw indexed indirect: {:?} {}",
|
||||
indirect_buffer,
|
||||
indirect_offset
|
||||
@ -367,7 +381,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
indirect_offset: u64,
|
||||
count: u32,
|
||||
) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"multi draw indirect: {:?} {}, {}x",
|
||||
indirect_buffer,
|
||||
indirect_offset,
|
||||
@ -407,7 +422,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
count_offset: u64,
|
||||
max_count: u32,
|
||||
) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"multi draw indirect count: {:?} {}, ({:?} {})x, max {}x",
|
||||
indirect_buffer,
|
||||
indirect_offset,
|
||||
@ -449,7 +465,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
indirect_offset: u64,
|
||||
count: u32,
|
||||
) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"multi draw indexed indirect: {:?} {}, {}x",
|
||||
indirect_buffer,
|
||||
indirect_offset,
|
||||
@ -491,7 +508,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
count_offset: u64,
|
||||
max_count: u32,
|
||||
) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"multi draw indexed indirect count: {:?} {}, ({:?} {})x, max {}x",
|
||||
indirect_buffer,
|
||||
indirect_offset,
|
||||
@ -512,7 +530,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
///
|
||||
/// Subsequent stencil tests will test against this value.
|
||||
pub fn set_stencil_reference(&mut self, reference: u32) {
|
||||
detailed_trace!("set stencil reference: {}", reference);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("set stencil reference: {}", reference);
|
||||
self.pass.set_stencil_reference(reference);
|
||||
}
|
||||
|
||||
@ -520,7 +539,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
///
|
||||
/// Subsequent draw calls will discard any fragments that fall outside this region.
|
||||
pub fn set_scissor_rect(&mut self, x: u32, y: u32, width: u32, height: u32) {
|
||||
detailed_trace!("set_scissor_rect: {} {} {} {}", x, y, width, height);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("set_scissor_rect: {} {} {} {}", x, y, width, height);
|
||||
self.pass.set_scissor_rect(x, y, width, height);
|
||||
}
|
||||
|
||||
@ -528,7 +548,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
///
|
||||
/// `Features::PUSH_CONSTANTS` must be enabled on the device in order to call these functions.
|
||||
pub fn set_push_constants(&mut self, stages: ShaderStages, offset: u32, data: &[u8]) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"set push constants: {:?} offset: {} data.len: {}",
|
||||
stages,
|
||||
offset,
|
||||
@ -549,7 +570,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
min_depth: f32,
|
||||
max_depth: f32,
|
||||
) {
|
||||
detailed_trace!(
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!(
|
||||
"set viewport: {} {} {} {} {} {}",
|
||||
x,
|
||||
y,
|
||||
@ -580,7 +602,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
///
|
||||
/// This is a GPU debugging feature. This has no effect on the rendering itself.
|
||||
pub fn insert_debug_marker(&mut self, label: &str) {
|
||||
detailed_trace!("insert debug marker: {}", label);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("insert debug marker: {}", label);
|
||||
self.pass.insert_debug_marker(label);
|
||||
}
|
||||
|
||||
@ -605,7 +628,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
/// [`push_debug_group`]: TrackedRenderPass::push_debug_group
|
||||
/// [`pop_debug_group`]: TrackedRenderPass::pop_debug_group
|
||||
pub fn push_debug_group(&mut self, label: &str) {
|
||||
detailed_trace!("push_debug_group marker: {}", label);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("push_debug_group marker: {}", label);
|
||||
self.pass.push_debug_group(label);
|
||||
}
|
||||
|
||||
@ -622,7 +646,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
/// [`push_debug_group`]: TrackedRenderPass::push_debug_group
|
||||
/// [`pop_debug_group`]: TrackedRenderPass::pop_debug_group
|
||||
pub fn pop_debug_group(&mut self) {
|
||||
detailed_trace!("pop_debug_group");
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("pop_debug_group");
|
||||
self.pass.pop_debug_group();
|
||||
}
|
||||
|
||||
@ -630,7 +655,8 @@ impl<'a> TrackedRenderPass<'a> {
|
||||
///
|
||||
/// Subsequent blending tests will test against this value.
|
||||
pub fn set_blend_constant(&mut self, color: LinearRgba) {
|
||||
detailed_trace!("set blend constant: {:?}", color);
|
||||
#[cfg(feature = "detailed_trace")]
|
||||
trace!("set blend constant: {:?}", color);
|
||||
self.pass.set_blend_constant(wgpu::Color::from(color));
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ impl IntoBindGroupLayoutEntryBuilder for BindingType {
|
||||
impl IntoBindGroupLayoutEntryBuilder for BindGroupLayoutEntry {
|
||||
fn into_bind_group_layout_entry_builder(self) -> BindGroupLayoutEntryBuilder {
|
||||
if self.binding != u32::MAX {
|
||||
bevy_utils::tracing::warn!("The BindGroupLayoutEntries api ignores the binding index when converting a raw wgpu::BindGroupLayoutEntry. You can ignore this warning by setting it to u32::MAX.");
|
||||
tracing::warn!("The BindGroupLayoutEntries api ignores the binding index when converting a raw wgpu::BindGroupLayoutEntry. You can ignore this warning by setting it to u32::MAX.");
|
||||
}
|
||||
BindGroupLayoutEntryBuilder {
|
||||
ty: self.ty,
|
||||
|
||||
@ -11,16 +11,12 @@ use bevy_ecs::{
|
||||
system::{Res, ResMut, Resource},
|
||||
};
|
||||
use bevy_tasks::Task;
|
||||
use bevy_utils::{
|
||||
default,
|
||||
hashbrown::hash_map::EntryRef,
|
||||
tracing::{debug, error},
|
||||
HashMap, HashSet,
|
||||
};
|
||||
use bevy_utils::{default, hashbrown::hash_map::EntryRef, HashMap, HashSet};
|
||||
use core::{future::Future, hash::Hash, mem, ops::Deref};
|
||||
use naga::valid::Capabilities;
|
||||
use std::sync::{Mutex, PoisonError};
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, error};
|
||||
#[cfg(feature = "shader_format_spirv")]
|
||||
use wgpu::util::make_spirv;
|
||||
use wgpu::{
|
||||
|
||||
@ -9,11 +9,11 @@ use bevy_ecs::system::Resource;
|
||||
use bevy_utils::{
|
||||
default,
|
||||
hashbrown::hash_map::{RawEntryMut, VacantEntry},
|
||||
tracing::error,
|
||||
Entry, FixedHasher, HashMap,
|
||||
};
|
||||
use core::{fmt::Debug, hash::Hash};
|
||||
use thiserror::Error;
|
||||
use tracing::error;
|
||||
|
||||
pub trait SpecializedRenderPipeline {
|
||||
type Key: Clone + Hash + PartialEq + Eq;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user