From 3e88f3dc63de37186dc97c474e2a01c3f8cac9db Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 27 Jul 2021 01:28:56 -0400 Subject: [PATCH] Setting root constants --- src/command_list.rs | 22 ++++++++++++++++++++++ src/descriptor.rs | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/command_list.rs b/src/command_list.rs index 3209d6948a..c426d95490 100644 --- a/src/command_list.rs +++ b/src/command_list.rs @@ -335,6 +335,17 @@ impl GraphicsCommandList { } } + pub fn set_compute_root_constant( + &self, + root_index: RootIndex, + value: u32, + dest_offset_words: u32, + ) { + unsafe { + self.SetComputeRoot32BitConstant(root_index, value, dest_offset_words); + } + } + pub fn set_graphics_root_descriptor_table( &self, root_index: RootIndex, @@ -375,6 +386,17 @@ impl GraphicsCommandList { } } + pub fn set_graphics_root_constant( + &self, + root_index: RootIndex, + value: u32, + dest_offset_words: u32, + ) { + unsafe { + self.SetGraphicsRoot32BitConstant(root_index, value, dest_offset_words); + } + } + pub fn resource_barrier(&self, barriers: &[ResourceBarrier]) { unsafe { self.ResourceBarrier(barriers.len() as _, barriers.as_ptr() as _) // matches representation diff --git a/src/descriptor.rs b/src/descriptor.rs index 393f943918..bfa0204127 100644 --- a/src/descriptor.rs +++ b/src/descriptor.rs @@ -120,7 +120,8 @@ impl RootParameter { RootParameter(param) } - fn descriptor( + //TODO: should this be unsafe? + pub fn descriptor( ty: d3d12::D3D12_ROOT_PARAMETER_TYPE, visibility: ShaderVisibility, binding: Binding,