diff --git a/d3d12/src/device.rs b/d3d12/src/device.rs index 43781c933b..96d6866ad8 100644 --- a/d3d12/src/device.rs +++ b/d3d12/src/device.rs @@ -315,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); } } diff --git a/wgpu-hal/src/dx12/device.rs b/wgpu-hal/src/dx12/device.rs index 7dfb3e3abb..86c0fc0cec 100644 --- a/wgpu-hal/src/dx12/device.rs +++ b/wgpu-hal/src/dx12/device.rs @@ -135,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,