mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
fix(dxgi): DX12 exception handler lifetime based on device not adapter (#6828)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user