diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 4e5ce74e3..2b1d8bfa3 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -677,24 +677,11 @@ impl Global { } let mem_props = phd.memory_properties(); + if !desc.shader_validation { + log::warn!("Shader validation is disabled"); + } let private_features = PrivateFeatures { - shader_validation: match std::env::var("WGPU_SHADER_VALIDATION") { - Ok(var) => match var.as_str() { - "0" => { - log::info!("Shader validation is disabled"); - false - } - "1" => { - log::info!("Shader validation is enabled"); - true - } - _ => { - log::warn!("Unknown shader validation setting: {:?}", var); - true - } - }, - _ => true, - }, + shader_validation: desc.shader_validation, texture_d24_s8: phd .format_properties(Some(hal::format::Format::D24UnormS8Uint)) .optimal_tiling diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index a90cbadce..cffd75ed6 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -189,6 +189,9 @@ impl Default for Limits { pub struct DeviceDescriptor { pub extensions: Extensions, pub limits: Limits, + /// Switch shader validation on/off. This is a temporary field + /// that will be removed once our validation logic is complete. + pub shader_validation: bool, } // TODO: This is copy/pasted from gfx-hal, so we need to find a new place to put