Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ bevy_render_macros = { path = "macros", version = "0.17.0-dev" }
bevy_time = { path = "../bevy_time", version = "0.17.0-dev" }
bevy_transform = { path = "../bevy_transform", version = "0.17.0-dev" }
bevy_window = { path = "../bevy_window", version = "0.17.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.17.0-dev", features = [
"wgpu_wrapper",
] }
bevy_utils = { path = "../bevy_utils", version = "0.17.0-dev" }
bevy_tasks = { path = "../bevy_tasks", version = "0.17.0-dev" }
bevy_image = { path = "../bevy_image", version = "0.17.0-dev" }
bevy_mesh = { path = "../bevy_mesh", version = "0.17.0-dev" }
Expand Down Expand Up @@ -131,6 +129,9 @@ naga_oil = { version = "0.18", default-features = false, features = [
"test_shader",
] }

[target.'cfg(all(target_arch = "wasm32", target_feature = "atomics"))'.dependencies]
send_wrapper = { version = "0.6.0" }

[dev-dependencies]
proptest = "1"

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/diagnostic/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use wgpu::{
};

use crate::renderer::{RenderAdapterInfo, RenderDevice, RenderQueue};
use bevy_utils::WgpuWrapper;
use crate::WgpuWrapper;

use super::RecordDiagnostics;

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub mod sync_component;
pub mod sync_world;
pub mod texture;
pub mod view;
mod wgpu_wrapper;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, WgpuWrapper is now private. There's a small issue with that: To call RenderCreation::manual, once needs to pass RenderDevice, etc., which contain a WgpuWrapper and are created by initialize_renderer - that's fine. But the last argument to manual() is a RenderInstance, construction which would require a public WgpuWrapper. In the absence of that, it's not possible to call RenderCreation::manual anymore.

I'd be happy to make a PR to accommodate this, but I don't know what the right path is. Is making WgpuWrapper public an option? Or would you prefer a function similar to initialize_renderer that takes an Instance and returns a wrapped RenderInstance?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, this is is intended to be a "revert" and WgpuWrapper was public in 0.16, I'll make a PR to make it public again: #20409

pub use bevy_camera::primitives;
#[cfg(feature = "bevy_light")]
mod extract_impls;
Expand Down Expand Up @@ -118,11 +119,11 @@ use alloc::sync::Arc;
use bevy_app::{App, AppLabel, Plugin, SubApp};
use bevy_asset::{AssetApp, AssetServer};
use bevy_ecs::{prelude::*, schedule::ScheduleLabel};
use bevy_utils::WgpuWrapper;
use bitflags::bitflags;
use core::ops::{Deref, DerefMut};
use std::sync::Mutex;
use tracing::debug;
use wgpu_wrapper::WgpuWrapper;

/// Inline shader as an `embedded_asset` and load it permanently.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_resource/bind_group.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::WgpuWrapper;
use crate::{
define_atomic_id,
render_asset::RenderAssets,
Expand All @@ -8,7 +9,6 @@ use crate::{
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::system::{SystemParam, SystemParamItem};
pub use bevy_render_macros::AsBindGroup;
use bevy_utils::WgpuWrapper;
use core::ops::Deref;
use encase::ShaderType;
use thiserror::Error;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::define_atomic_id;
use bevy_utils::WgpuWrapper;
use crate::WgpuWrapper;
use core::ops::Deref;

define_atomic_id!(BindGroupLayoutId);
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_resource/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::define_atomic_id;
use bevy_utils::WgpuWrapper;
use crate::WgpuWrapper;
use core::ops::{Bound, Deref, RangeBounds};

define_atomic_id!(BufferId);
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_resource/pipeline.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::ShaderDefVal;
use crate::mesh::VertexBufferLayout;
use crate::WgpuWrapper;
use crate::{
define_atomic_id,
render_resource::{BindGroupLayout, Shader},
};
use alloc::borrow::Cow;
use bevy_asset::Handle;
use bevy_utils::WgpuWrapper;
use core::ops::Deref;
use wgpu::{
ColorTargetState, DepthStencilState, MultisampleState, PrimitiveState, PushConstantRange,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_resource/pipeline_cache.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::WgpuWrapper;
use crate::{
render_resource::*,
renderer::{RenderAdapter, RenderDevice},
Expand All @@ -13,7 +14,6 @@ use bevy_ecs::{
use bevy_platform::collections::{hash_map::EntryRef, HashMap, HashSet};
use bevy_tasks::Task;
use bevy_utils::default;
use bevy_utils::WgpuWrapper;
use core::{future::Future, hash::Hash, mem};
use naga::valid::Capabilities;
use std::sync::{Mutex, PoisonError};
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_resource/texture.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::define_atomic_id;
use crate::WgpuWrapper;
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::resource::Resource;
use bevy_utils::WgpuWrapper;
use core::ops::Deref;

define_atomic_id!(TextureId);
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/renderer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mod graph_runner;
mod render_device;

use crate::WgpuWrapper;
use bevy_derive::{Deref, DerefMut};
#[cfg(not(all(target_arch = "wasm32", target_feature = "atomics")))]
use bevy_tasks::ComputeTaskPool;
use bevy_utils::WgpuWrapper;
pub use graph_runner::*;
pub use render_device::*;
use tracing::{debug, error, info, info_span, warn};
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/renderer/render_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::render_resource::{
BindGroup, BindGroupLayout, Buffer, ComputePipeline, RawRenderPipelineDescriptor,
RenderPipeline, Sampler, Texture,
};
use crate::WgpuWrapper;
use bevy_ecs::resource::Resource;
use bevy_utils::WgpuWrapper;
use wgpu::{
util::DeviceExt, BindGroupDescriptor, BindGroupEntry, BindGroupLayoutDescriptor,
BindGroupLayoutEntry, BufferAsyncError, BufferBindingType, PollError, PollStatus,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/view/window/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::WgpuWrapper;
use crate::{
render_resource::{SurfaceTexture, TextureView},
renderer::{RenderAdapter, RenderDevice, RenderInstance},
Expand All @@ -7,7 +8,6 @@ use bevy_app::{App, Plugin};
use bevy_ecs::{entity::EntityHashMap, prelude::*};
use bevy_platform::collections::HashSet;
use bevy_utils::default;
use bevy_utils::WgpuWrapper;
use bevy_window::{
CompositeAlphaMode, PresentMode, PrimaryWindow, RawHandleWrapper, Window, WindowClosing,
};
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ keywords = ["bevy"]
[features]
default = ["parallel"]

wgpu_wrapper = ["dep:send_wrapper"]

# Provides access to the `Parallel` type.
parallel = ["bevy_platform/std", "dep:thread_local"]

Expand All @@ -26,9 +24,6 @@ bevy_platform = { path = "../bevy_platform", version = "0.17.0-dev", default-fea
disqualified = { version = "1.0", default-features = false }
thread_local = { version = "1.0", optional = true }

[target.'cfg(all(target_arch = "wasm32", target_feature = "atomics"))'.dependencies]
send_wrapper = { version = "0.6.0", optional = true }

[dev-dependencies]
static_assertions = "1.1.0"

Expand Down
6 changes: 0 additions & 6 deletions crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ pub mod prelude {
pub use crate::default;
}

#[cfg(feature = "wgpu_wrapper")]
mod wgpu_wrapper;

mod debug_info;
mod default;
mod once;
Expand All @@ -59,9 +56,6 @@ pub use once::OnceFlag;

pub use default::default;

#[cfg(feature = "wgpu_wrapper")]
pub use wgpu_wrapper::WgpuWrapper;

use core::mem::ManuallyDrop;

/// A type which calls a function when dropped.
Expand Down
Loading