Skip to content

Commit

Permalink
debug_printf: fix feature logic for DX12
Browse files Browse the repository at this point in the history
  • Loading branch information
exrook committed Dec 28, 2023
1 parent 7f545d5 commit 122f029
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions wgpu-hal/src/dx12/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ impl super::Adapter {
// float32-filterable should always be available on d3d12
features.set(wgt::Features::FLOAT32_FILTERABLE, true);

// DXC lacks support for printf, so only enable it on FXC
// see https://github.com/microsoft/DirectXShaderCompiler/issues/357
features.set(wgt::Features::DEBUG_PRINTF, dxc_container.is_none());

// TODO: Determine if IPresentationManager is supported
let presentation_timer = auxil::dxgi::time::PresentationTimer::new_dxgi();

Expand Down
6 changes: 5 additions & 1 deletion wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,11 @@ impl crate::Device<super::Api> for super::Device {
// FXC doesn't support SM 6.0
None => hlsl::ShaderModel::V5_1,
},
flags: hlsl::WriterFlags::default(),
flags: match self.dxc_container {
// DXC doesn't support printf: https://github.com/microsoft/DirectXShaderCompiler/issues/357
Some(_) => hlsl::WriterFlags::empty(),
None => hlsl::WriterFlags::EMIT_DEBUG_PRINTF,
},
binding_map,
fake_missing_bindings: false,
special_constants_binding,
Expand Down
2 changes: 1 addition & 1 deletion wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ bitflags::bitflags! {
///
/// Supported Platforms:
/// - DX11 (fxc only)
/// - Dx12 (fxc only)
/// - DX12 (fxc only)
/// - Vulkan
/// - OpenGL
///
Expand Down

0 comments on commit 122f029

Please sign in to comment.