Skip to content

Commit 70a592f

Browse files
authored
Update to wgpu 0.18 (#10266)
# Objective Keep up to date with wgpu. ## Solution Update the wgpu version. Currently blocked on naga_oil updating to naga 0.14 and releasing a new version. 3d scenes (or maybe any scene with lighting?) currently don't render anything due to ``` error: naga_oil bug, please file a report: composer failed to build a valid header: Type [2] '' is invalid = Capability Capabilities(CUBE_ARRAY_TEXTURES) is required ``` I'm not sure what should be passed in for `wgpu::InstanceFlags`, or if we want to make the gles3minorversion configurable (might be useful for debugging?) Currently blocked on bevyengine/naga_oil#63, and gfx-rs/wgpu#4569 to be fixed upstream in wgpu first. ## Known issues Amd+windows+vulkan has issues with texture_binding_arrays (see the image [here](#10266 (comment))), but that'll be fixed in the next wgpu/naga version, and you can just use dx12 as a workaround for now (Amd+linux mesa+vulkan texture_binding_arrays are fixed though). --- ## Changelog Updated wgpu to 0.18, naga to 0.14.2, and naga_oil to 0.11. - Windows desktop GL should now be less painful as it no longer requires Angle. - You can now toggle shader validation and debug information for debug and release builds using `WgpuSettings.instance_flags` and [InstanceFlags](https://docs.rs/wgpu/0.18.0/wgpu/struct.InstanceFlags.html) ## Migration Guide - `RenderPassDescriptor` `color_attachments` (as well as `RenderPassColorAttachment`, and `RenderPassDepthStencilAttachment`) now use `StoreOp::Store` or `StoreOp::Discard` instead of a `boolean` to declare whether or not they should be stored. - `RenderPassDescriptor` now have `timestamp_writes` and `occlusion_query_set` fields. These can safely be set to `None`. - `ComputePassDescriptor` now have a `timestamp_writes` field. This can be set to `None` for now. - See the [wgpu changelog](https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#v0180-2023-10-25) for additional details
1 parent 0159df3 commit 70a592f

File tree

29 files changed

+125
-44
lines changed

29 files changed

+125
-44
lines changed

crates/bevy_core_pipeline/src/bloom/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ impl ViewNode for BloomNode {
189189
ops: Operations::default(),
190190
})],
191191
depth_stencil_attachment: None,
192+
timestamp_writes: None,
193+
occlusion_query_set: None,
192194
});
193195
downsampling_first_pass.set_render_pipeline(downsampling_first_pipeline);
194196
downsampling_first_pass.set_bind_group(
@@ -211,6 +213,8 @@ impl ViewNode for BloomNode {
211213
ops: Operations::default(),
212214
})],
213215
depth_stencil_attachment: None,
216+
timestamp_writes: None,
217+
occlusion_query_set: None,
214218
});
215219
downsampling_pass.set_render_pipeline(downsampling_pipeline);
216220
downsampling_pass.set_bind_group(
@@ -232,10 +236,12 @@ impl ViewNode for BloomNode {
232236
resolve_target: None,
233237
ops: Operations {
234238
load: LoadOp::Load,
235-
store: true,
239+
store: StoreOp::Store,
236240
},
237241
})],
238242
depth_stencil_attachment: None,
243+
timestamp_writes: None,
244+
occlusion_query_set: None,
239245
});
240246
upsampling_pass.set_render_pipeline(upsampling_pipeline);
241247
upsampling_pass.set_bind_group(
@@ -262,10 +268,12 @@ impl ViewNode for BloomNode {
262268
color_attachments: &[Some(view_target.get_unsampled_color_attachment(
263269
Operations {
264270
load: LoadOp::Load,
265-
store: true,
271+
store: StoreOp::Store,
266272
},
267273
))],
268274
depth_stencil_attachment: None,
275+
timestamp_writes: None,
276+
occlusion_query_set: None,
269277
});
270278
upsampling_final_pass.set_render_pipeline(upsampling_final_pipeline);
271279
upsampling_final_pass.set_bind_group(

crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ impl Node for CASNode {
101101
ops: Operations::default(),
102102
})],
103103
depth_stencil_attachment: None,
104+
timestamp_writes: None,
105+
occlusion_query_set: None,
104106
};
105107

106108
let mut render_pass = render_context

crates/bevy_core_pipeline/src/core_2d/main_pass_2d_node.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use bevy_render::{
77
camera::ExtractedCamera,
88
render_graph::{Node, NodeRunError, RenderGraphContext},
99
render_phase::RenderPhase,
10-
render_resource::{LoadOp, Operations, RenderPassDescriptor},
10+
render_resource::{LoadOp, Operations, RenderPassDescriptor, StoreOp},
1111
renderer::RenderContext,
1212
view::{ExtractedView, ViewTarget},
1313
};
@@ -66,9 +66,11 @@ impl Node for MainPass2dNode {
6666
ClearColorConfig::Custom(color) => LoadOp::Clear(color.into()),
6767
ClearColorConfig::None => LoadOp::Load,
6868
},
69-
store: true,
69+
store: StoreOp::Store,
7070
}))],
7171
depth_stencil_attachment: None,
72+
timestamp_writes: None,
73+
occlusion_query_set: None,
7274
});
7375

7476
if let Some(viewport) = camera.viewport.as_ref() {
@@ -88,9 +90,11 @@ impl Node for MainPass2dNode {
8890
label: Some("reset_viewport_pass_2d"),
8991
color_attachments: &[Some(target.get_color_attachment(Operations {
9092
load: LoadOp::Load,
91-
store: true,
93+
store: StoreOp::Store,
9294
}))],
9395
depth_stencil_attachment: None,
96+
timestamp_writes: None,
97+
occlusion_query_set: None,
9498
};
9599

96100
render_context

crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use bevy_render::{
1111
render_phase::RenderPhase,
1212
render_resource::{
1313
LoadOp, Operations, PipelineCache, RenderPassDepthStencilAttachment, RenderPassDescriptor,
14+
StoreOp,
1415
},
1516
renderer::RenderContext,
1617
view::{ViewDepthTexture, ViewTarget, ViewUniformOffset},
@@ -82,9 +83,10 @@ impl ViewNode for MainOpaquePass3dNode {
8283
label: Some("main_opaque_pass_3d"),
8384
// NOTE: The opaque pass loads the color
8485
// buffer as well as writing to it.
85-
color_attachments: &[Some(
86-
target.get_color_attachment(Operations { load, store: true }),
87-
)],
86+
color_attachments: &[Some(target.get_color_attachment(Operations {
87+
load,
88+
store: StoreOp::Store,
89+
}))],
8890
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
8991
view: &depth.view,
9092
// NOTE: The opaque main pass loads the depth buffer and possibly overwrites it
@@ -102,10 +104,12 @@ impl ViewNode for MainOpaquePass3dNode {
102104
camera_3d.depth_load_op.clone()
103105
}
104106
.into(),
105-
store: true,
107+
store: StoreOp::Store,
106108
}),
107109
stencil_ops: None,
108110
}),
111+
timestamp_writes: None,
112+
occlusion_query_set: None,
109113
});
110114

111115
if let Some(viewport) = camera.viewport.as_ref() {

crates/bevy_core_pipeline/src/core_3d/main_transmissive_pass_3d_node.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use bevy_render::{
77
render_phase::RenderPhase,
88
render_resource::{
99
Extent3d, LoadOp, Operations, RenderPassDepthStencilAttachment, RenderPassDescriptor,
10+
StoreOp,
1011
},
1112
renderer::RenderContext,
1213
view::{ViewDepthTexture, ViewTarget},
@@ -47,17 +48,19 @@ impl ViewNode for MainTransmissivePass3dNode {
4748
// NOTE: The transmissive pass loads the color buffer as well as overwriting it where appropriate.
4849
color_attachments: &[Some(target.get_color_attachment(Operations {
4950
load: LoadOp::Load,
50-
store: true,
51+
store: StoreOp::Store,
5152
}))],
5253
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
5354
view: &depth.view,
5455
// NOTE: The transmissive main pass loads the depth buffer and possibly overwrites it
5556
depth_ops: Some(Operations {
5657
load: LoadOp::Load,
57-
store: true,
58+
store: StoreOp::Store,
5859
}),
5960
stencil_ops: None,
6061
}),
62+
timestamp_writes: None,
63+
occlusion_query_set: None,
6164
};
6265

6366
// Run the transmissive pass, sorted back-to-front

crates/bevy_core_pipeline/src/core_3d/main_transparent_pass_3d_node.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ use bevy_render::{
44
camera::ExtractedCamera,
55
render_graph::{NodeRunError, RenderGraphContext, ViewNode},
66
render_phase::RenderPhase,
7-
render_resource::{LoadOp, Operations, RenderPassDepthStencilAttachment, RenderPassDescriptor},
7+
render_resource::{
8+
LoadOp, Operations, RenderPassDepthStencilAttachment, RenderPassDescriptor, StoreOp,
9+
},
810
renderer::RenderContext,
911
view::{ViewDepthTexture, ViewTarget},
1012
};
@@ -42,7 +44,7 @@ impl ViewNode for MainTransparentPass3dNode {
4244
// NOTE: The transparent pass loads the color buffer as well as overwriting it where appropriate.
4345
color_attachments: &[Some(target.get_color_attachment(Operations {
4446
load: LoadOp::Load,
45-
store: true,
47+
store: StoreOp::Store,
4648
}))],
4749
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
4850
view: &depth.view,
@@ -54,10 +56,12 @@ impl ViewNode for MainTransparentPass3dNode {
5456
// transparent ones.
5557
depth_ops: Some(Operations {
5658
load: LoadOp::Load,
57-
store: true,
59+
store: StoreOp::Store,
5860
}),
5961
stencil_ops: None,
6062
}),
63+
timestamp_writes: None,
64+
occlusion_query_set: None,
6165
});
6266

6367
if let Some(viewport) = camera.viewport.as_ref() {
@@ -77,9 +81,11 @@ impl ViewNode for MainTransparentPass3dNode {
7781
label: Some("reset_viewport_pass_3d"),
7882
color_attachments: &[Some(target.get_color_attachment(Operations {
7983
load: LoadOp::Load,
80-
store: true,
84+
store: StoreOp::Store,
8185
}))],
8286
depth_stencil_attachment: None,
87+
timestamp_writes: None,
88+
occlusion_query_set: None,
8389
};
8490

8591
render_context

crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ impl ViewNode for CopyDeferredLightingIdNode {
104104
view: &deferred_lighting_id_depth_texture.texture.default_view,
105105
depth_ops: Some(Operations {
106106
load: LoadOp::Clear(0.0),
107-
store: true,
107+
store: StoreOp::Store,
108108
}),
109109
stencil_ops: None,
110110
}),
111+
timestamp_writes: None,
112+
occlusion_query_set: None,
111113
});
112114

113115
render_pass.set_render_pipeline(pipeline);

crates/bevy_core_pipeline/src/deferred/node.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use bevy_ecs::prelude::*;
22
use bevy_ecs::query::QueryItem;
33
use bevy_render::render_graph::ViewNode;
44

5+
use bevy_render::render_resource::StoreOp;
56
use bevy_render::{
67
camera::ExtractedCamera,
78
prelude::Color,
@@ -76,7 +77,7 @@ impl ViewNode for DeferredGBufferPrepassNode {
7677
} else {
7778
LoadOp::Clear(Color::BLACK.into())
7879
},
79-
store: true,
80+
store: StoreOp::Store,
8081
},
8182
}),
8283
);
@@ -92,7 +93,7 @@ impl ViewNode for DeferredGBufferPrepassNode {
9293
} else {
9394
LoadOp::Clear(Color::BLACK.into())
9495
},
95-
store: true,
96+
store: StoreOp::Store,
9697
},
9798
},
9899
));
@@ -122,7 +123,7 @@ impl ViewNode for DeferredGBufferPrepassNode {
122123
load: LoadOp::Load,
123124
#[cfg(not(all(feature = "webgl", target_arch = "wasm32")))]
124125
load: LoadOp::Clear(Default::default()),
125-
store: true,
126+
store: StoreOp::Store,
126127
},
127128
}),
128129
);
@@ -136,7 +137,7 @@ impl ViewNode for DeferredGBufferPrepassNode {
136137
resolve_target: None,
137138
ops: Operations {
138139
load: LoadOp::Clear(Default::default()),
139-
store: true,
140+
store: StoreOp::Store,
140141
},
141142
}),
142143
);
@@ -165,10 +166,12 @@ impl ViewNode for DeferredGBufferPrepassNode {
165166
camera_3d.depth_load_op.clone()
166167
}
167168
.into(),
168-
store: true,
169+
store: StoreOp::Store,
169170
}),
170171
stencil_ops: None,
171172
}),
173+
timestamp_writes: None,
174+
occlusion_query_set: None,
172175
});
173176

174177
if let Some(viewport) = camera.viewport.as_ref() {

crates/bevy_core_pipeline/src/fxaa/node.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ impl ViewNode for FxaaNode {
7979
ops: Operations::default(),
8080
})],
8181
depth_stencil_attachment: None,
82+
timestamp_writes: None,
83+
occlusion_query_set: None,
8284
};
8385

8486
let mut render_pass = render_context

crates/bevy_core_pipeline/src/msaa_writeback.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ impl Node for MsaaWritebackNode {
8686
// the MSAA resolve step.
8787
color_attachments: &[Some(target.get_color_attachment(Operations {
8888
load: LoadOp::Clear(Default::default()),
89-
store: true,
89+
store: StoreOp::Store,
9090
}))],
9191
depth_stencil_attachment: None,
92+
timestamp_writes: None,
93+
occlusion_query_set: None,
9294
};
9395

9496
let bind_group = render_context.render_device().create_bind_group(

0 commit comments

Comments
 (0)