Add an advanced_debugging preset including wgpu base validation (#5248)

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
This commit is contained in:
Nicolas Silva 2024-02-13 17:42:02 +01:00 committed by GitHub
parent f350f28c35
commit e4ef3b401a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View File

@ -91,7 +91,7 @@ Bottom level categories:
- `wgpu-core`'s `serial-pass` feature has been removed. Use `serde` instead. By @KirmesBude in [#5149](https://github.com/gfx-rs/wgpu/pull/5149) - `wgpu-core`'s `serial-pass` feature has been removed. Use `serde` instead. By @KirmesBude in [#5149](https://github.com/gfx-rs/wgpu/pull/5149)
- Added `InstanceFlags::GPU_BASED_VALIDATION`, which enables GPU-based validation for shaders. This is currently only supported on the DX12 and Vulkan backends; other platforms ignore this flag, for now. - Added `InstanceFlags::GPU_BASED_VALIDATION`, which enables GPU-based validation for shaders. This is currently only supported on the DX12 and Vulkan backends; other platforms ignore this flag, for now.
- When set, this flag implies `InstanceFlags::VALIDATION`. - When set, this flag implies `InstanceFlags::VALIDATION`.
- This has been added to the set of flags set by `InstanceFlags::debugging` and `InstanceFlags::from_build_config`. If you notice your graphics workloads running more slowly, this may be the culprit. - This has been added to the set of flags set by `InstanceFlags::advanced_debugging`. Since the overhead is potentially very large, the flag is not enabled by default in debug builds when using `InstanceFlags::from_build_config`.
- As with other instance flags, this flag can be changed in calls to `InstanceFlags::with_env` with the new `WGPU_GPU_BASED_VALIDATION` environment variable. - As with other instance flags, this flag can be changed in calls to `InstanceFlags::with_env` with the new `WGPU_GPU_BASED_VALIDATION` environment variable.
By @ErichDonGubler in [#5146](https://github.com/gfx-rs/wgpu/pull/5146), [#5046](https://github.com/gfx-rs/wgpu/pull/5046). By @ErichDonGubler in [#5146](https://github.com/gfx-rs/wgpu/pull/5146), [#5046](https://github.com/gfx-rs/wgpu/pull/5046).

View File

@ -31,7 +31,7 @@ pub fn initialize_instance() -> Instance {
let gles_minor_version = wgpu::util::gles_minor_version_from_env().unwrap_or_default(); let gles_minor_version = wgpu::util::gles_minor_version_from_env().unwrap_or_default();
Instance::new(wgpu::InstanceDescriptor { Instance::new(wgpu::InstanceDescriptor {
backends, backends,
flags: wgpu::InstanceFlags::debugging().with_env(), flags: wgpu::InstanceFlags::advanced_debugging().with_env(),
dx12_shader_compiler, dx12_shader_compiler,
gles_minor_version, gles_minor_version,
}) })

View File

@ -38,7 +38,7 @@ fn device_lifetime_check() {
backends: wgpu::util::backend_bits_from_env().unwrap_or(wgpu::Backends::all()), backends: wgpu::util::backend_bits_from_env().unwrap_or(wgpu::Backends::all()),
dx12_shader_compiler: wgpu::util::dx12_shader_compiler_from_env().unwrap_or_default(), dx12_shader_compiler: wgpu::util::dx12_shader_compiler_from_env().unwrap_or_default(),
gles_minor_version: wgpu::util::gles_minor_version_from_env().unwrap_or_default(), gles_minor_version: wgpu::util::gles_minor_version_from_env().unwrap_or_default(),
flags: wgpu::InstanceFlags::debugging().with_env(), flags: wgpu::InstanceFlags::advanced_debugging().with_env(),
}); });
let adapter = wgpu::util::initialize_adapter_from_env_or_default(&instance, None) let adapter = wgpu::util::initialize_adapter_from_env_or_default(&instance, None)

View File

@ -941,7 +941,12 @@ impl Default for InstanceFlags {
impl InstanceFlags { impl InstanceFlags {
/// Enable recommended debugging and validation flags. /// Enable recommended debugging and validation flags.
pub fn debugging() -> Self { pub fn debugging() -> Self {
InstanceFlags::DEBUG | InstanceFlags::VALIDATION | InstanceFlags::GPU_BASED_VALIDATION InstanceFlags::DEBUG | InstanceFlags::VALIDATION
}
/// Enable advanced debugging and validation flags (potentially very slow).
pub fn advanced_debugging() -> Self {
Self::debugging() | InstanceFlags::GPU_BASED_VALIDATION
} }
/// Infer good defaults from the build type /// Infer good defaults from the build type