Skip to content

Commit

Permalink
WIP: refactor(dx12): remove unused root_signature arg. from `Device…
Browse files Browse the repository at this point in the history
…::create_command_signature`
  • Loading branch information
ErichDonGubler committed Sep 25, 2023
1 parent f39163f commit d60d099
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 5 additions & 5 deletions d3d12/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ impl Device {

pub fn create_command_signature(
&self,
root_signature: RootSignature,
arguments: &[IndirectArgument],
stride: u32,
node_mask: NodeMask,
Expand All @@ -307,7 +306,7 @@ impl Device {
let hr = unsafe {
self.CreateCommandSignature(
&desc,
root_signature.as_mut_ptr(),
std::ptr::null_mut(),
&d3d12::ID3D12CommandSignature::uuidof(),
signature.mut_void(),
)
Expand All @@ -316,14 +315,15 @@ impl Device {
(signature, hr)
}

pub fn create_render_target_view(
pub fn create_render_target_view_from_desc(
&self,
resource: Resource,
desc: &RenderTargetViewDesc,
descriptor: CpuDescriptor,
) {
// A null pResource is used to initialize a null descriptor,
// which guarantees D3D11-like null binding behavior (reading 0s, writes are discarded)
unsafe {
self.CreateRenderTargetView(resource.as_mut_ptr(), &desc.0 as *const _, descriptor);
self.CreateRenderTargetView(std::ptr::null_mut(), &desc.0 as *const _, descriptor);
}
}

Expand Down
8 changes: 1 addition & 7 deletions wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,20 @@ impl super::Device {
cmd_signatures: super::CommandSignatures {
draw: raw
.create_command_signature(
d3d12::RootSignature::null(),
&[d3d12::IndirectArgument::draw()],
mem::size_of::<wgt::DrawIndirectArgs>() as u32,
0,
)
.into_device_result("Command (draw) signature creation")?,
draw_indexed: raw
.create_command_signature(
d3d12::RootSignature::null(),
&[d3d12::IndirectArgument::draw_indexed()],
mem::size_of::<wgt::DrawIndexedIndirectArgs>() as u32,
0,
)
.into_device_result("Command (draw_indexed) signature creation")?,
dispatch: raw
.create_command_signature(
d3d12::RootSignature::null(),
&[d3d12::IndirectArgument::dispatch()],
mem::size_of::<wgt::DispatchIndirectArgs>() as u32,
0,
Expand All @@ -138,10 +135,7 @@ impl super::Device {

let mut rtv_pool = descriptor::CpuPool::new(raw.clone(), d3d12::DescriptorHeapType::Rtv);
let null_rtv_handle = rtv_pool.alloc_handle();
// A null pResource is used to initialize a null descriptor,
// which guarantees D3D11-like null binding behavior (reading 0s, writes are discarded)
raw.create_render_target_view(
d3d12::ComPtr::null(),
raw.create_render_target_view_from_desc(
&d3d12::RenderTargetViewDesc::texture_2d(
winapi::shared::dxgiformat::DXGI_FORMAT_R8G8B8A8_UNORM,
0,
Expand Down

0 comments on commit d60d099

Please sign in to comment.