From 0de144feb516554244687e8e304eb9c34f860599 Mon Sep 17 00:00:00 2001 From: Dusty DeWeese Date: Mon, 24 Apr 2023 19:45:53 -0700 Subject: [PATCH] Use Depth16Unorm --- crates/bevy_core_pipeline/src/core_3d/mod.rs | 2 +- crates/bevy_core_pipeline/src/prepass/mod.rs | 2 +- crates/bevy_pbr/src/render/light.rs | 2 +- crates/bevy_pbr/src/render/mesh.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_core_pipeline/src/core_3d/mod.rs b/crates/bevy_core_pipeline/src/core_3d/mod.rs index 50345ac371447..ebf9d2e3e4599 100644 --- a/crates/bevy_core_pipeline/src/core_3d/mod.rs +++ b/crates/bevy_core_pipeline/src/core_3d/mod.rs @@ -295,7 +295,7 @@ pub fn prepare_core_3d_depth_textures( sample_count: msaa.samples(), dimension: TextureDimension::D2, // PERF: vulkan docs recommend using 24 bit depth for better performance - format: TextureFormat::Depth32Float, + format: TextureFormat::Depth16Unorm, usage, view_formats: &[], }; diff --git a/crates/bevy_core_pipeline/src/prepass/mod.rs b/crates/bevy_core_pipeline/src/prepass/mod.rs index 8a6301a311faa..b020f9c5403b3 100644 --- a/crates/bevy_core_pipeline/src/prepass/mod.rs +++ b/crates/bevy_core_pipeline/src/prepass/mod.rs @@ -38,7 +38,7 @@ use bevy_render::{ }; use bevy_utils::FloatOrd; -pub const DEPTH_PREPASS_FORMAT: TextureFormat = TextureFormat::Depth32Float; +pub const DEPTH_PREPASS_FORMAT: TextureFormat = TextureFormat::Depth16Unorm; pub const NORMAL_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgb10a2Unorm; pub const MOTION_VECTOR_PREPASS_FORMAT: TextureFormat = TextureFormat::Rg16Float; diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index 9cd73117af730..60f75c20095f5 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -224,7 +224,7 @@ pub const MAX_DIRECTIONAL_LIGHTS: usize = 10; pub const MAX_CASCADES_PER_LIGHT: usize = 4; #[cfg(feature = "webgl")] pub const MAX_CASCADES_PER_LIGHT: usize = 1; -pub const SHADOW_FORMAT: TextureFormat = TextureFormat::Depth32Float; +pub const SHADOW_FORMAT: TextureFormat = TextureFormat::Depth16Unorm; #[derive(Resource, Clone)] pub struct ShadowSamplers { diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index 1ede0789564ec..007af79098ab6 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -826,7 +826,7 @@ impl SpecializedMeshPipeline for MeshPipeline { strip_index_format: None, }, depth_stencil: Some(DepthStencilState { - format: TextureFormat::Depth32Float, + format: TextureFormat::Depth16Unorm, depth_write_enabled, depth_compare: CompareFunction::GreaterEqual, stencil: StencilState {