我最近尝试设置 Visual Studio 2022 以在我的新笔记本电脑上开发 DirectX 11 应用程序。我将一些 DirectX 解决方案从旧机器复制到新机器上,它们都运行良好,除了当我尝试使用 Visual Studio 图形诊断来调试它们时。
每当我尝试使用图形调试器调试应用程序时,它都会工作一段时间,直到出现来自
D3D12Core.dll
的访问冲突异常。
在 DummyVSGD.exe 中的 0x00007FFD83745D20 (D3D12Core.dll) 处抛出异常:0xC0000005:读取位置 0xFFFFFFFFFFFFFFFF 时发生访问冲突。
我已经尝试卸载并重新安装图形诊断组件 - 没有任何变化。
打开“异常设置 -> C++ 异常 ->
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x0000002419FFFB10.
我在英特尔论坛上发现了this论坛帖子,讨论了将 Iris Xe 与 DirectX 结合使用的困难,因此我将默认 GPU 设置为 NVIDIA GeForce RTX 3060 笔记本电脑 GPU,但是没有任何变化。
我也很困惑为什么当图形调试器本身不再支持 D3D12 时诊断程序会使用 D3D12 dll?
我正在使用
Microsoft Visual Studio Community 2022(64 位)- 版本 17.6.5
CPU:第12代Intel(R) Core(TM) i5-12500H
GPU 0:英特尔(R) Iris(R) Xe 显卡
GPU 1:NVIDIA GeForce RTX 3060 笔记本电脑 GPU
调试输出:
...
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFA20.
The thread 0xd84 has exited with code 0 (0x0).
'DummyVSGD.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_ec5e4cdfcd3a62b8\igdinfo64.dll'
'DummyVSGD.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_ec5e4cdfcd3a62b8\igd11dxva64.dll'
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FFC50.
The thread 0x68dc has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFDE0.
The thread 0x5448 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FFC00.
The thread 0x2ab8 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFB50.
The thread 0x54a0 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FFAA0.
The thread 0x1df8 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFA30.
The thread 0x3054 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FF870.
The thread 0x7140 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFB50.
The thread 0x257c has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FF800.
The thread 0x2764 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFD70.
The thread 0x5e3c has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FFC40.
The thread 0x36cc has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFA20.
The thread 0x35d0 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FFBF0.
The thread 0x5f90 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FFE10.
The thread 0x3550 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FFE10.
The thread 0x1154 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF5FF690.
The thread 0x23b8 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDCC254B2C in DummyVSGD.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000081EF4FF6F0.
The thread 0x2e6c has exited with code 0 (0x0).
...
'DummyVSGD.exe' (Win32): Loaded 'C:\Windows\System32\d3d9.dll'.
'DummyVSGD.exe' (Win32): Loaded 'C:\Windows\System32\d3d9on12.dll'.
Exception thrown at 0x00007FFD83745D20 (D3D12Core.dll) in DummyVSGD.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
The program '[11472] DummyVSGD.exe' has exited with code 0 (0x0).
堆栈:
D3D12Core.dll!Unknown::QueryInterface<struct IDXGIAdapter>(struct IDXGIAdapter * *)
D3D12Core.dll!D3D12ValidateAndCreateDevice()
D3D12.dll!00007ffdc41a6a4d()
DXCaptureReplay.dll!00007ffd239384b6()
DXCaptureReplay.dll!00007ffd23a055d6()
DXCaptureReplay.dll!00007ffd23a4c09f()
DXCaptureReplay.dll!00007ffd23a4c26d()
DXCaptureReplay.dll!00007ffd23991dcd()
D3D12.dll!00007ffdc41a668e()
d3d90n12.dll!00007ffda701b960()
d3d90n12.dll!00007ffda7095a2b()
d3d9.dll!00007ffdbb0123eb()
d3d9.dll!00007ffdbafc3853()
d3d9.dll!00007ffdbafc2acd()
d3d9.dll!00007ffdbafc569a()
d3d9.dll!00007ffdbafd62ac()
d3d9.dll!00007ffdbafd5ed8()
d3d9.dll!00007ffdbafec43e()
dxdiagn.dll!00007ffd3a23d75d()
dxdiagn.dll!00007ffd3a21ff30()
dxdiagn.dll!00007ffd3a2051ae()
dxdiagn.dll!00007ffd3a20a88f()
dxdiagn.dll!00007ffd3a20a54a()
VsGraphicsExperiment.dll!00007ffd3b219587()
VsGraphicsExperiment.dll!00007ffd3b1fce1a()
VsGraphicsExperiment.dll!00007ffd3b1fcefd()
ntdll.dll!00007ffdceadca01()
ntdll.dll!00007ffdceac5976()
kernel32.dll!00007ffdcd7026ad()
ntdll.dll!00007ffdceaeaa68()
DummyVSGD.cpp:
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <d3d11.h>
#include <exception>
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "dxgi.lib")
#define WIDTH 480
#define HEIGHT 360
HWND hwnd = nullptr; // Handle to instance of the window
ID3D11Device *device = nullptr;
ID3D11DeviceContext *deviceContext = nullptr;
inline void ThrowIfFailed(HRESULT hr)
{
if (FAILED(hr))
{
throw std::exception();
}
}
bool InitializeDirect3d11App(HINSTANCE hInstance)
{
// Create DXGI factory to enumerate adapters
IDXGIFactory1* DXGIFactory;
ThrowIfFailed(CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&DXGIFactory));
// Use the first adapter
IDXGIAdapter1* Adapter;
ThrowIfFailed(DXGIFactory->EnumAdapters1(0, &Adapter));
DXGIFactory->Release();
//Create our Direct3D 11 Device
ThrowIfFailed(D3D11CreateDevice(Adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_DEBUG, nullptr, 0, D3D11_SDK_VERSION, &device, nullptr, &deviceContext));
//Release the Adapter interface
Adapter->Release();
return true;
}
// Main message handler for the sample.
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
// Handle any messages the switch statement didn't.
return DefWindowProc(hWnd, message, wParam, lParam);
}
_Use_decl_annotations_
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow)
{
// Initialize the window class.
WNDCLASSEX windowClass = { 0 };
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = WindowProc;
windowClass.hInstance = hInstance;
windowClass.hCursor = LoadCursor(nullptr, IDC_ARROW);
windowClass.lpszClassName = L"DXSampleClass";
RegisterClassEx(&windowClass);
RECT windowRect = { 0, 0, WIDTH, HEIGHT };
AdjustWindowRect(&windowRect, WS_OVERLAPPEDWINDOW, FALSE);
// Create the window and store a handle to it.
hwnd = CreateWindow(
windowClass.lpszClassName,
L"Title",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
windowRect.right - windowRect.left,
windowRect.bottom - windowRect.top,
nullptr, // We have no parent window.
nullptr, // We aren't using menus.
hInstance,
nullptr); // Additional data.
// Initialize D3D11
if (!InitializeDirect3d11App(hInstance)) //Initialize Direct3D
{
MessageBox(0, L"Direct3D Initialization - Failed",
L"Error", MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
// Main sample loop.
MSG msg = {};
while (msg.message != WM_QUIT)
{
// Process any messages in the queue.
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
DestroyWindow(hwnd);
// Return this part of the WM_QUIT message to Windows.
return static_cast<char>(msg.wParam);
}
如有任何帮助,我们将不胜感激,谢谢!
您解决这个问题了吗?我遇到过这个问题。我发现任何对 GRFXTool::CCompatibilityMode::_D3D12CreateDevice 的调用都会导致崩溃。调用堆栈:
D3D12Core.dll!00007ff882b55d20() Unknown
D3D12Core.dll!00007ff882b723a2() Unknown
D3D12.dll!00007ff8b65a6c5b() Unknown
DXCaptureReplay.dll!GRFXTool::CCompatibilityMode::_D3D12CreateDevice(long &,long (*)(struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *),struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureCall::Call__D3D12CreateDevice(class GRFXTool::CaptureToolLayer *,struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureWrapper::D3D12CreateDeviceRealGenerated(class GRFXTool::CaptureToolLayer *,struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureWrapper::D3D12CreateDeviceWrapGenerated(void *,struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureWrapper::D3D12CreateDeviceGenerated(struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
D3D12.dll!00007ff8b65a662e() Unknown
d3d9on12.dll!00007ff8911e4ae0() Unknown
d3d9on12.dll!00007ff89125df7b() Unknown
d3d9.dll!CreateDeviceLHDDI() Unknown
d3d9.dll!D3D9CreateDirectDrawObject() Unknown
d3d9.dll!FetchDirectDrawData() Unknown
d3d9.dll!InternalDirectDrawCreate() Unknown
d3d9.dll!CEnum::CEnum() Unknown
d3d9.dll!Direct3DCreate9Impl() Unknown
d3d9.dll!Direct3DCreate9() Unknown
qwindowsd.dll!QDirect3D9Handle::QDirect3D9Handle() Line 109 C++
qwindowsd.dll!GpuDescription::detect() Line 129 C++
qwindowsd.dll!QWindowsWindow::forcedScreenForGLWindow(const QWindow * w) Line 1570 C++
qwindowsd.dll!calcPosition(const QWindow * w, const QSharedPointer<QWindowCreationContext> & context, const QMargins & invMargins) Line 566 C++
qwindowsd.dll!WindowCreationData::create(const QWindow * w, const QWindowsWindowData & data, QString title) Line 795 C++
qwindowsd.dll!QWindowsWindowData::create(const QWindow * w, const QWindowsWindowData & parameters, const QString & title) Line 1608 C++
qwindowsd.dll!QWindowsIntegration::createPlatformWindow(QWindow * window) Line 375 C++
Qt6Guid.dll!QWindowPrivate::create(bool recursive, unsigned __int64 nativeHandle) Line 548 C++
Qt6Guid.dll!QWindow::create() Line 679 C++
Qt6Widgetsd.dll!QWidgetPrivate::create() Line 1315 C++
Qt6Widgetsd.dll!QWidget::create(unsigned __int64 window, bool initializeWindow, bool destroyOldWindow) Line 1180 C++
Qt6Widgetsd.dll!QWidget::setWindowState(QFlags<enum Qt::WindowState> newstate) Line 2946 C++
当我注释所有 QWinWidget 代码时会发生这种情况:
> D3D12Core.dll!00007ff882b55d20() Unknown
D3D12Core.dll!00007ff882b723a2() Unknown
D3D12.dll!00007ff8b65a6c5b() Unknown
DXCaptureReplay.dll!GRFXTool::CCompatibilityMode::_D3D12CreateDevice(long &,long (*)(struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *),struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureCall::Call__D3D12CreateDevice(class GRFXTool::CaptureToolLayer *,struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureWrapper::D3D12CreateDeviceRealGenerated(class GRFXTool::CaptureToolLayer *,struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureWrapper::D3D12CreateDeviceWrapGenerated(void *,struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
DXCaptureReplay.dll!GRFXTool::GeneratedCaptureWrapper::D3D12CreateDeviceGenerated(struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *) Unknown
D3D12.dll!00007ff8b65a662e() Unknown
d3d9on12.dll!00007ff8911e4ae0() Unknown
d3d9on12.dll!00007ff89125df7b() Unknown
d3d9.dll!CreateDeviceLHDDI() Unknown
d3d9.dll!D3D9CreateDirectDrawObject() Unknown
d3d9.dll!FetchDirectDrawData() Unknown
d3d9.dll!InternalDirectDrawCreate() Unknown
d3d9.dll!CEnum::CEnum() Unknown
d3d9.dll!Direct3DCreate9Impl() Unknown
d3d9.dll!Direct3DCreate9() Unknown
dxdiagn.dll!InitD3D9(void) Unknown
dxdiagn.dll!GetExtraDisplayInfo(int,class DisplayInfo *) Unknown
dxdiagn.dll!CDxDiagProvider::ExecMethod(unsigned short const *,struct tagVARIANT *) Unknown
dxdiagn.dll!CDxDiagProvider::GetChildContainerHelper(class CDxDiagClassObject *,class std::vector<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > > &,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &) Unknown
dxdiagn.dll!GetChildContainer(class CDxDiagProvider &,class CSmartStrTemplate<unsigned short,64> &,unsigned short const *,struct IDxDiagContainer * *) Unknown
VsGraphicsExperiment.dll!CSystemInfo::GatherDisplayInfo(void) Unknown
VsGraphicsExperiment.dll!GatherSystemInfo_Protected(class CSystemInfo *,struct DXSerialization::IDXSerializationSession *) Unknown
VsGraphicsExperiment.dll!GatherSystemInfo(void *) Unknown
ntdll.dll!RtlpTpWorkCallback() Unknown
ntdll.dll!TppWorkerThread() Unknown
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown