summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wgpu-hal/src/dx12/device.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/wgpu-hal/src/dx12/device.rs')
-rw-r--r--third_party/rust/wgpu-hal/src/dx12/device.rs33
1 files changed, 23 insertions, 10 deletions
diff --git a/third_party/rust/wgpu-hal/src/dx12/device.rs b/third_party/rust/wgpu-hal/src/dx12/device.rs
index 23bd409dc4..82075294ee 100644
--- a/third_party/rust/wgpu-hal/src/dx12/device.rs
+++ b/third_party/rust/wgpu-hal/src/dx12/device.rs
@@ -218,21 +218,39 @@ impl super::Device {
use naga::back::hlsl;
let stage_bit = crate::auxil::map_naga_stage(naga_stage);
- let module = &stage.module.naga.module;
+
+ let (module, info) = naga::back::pipeline_constants::process_overrides(
+ &stage.module.naga.module,
+ &stage.module.naga.info,
+ stage.constants,
+ )
+ .map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("HLSL: {e:?}")))?;
+
+ let needs_temp_options = stage.zero_initialize_workgroup_memory
+ != layout.naga_options.zero_initialize_workgroup_memory;
+ let mut temp_options;
+ let naga_options = if needs_temp_options {
+ temp_options = layout.naga_options.clone();
+ temp_options.zero_initialize_workgroup_memory = stage.zero_initialize_workgroup_memory;
+ &temp_options
+ } else {
+ &layout.naga_options
+ };
+
//TODO: reuse the writer
let mut source = String::new();
- let mut writer = hlsl::Writer::new(&mut source, &layout.naga_options);
+ let mut writer = hlsl::Writer::new(&mut source, naga_options);
let reflection_info = {
profiling::scope!("naga::back::hlsl::write");
writer
- .write(module, &stage.module.naga.info)
+ .write(&module, &info)
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("HLSL: {e:?}")))?
};
let full_stage = format!(
"{}_{}\0",
naga_stage.to_hlsl_str(),
- layout.naga_options.shader_model.to_str()
+ naga_options.shader_model.to_str()
);
let ep_index = module
@@ -1062,12 +1080,7 @@ impl crate::Device for super::Device {
},
bind_group_infos,
naga_options: hlsl::Options {
- shader_model: match self.dxc_container {
- // DXC
- Some(_) => hlsl::ShaderModel::V6_0,
- // FXC doesn't support SM 6.0
- None => hlsl::ShaderModel::V5_1,
- },
+ shader_model: self.private_caps.shader_model,
binding_map,
fake_missing_bindings: false,
special_constants_binding,