From 2deb7e0ec2dc36589f090b2c3c0d2676970fed38 Mon Sep 17 00:00:00 2001 From: Jacob Hughes Date: Wed, 25 Oct 2023 11:42:46 -0700 Subject: [PATCH] debug_printf: Add DEBUG_PRINTF wgpu feature --- wgpu-core/src/device/resource.rs | 4 ++++ wgpu-types/src/lib.rs | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index fd85fd6a775..6885b4d037c 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -1316,6 +1316,10 @@ impl Device { .flags .contains(wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES), ); + caps.set( + Caps::DEBUG_PRINTF, + self.features.contains(wgt::Features::DEBUG_PRINTF), + ); let debug_source = if self.instance_flags.contains(wgt::InstanceFlags::DEBUG) { Some(hal::DebugSource { diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 82989598efd..3c96fe67dac 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -760,6 +760,16 @@ bitflags::bitflags! { // Shader: + /// Enables support for debugPrintf in WGSL shaders. + /// + /// Supported Platforms: + /// - DX11 (fxc only) + /// - Dx12 (fxc only) + /// - Vulkan + /// - OpenGL + /// + /// This is a native only feature + const DEBUG_PRINTF = 1 << 58; /// Enables 64-bit floating point types in SPIR-V shaders. /// /// Note: even when supported by GPU hardware, 64-bit floating point operations are