Skip to content

Commit

Permalink
untested code for amplifications shaders on dx12
Browse files Browse the repository at this point in the history
  • Loading branch information
aclysma committed Aug 4, 2024
1 parent 2ccfb69 commit d1cda12
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions rafx-api/src/backends/dx12/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ impl RafxPipelineDx12 {
let mut hs_bytecode = None;
let mut gs_bytecode = None;
let mut ms_bytecode = None;
let mut as_bytecode = None;

for stage in pipeline_def.shader.dx12_shader().unwrap().stages() {
let module = stage.shader_module.dx12_shader_module().unwrap();
Expand Down Expand Up @@ -343,6 +344,16 @@ impl RafxPipelineDx12 {
module.get_or_compile_bytecode(&stage.reflection.entry_point_name, "ms_6_5")?,
);
}

if stage
.reflection
.shader_stage
.intersects(RafxShaderStageFlags::AMPLIFICATION)
{
as_bytecode = Some(
module.get_or_compile_bytecode(&stage.reflection.entry_point_name, "as_6_5")?,
);
}
}

// can leave everything zero'd out
Expand Down Expand Up @@ -486,6 +497,8 @@ impl RafxPipelineDx12 {

pipeline_stream_object.root_signature.inner =
root_sig_ptr as *const d3d12::ID3D12RootSignature;
pipeline_stream_object.r#as.inner =
as_bytecode.map(|x| *x.bytecode()).unwrap_or_default();
pipeline_stream_object.ms.inner =
ms_bytecode.map(|x| *x.bytecode()).unwrap_or_default();
pipeline_stream_object.ps.inner =
Expand Down
9 changes: 8 additions & 1 deletion rafx-api/src/backends/dx12/root_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,17 @@ impl RafxRootSignatureDx12 {
if !all_used_shader_stage.intersects(RafxShaderStageFlags::FRAGMENT) {
root_signature_flags |= d3d12::D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS;
}

//NOTE: PIX and renderdoc will fail to debug mesh shaders if this flag is enabled
// because they rely on instrumenting the shader and writing resources. This is likely
// fixed as of ~Aug 2024 in renderdoc. But realistically these deny flags only really help
// old hardware anyways.
// if !all_used_shader_stage.intersects(RafxShaderStageFlags::MESH) {
// root_signature_flags |= d3d12::D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS;
// }
// There are other deny flags we could use?
// if !all_used_shader_stage.intersects(RafxShaderStageFlags::AMPLIFICATION) {
// root_signature_flags |= d3d12::D3D12_ROOT_SIGNATURE_FLAG_DENY_AMPLIFICATION_SHADER_ROOT_ACCESS;
// }

//
// Make the root signature
Expand Down

0 comments on commit d1cda12

Please sign in to comment.