This commit is contained in:
charlotte 🌸 2025-07-18 00:02:13 +02:00 committed by GitHub
commit 754d57098e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 62 additions and 27 deletions

View File

@ -98,6 +98,7 @@ impl Node for CasNode {
label: Some("contrast_adaptive_sharpening"),
color_attachments: &[Some(RenderPassColorAttachment {
view: destination,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],

View File

@ -64,6 +64,7 @@ impl ViewNode for FxaaNode {
label: Some("fxaa_pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: destination,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],

View File

@ -896,6 +896,7 @@ fn perform_edge_detection(
label: Some("SMAA edge detection pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: &smaa_textures.edge_detection_color_texture.default_view,
depth_slice: None,
resolve_target: None,
ops: default(),
})],
@ -951,6 +952,7 @@ fn perform_blending_weight_calculation(
label: Some("SMAA blending weight calculation pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: &smaa_textures.blend_texture.default_view,
depth_slice: None,
resolve_target: None,
ops: default(),
})],
@ -1007,6 +1009,7 @@ fn perform_neighborhood_blending(
label: Some("SMAA neighborhood blending pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: destination,
depth_slice: None,
resolve_target: None,
ops: default(),
})],

View File

@ -202,11 +202,13 @@ impl ViewNode for TemporalAntiAliasNode {
color_attachments: &[
Some(RenderPassColorAttachment {
view: view_target.destination,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
}),
Some(RenderPassColorAttachment {
view: &taa_history_textures.write.default_view,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
}),

View File

@ -26,7 +26,7 @@ bevy_color = { path = "../bevy_color", version = "0.17.0-dev", features = [
bevy_window = { path = "../bevy_window", version = "0.17.0-dev" }
# other
wgpu-types = { version = "25", default-features = false }
wgpu-types = { version = "26", default-features = false }
serde = { version = "1", default-features = false, features = ["derive"] }
thiserror = { version = "2", default-features = false }
downcast-rs = { version = "2", default-features = false, features = ["std"] }

View File

@ -20,7 +20,7 @@ serde = { version = "1.0", features = [
], default-features = false, optional = true }
thiserror = { version = "2", default-features = false }
derive_more = { version = "2", default-features = false, features = ["from"] }
wgpu-types = { version = "25", default-features = false, optional = true }
wgpu-types = { version = "26", default-features = false, optional = true }
encase = { version = "0.10", default-features = false, optional = true }
[features]

View File

@ -186,6 +186,7 @@ impl ViewNode for BloomNode {
label: Some("bloom_downsampling_first_pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],
@ -210,6 +211,7 @@ impl ViewNode for BloomNode {
label: Some("bloom_downsampling_pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],
@ -234,6 +236,7 @@ impl ViewNode for BloomNode {
label: Some("bloom_upsampling_pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: LoadOp::Load,

View File

@ -176,6 +176,7 @@ fn run_deferred_prepass<'w>(
load: bevy_render::render_resource::LoadOp::Load,
store: StoreOp::Store,
},
depth_slice: None,
}
}
#[cfg(any(

View File

@ -409,6 +409,7 @@ impl ViewNode for DepthOfFieldNode {
let mut color_attachments: SmallVec<[_; 2]> = SmallVec::new();
color_attachments.push(Some(RenderPassColorAttachment {
view: postprocess.destination,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: LoadOp::Clear(default()),
@ -429,6 +430,7 @@ impl ViewNode for DepthOfFieldNode {
};
color_attachments.push(Some(RenderPassColorAttachment {
view: &auxiliary_dof_texture.default_view,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: LoadOp::Clear(default()),

View File

@ -84,6 +84,7 @@ impl ViewNode for MotionBlurNode {
label: Some("motion_blur_pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: post_process.destination,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],

View File

@ -87,6 +87,7 @@ impl ViewNode for MsaaWritebackNode {
color_attachments: &[Some(RenderPassColorAttachment {
// If MSAA is enabled, then the sampled texture will always exist
view: target.sampled_main_texture_view().unwrap(),
depth_slice: None,
resolve_target: Some(post_process.destination),
ops: Operations {
load: LoadOp::Clear(LinearRgba::BLACK.into()),

View File

@ -379,6 +379,7 @@ impl ViewNode for PostProcessingNode {
label: Some("postprocessing pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: post_process.destination,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],

View File

@ -117,6 +117,7 @@ impl ViewNode for TonemappingNode {
label: Some("tonemapping_pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: destination,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: LoadOp::Clear(Default::default()), // TODO shouldn't need to be cleared

View File

@ -70,7 +70,7 @@ image = { version = "0.25.2", default-features = false }
# misc
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu-types = { version = "25", default-features = false }
wgpu-types = { version = "26", default-features = false }
serde = { version = "1", features = ["derive"] }
thiserror = { version = "2", default-features = false }
futures-lite = "2.0.1"

View File

@ -26,7 +26,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.17.0-dev", default-fea
# other
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu-types = { version = "25", default-features = false }
wgpu-types = { version = "26", default-features = false }
serde = { version = "1", default-features = false, features = [
"derive",
], optional = true }

View File

@ -595,6 +595,7 @@ fn raster_pass(
}),
color_attachments: &[Some(RenderPassColorAttachment {
view: dummy_render_target,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: LoadOp::Clear(LinearRgba::BLACK.into()),

View File

@ -311,6 +311,7 @@ impl ViewNode for ScreenSpaceReflectionsNode {
label: Some("SSR pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: postprocess.destination,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],

View File

@ -431,6 +431,7 @@ impl ViewNode for VolumetricFogNode {
label: Some("volumetric lighting pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: view_target.main_texture_view(),
depth_slice: None,
resolve_target: None,
ops: Operations {
load: LoadOp::Load,

View File

@ -109,7 +109,7 @@ uuid = { version = "1.13.1", default-features = false, optional = true, features
"serde",
] }
variadics_please = "1.1"
wgpu-types = { version = "25", features = [
wgpu-types = { version = "26", features = [
"serde",
], optional = true, default-features = false }

View File

@ -92,7 +92,7 @@ codespan-reporting = "0.12.0"
# It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm.
# When the 'atomics' feature is enabled `fragile-send-sync-non-atomic` does nothing
# and Bevy instead wraps `wgpu` types to verify they are not used off their origin thread.
wgpu = { version = "25", default-features = false, features = [
wgpu = { version = "26", default-features = false, features = [
"wgsl",
"dx12",
"metal",
@ -101,7 +101,7 @@ wgpu = { version = "25", default-features = false, features = [
"naga-ir",
"fragile-send-sync-non-atomic-wasm",
] }
naga = { version = "25", features = ["wgsl-in"] }
naga = { version = "26", features = ["wgsl-in"] }
serde = { version = "1", features = ["derive"] }
bytemuck = { version = "1.5", features = ["derive", "must_cast"] }
downcast-rs = { version = "2", default-features = false, features = ["std"] }
@ -127,7 +127,7 @@ wesl = { version = "0.1.2", optional = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Omit the `glsl` feature in non-WebAssembly by default.
naga_oil = { version = "0.18", default-features = false, features = [
naga_oil = { git = "https://github.com/bevyengine/naga_oil", default-features = false, features = [
"test_shader",
] }
@ -135,7 +135,7 @@ naga_oil = { version = "0.18", default-features = false, features = [
proptest = "1"
[target.'cfg(target_arch = "wasm32")'.dependencies]
naga_oil = { version = "0.18" }
naga_oil = { git = "https://github.com/bevyengine/naga_oil" }
js-sys = "0.3"
web-sys = { version = "0.3.67", features = [
'Blob',

View File

@ -1122,10 +1122,10 @@ impl FromWorld for GpuPreprocessingSupport {
// `max_compute_*` limits to zero, so we arbitrarily pick one as a canary.
device.limits().max_compute_workgroup_storage_size != 0;
let downlevel_support = adapter.get_downlevel_capabilities().flags.contains(
DownlevelFlags::COMPUTE_SHADERS |
DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW
);
let downlevel_support = adapter
.get_downlevel_capabilities()
.flags
.contains(DownlevelFlags::COMPUTE_SHADERS);
let max_supported_mode = if device.limits().max_compute_workgroup_size_x == 0
|| is_non_supported_android_device(adapter)

View File

@ -56,7 +56,7 @@ fn initial_timestamp(device: &RenderDevice, queue: &RenderQueue) -> i64 {
// Workaround for https://github.com/gfx-rs/wgpu/issues/6406
// TODO when that bug is fixed, merge these encoders together again
let mut copy_encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());
copy_encoder.copy_buffer_to_buffer(&resolve_buffer, 0, &map_buffer, 0, QUERY_SIZE as _);
copy_encoder.copy_buffer_to_buffer(&resolve_buffer, 0, &map_buffer, 0, Some(QUERY_SIZE as _));
queue.submit([timestamp_encoder.finish(), copy_encoder.finish()]);
map_buffer.slice(..).map_async(MapMode::Read, |_| ());

View File

@ -359,6 +359,7 @@ impl Plugin for RenderPlugin {
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
backends,
flags: settings.instance_flags,
memory_budget_thresholds: settings.instance_memory_budget_thresholds,
backend_options: wgpu::BackendOptions {
gl: wgpu::GlBackendOptions {
gles_minor_version: settings.gles3_minor_version,

View File

@ -77,6 +77,7 @@ impl Node for CameraDriverNode {
label: Some("no_camera_clear_pass"),
color_attachments: &[Some(RenderPassColorAttachment {
view: swap_chain_texture,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: LoadOp::Clear(clear_color_global.to_linear().into()),

View File

@ -62,7 +62,7 @@ pub use wgpu::{
TexelCopyBufferInfo, TexelCopyBufferLayout, TexelCopyTextureInfo, TextureAspect,
TextureDescriptor, TextureDimension, TextureFormat, TextureFormatFeatureFlags,
TextureFormatFeatures, TextureSampleType, TextureUsages, TextureView as WgpuTextureView,
TextureViewDescriptor, TextureViewDimension, Tlas, TlasInstance, TlasPackage, VertexAttribute,
TextureViewDescriptor, TextureViewDimension, Tlas, TlasInstance, VertexAttribute,
VertexBufferLayout as RawVertexBufferLayout, VertexFormat, VertexState as RawVertexState,
VertexStepMode, COPY_BUFFER_ALIGNMENT,
};

View File

@ -343,6 +343,15 @@ pub async fn initialize_renderer(
max_non_sampler_bindings: limits
.max_non_sampler_bindings
.min(constrained_limits.max_non_sampler_bindings),
max_blas_primitive_count: limits
.max_blas_primitive_count
.min(constrained_limits.max_blas_primitive_count),
max_blas_geometry_count: limits
.max_blas_geometry_count
.min(constrained_limits.max_blas_geometry_count),
max_tlas_instance_count: limits
.max_tlas_instance_count
.min(constrained_limits.max_tlas_instance_count),
max_color_attachments: limits
.max_color_attachments
.min(constrained_limits.max_color_attachments),
@ -355,6 +364,7 @@ pub async fn initialize_renderer(
max_subgroup_size: limits
.max_subgroup_size
.min(constrained_limits.max_subgroup_size),
max_acceleration_structures_per_shader_stage: 0,
};
}

View File

@ -3,11 +3,11 @@ use crate::renderer::{
};
use alloc::borrow::Cow;
use wgpu::DxcShaderModel;
pub use wgpu::{
Backends, Dx12Compiler, Features as WgpuFeatures, Gles3MinorVersion, InstanceFlags,
Limits as WgpuLimits, MemoryHints, PowerPreference,
};
use wgpu::{DxcShaderModel, MemoryBudgetThresholds};
/// Configures the priority used when automatically configuring the features/limits of `wgpu`.
#[derive(Clone)]
@ -53,6 +53,8 @@ pub struct WgpuSettings {
pub instance_flags: InstanceFlags,
/// This hints to the WGPU device about the preferred memory allocation strategy.
pub memory_hints: MemoryHints,
/// The thresholds for device memory budget.
pub instance_memory_budget_thresholds: MemoryBudgetThresholds,
/// If true, will force wgpu to use a software renderer, if available.
pub force_fallback_adapter: bool,
/// The name of the adapter to use.
@ -107,15 +109,10 @@ impl Default for WgpuSettings {
Dx12Compiler::StaticDxc
} else {
let dxc = "dxcompiler.dll";
let dxil = "dxil.dll";
if cfg!(target_os = "windows")
&& std::fs::metadata(dxc).is_ok()
&& std::fs::metadata(dxil).is_ok()
{
if cfg!(target_os = "windows") && std::fs::metadata(dxc).is_ok() {
Dx12Compiler::DynamicDxc {
dxc_path: String::from(dxc),
dxil_path: String::from(dxil),
max_shader_model: DxcShaderModel::V6_7,
}
} else {
@ -140,6 +137,7 @@ impl Default for WgpuSettings {
gles3_minor_version,
instance_flags,
memory_hints: MemoryHints::default(),
instance_memory_budget_thresholds: MemoryBudgetThresholds::default(),
force_fallback_adapter: false,
adapter_name: None,
}

View File

@ -40,6 +40,7 @@ impl ColorAttachment {
RenderPassColorAttachment {
view: &resolve_target.default_view,
depth_slice: None,
resolve_target: Some(&self.texture.default_view),
ops: Operations {
load: match (self.clear_color, first_call) {
@ -63,6 +64,7 @@ impl ColorAttachment {
RenderPassColorAttachment {
view: &self.texture.default_view,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: match (self.clear_color, first_call) {
@ -146,6 +148,7 @@ impl OutputColorAttachment {
RenderPassColorAttachment {
view: &self.view,
depth_slice: None,
resolve_target: None,
ops: Operations {
load: match (clear_color, first_call) {

View File

@ -596,6 +596,7 @@ fn render_screenshot(
label: Some("screenshot_to_screen_pass"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: texture_view,
depth_slice: None,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Load,

View File

@ -71,14 +71,14 @@ pub fn prepare_raytracing_scene_bindings(
let mut textures = CachedBindingArray::new();
let mut samplers = Vec::new();
let mut materials = StorageBufferList::<GpuMaterial>::default();
let mut tlas = TlasPackage::new(render_device.wgpu_device().create_tlas(
&CreateTlasDescriptor {
let mut tlas = render_device
.wgpu_device()
.create_tlas(&CreateTlasDescriptor {
label: Some("tlas"),
flags: AccelerationStructureFlags::PREFER_FAST_TRACE,
update_mode: AccelerationStructureUpdateMode::Build,
max_instances: instances_query.iter().len() as u32,
},
));
});
let mut transforms = StorageBufferList::<Mat4>::default();
let mut geometry_ids = StorageBufferList::<GpuInstanceGeometryIds>::default();
let mut material_ids = StorageBufferList::<u32>::default();

View File

@ -56,7 +56,7 @@ approx = { version = "0.5", default-features = false }
cfg-if = "1.0"
raw-window-handle = "0.6"
bytemuck = { version = "1.5", optional = true }
wgpu-types = { version = "25", optional = true }
wgpu-types = { version = "26", optional = true }
accesskit = "0.19"
tracing = { version = "0.1", default-features = false, features = ["std"] }

View File

@ -197,6 +197,7 @@ impl ViewNode for PostProcessNode {
// We need to specify the post process destination view here
// to make sure we write to the appropriate texture.
view: post_process.destination,
depth_slice: None,
resolve_target: None,
ops: Operations::default(),
})],