Skip to content

Commit

Permalink
debug_printf: Add DEBUG_PRINTF wgpu feature
Browse files Browse the repository at this point in the history
  • Loading branch information
exrook committed Oct 25, 2023
1 parent 7b00fe4 commit 2deb7e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,10 @@ impl<A: HalApi> Device<A> {
.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 {
Expand Down
10 changes: 10 additions & 0 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2deb7e0

Please sign in to comment.