diff options
| author | Yong He <yonghe@outlook.com> | 2022-01-08 17:07:33 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-08 17:07:33 -0800 |
| commit | 8919c19440dea9a62578905d365fe80bcd58e316 (patch) | |
| tree | 29a19bdff1675d84ea39dafeae9e588404e329ba /tools | |
| parent | f591afd402757ebe847ede5068211e34ac8a5dd1 (diff) | |
Fix random d3d12 crash related to readTextureResource(). (#2075)
* Fix D3D12 random crash.
* Trigger
* Trigger
* Trigger1
* Trigger2
* Trigger3
* Trigger4
* Trigger5
* Trigger6
* Trigger7
* Trigger8
* Trigger9
* Trigger10
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/gfx/d3d12/render-d3d12.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp index 90bfb9bc6..765be5db5 100644 --- a/tools/gfx/d3d12/render-d3d12.cpp +++ b/tools/gfx/d3d12/render-d3d12.cpp @@ -4881,7 +4881,7 @@ Result D3D12Device::captureTextureToSurface( size_t* outRowPitch, size_t* outPixelSize) { - auto resource = resourceImpl->m_resource; + auto& resource = resourceImpl->m_resource; const D3D12_RESOURCE_STATES initialState = D3DUtil::translateResourceState(state); @@ -4986,6 +4986,11 @@ Result D3D12Device::getNativeDeviceHandles(InteropHandles* outHandles) Result D3D12Device::_createDevice(DeviceCheckFlags deviceCheckFlags, const UnownedStringSlice& nameMatch, D3D_FEATURE_LEVEL featureLevel, DeviceInfo& outDeviceInfo) { + if (m_dxDebug && (deviceCheckFlags & DeviceCheckFlag::UseDebug)) + { + m_dxDebug->EnableDebugLayer(); + } + outDeviceInfo.clear(); ComPtr<IDXGIFactory> dxgiFactory; @@ -5014,8 +5019,6 @@ Result D3D12Device::_createDevice(DeviceCheckFlags deviceCheckFlags, const Unown if (m_dxDebug && (deviceCheckFlags & DeviceCheckFlag::UseDebug)) { - m_dxDebug->EnableDebugLayer(); - ComPtr<ID3D12InfoQueue> infoQueue; if (SLANG_SUCCEEDED(device->QueryInterface(infoQueue.writeRef()))) { @@ -5129,7 +5132,8 @@ Result D3D12Device::initialize(const Desc& desc) } #if ENABLE_DEBUG_LAYER - m_D3D12GetDebugInterface = (PFN_D3D12_GET_DEBUG_INTERFACE)loadProc(d3dModule, "D3D12GetDebugInterface"); + m_D3D12GetDebugInterface = + (PFN_D3D12_GET_DEBUG_INTERFACE)loadProc(d3dModule, "D3D12GetDebugInterface"); if (m_D3D12GetDebugInterface) { if (SLANG_SUCCEEDED(m_D3D12GetDebugInterface(IID_PPV_ARGS(m_dxDebug.writeRef())))) @@ -5148,7 +5152,6 @@ Result D3D12Device::initialize(const Desc& desc) debug1->SetEnableGPUBasedValidation(true); } #endif - m_dxDebug->EnableDebugLayer(); } } #endif |
