Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ impl SpecializedRenderPipeline for BackgroundMotionVectorsPipeline {
type Key = BackgroundMotionVectorsPipelineKey;

fn specialize(&self, key: Self::Key) -> RenderPipelineDescriptor {
let mut targets = prepass_target_descriptors(key.normal_prepass, true, false);
if let Some(normal) = &mut targets[0] {
// We don't write normal, set it empty to avoid WebGPU validation error.
// It's a bug that wgpu doesn't validate this, see https://github.com/gfx-rs/wgpu/issues/9147
normal.write_mask = bevy_render::render_resource::ColorWrites::empty();
}
RenderPipelineDescriptor {
label: Some("background_motion_vectors_pipeline".into()),
layout: vec![self.bind_group_layout.clone()],
Expand All @@ -168,7 +174,7 @@ impl SpecializedRenderPipeline for BackgroundMotionVectorsPipeline {
},
fragment: Some(FragmentState {
shader: self.fragment_shader.clone(),
targets: prepass_target_descriptors(key.normal_prepass, true, false),
targets,
..default()
}),
..default()
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_post_process/src/dof/dof.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ fn gaussian_vertical(in: FullscreenVertexOutput) -> @location(0) vec4<f32> {
// │
// │
@fragment
fn bokeh_pass_0(in: FullscreenVertexOutput) -> DualOutput {
fn bokeh_pass_a(in: FullscreenVertexOutput) -> DualOutput {
let coc = calculate_circle_of_confusion(in.position);
let vertical = box_blur_a(in.position, coc, vec2(0.0, 1.0));
let diagonal = box_blur_a(in.position, coc, vec2(COS_NEG_FRAC_PI_6, SIN_NEG_FRAC_PI_6));
Expand All @@ -232,7 +232,7 @@ fn bokeh_pass_0(in: FullscreenVertexOutput) -> DualOutput {
// •
#ifdef DUAL_INPUT
@fragment
fn bokeh_pass_1(in: FullscreenVertexOutput) -> @location(0) vec4<f32> {
fn bokeh_pass_b(in: FullscreenVertexOutput) -> @location(0) vec4<f32> {
let coc = calculate_circle_of_confusion(in.position);
let output_0 = box_blur_a(in.position, coc, vec2(COS_NEG_FRAC_PI_6, SIN_NEG_FRAC_PI_6));
let output_1 = box_blur_b(in.position, coc, vec2(COS_NEG_FRAC_PI_5_6, SIN_NEG_FRAC_PI_5_6));
Expand Down
9 changes: 2 additions & 7 deletions crates/bevy_post_process/src/dof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ pub enum DepthOfFieldMode {
///
/// For more information, see [Wikipedia's article on *bokeh*].
///
/// This doesn't work on WebGPU.
///
/// [Wikipedia's article on *bokeh*]: https://en.wikipedia.org/wiki/Bokeh
Bokeh,

Expand All @@ -135,9 +133,6 @@ pub enum DepthOfFieldMode {
/// aesthetically pleasing but requires less video memory bandwidth.
///
/// This is the default.
///
/// This works on native and WebGPU.
/// If targeting native platforms, consider using [`DepthOfFieldMode::Bokeh`] instead.
#[default]
Gaussian,
}
Expand Down Expand Up @@ -644,8 +639,8 @@ impl SpecializedRenderPipeline for DepthOfFieldPipeline {
entry_point: Some(match key.pass {
DofPass::GaussianHorizontal => "gaussian_horizontal".into(),
DofPass::GaussianVertical => "gaussian_vertical".into(),
DofPass::BokehPass0 => "bokeh_pass_0".into(),
DofPass::BokehPass1 => "bokeh_pass_1".into(),
DofPass::BokehPass0 => "bokeh_pass_a".into(),
DofPass::BokehPass1 => "bokeh_pass_b".into(),
}),
targets,
}),
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/skybox.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Load a cubemap texture onto a cube like a skybox and cycle through different compressed texture formats

#[cfg(not(target_arch = "wasm32"))]
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
use bevy::anti_alias::taa::TemporalAntiAliasing;

use bevy::{
Expand Down Expand Up @@ -73,7 +73,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn((
Camera3d::default(),
Msaa::Off,
#[cfg(not(target_arch = "wasm32"))]
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
TemporalAntiAliasing::default(),
ScreenSpaceAmbientOcclusion::default(),
Transform::from_xyz(0.0, 0.0, 8.0).looking_at(Vec3::ZERO, Vec3::Y),
Expand Down