Skip to content

Commit

Permalink
Merge branch 'trunk' into remove-rt-undefined-behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Vecvec authored Dec 26, 2024
2 parents d6d61fd + 4772cd8 commit 6dedfb4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
3 changes: 0 additions & 3 deletions wgpu-hal/src/auxil/dxgi/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ pub fn create_factory(
if let Ok(Some(_)) = lib_dxgi.debug_interface1() {
factory_flags |= Dxgi::DXGI_CREATE_FACTORY_DEBUG;
}

// Intercept `OutputDebugString` calls
super::exception::register_exception_handler();
}

let factory4 = match lib_dxgi.create_factory4(factory_flags) {
Expand Down
7 changes: 7 additions & 0 deletions wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ impl super::Device {
library: &Arc<D3D12Lib>,
dxc_container: Option<Arc<shader_compilation::DxcContainer>>,
) -> Result<Self, crate::DeviceError> {
if private_caps
.instance_flags
.contains(wgt::InstanceFlags::VALIDATION)
{
auxil::dxgi::exception::register_exception_handler();
}

let mem_allocator = super::suballocation::create_allocator_wrapper(&raw, memory_hints)?;

let idle_fence: Direct3D12::ID3D12Fence = unsafe {
Expand Down
8 changes: 0 additions & 8 deletions wgpu-hal/src/dx12/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ use windows::{
use super::SurfaceTarget;
use crate::{auxil, dx12::D3D12Lib};

impl Drop for super::Instance {
fn drop(&mut self) {
if self.flags.contains(wgt::InstanceFlags::VALIDATION) {
auxil::dxgi::exception::unregister_exception_handler();
}
}
}

impl crate::Instance for super::Instance {
type A = super::Api;

Expand Down
7 changes: 7 additions & 0 deletions wgpu-hal/src/dx12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,13 @@ pub struct Device {
impl Drop for Device {
fn drop(&mut self) {
self.rtv_pool.lock().free_handle(self.null_rtv_handle);
if self
.private_caps
.instance_flags
.contains(wgt::InstanceFlags::VALIDATION)
{
auxil::dxgi::exception::unregister_exception_handler();
}
}
}

Expand Down

0 comments on commit 6dedfb4

Please sign in to comment.