I am trying to enumerate through outputs on an adapter in Direct3D but I am getting an Access Violation Reading Location 0x00000000. The error squarely points to my function calling EnumOutputs(). So far I'ved tried to search MSDN, I followed their how to's but I am still getting this error. I am fairly new to Direct3D so I am not sure how to troubleshoot this, any help would be appreciated. This is what I have so far, shown in a concise fashion:
Any help is appreciated.
Thank you.
IDXGIDevice* mpDXGIDevice;
IDXGIAdapter* mpDXGIAdapter;
IDXGIFactory* mpDXGIFactory;
IDXGIOutput* mpDXGIOutput;
mpDXGIDevice = 0;
mpDXGIAdapter = 0;
mpDXGIFactory = 0;
mpDXGIOutput = 0;
//Creating the device
HR(D3D10CreateDevice(
0,
md3dDriverType,
0,
createDeviceFlags,
D3D10_SDK_VERSION,
&md3dDevice));
//Retrieving the factory in order to disable Alt+enter
HR(md3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&mpDXGIDevice));
HR(mpDXGIDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&mpDXGIAdapter));
HR(mpDXGIAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&mpDXGIFactory));
//Creating the swap chain
HR(mpDXGIFactory->CreateSwapChain(
md3dDevice,
&sd,
&mSwapChain));
//Disabling alt+enter
HR(mpDXGIFactory->MakeWindowAssociation(mhMainWnd, DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER));
//Enumerating through Adapters
while(mpDXGIFactory->EnumAdapters(numAdapters, &mpDXGIAdapter) != DXGI_ERROR_NOT_FOUND)
{
if(mpDXGIAdapter->CheckInterfaceSupport(__uuidof(ID3D10Device), NULL) == S_OK)
{
vAdapters.push_back(mpDXGIAdapter);
++numAdapters;
}
}
//Enumerating through outputs to get the total number of outputs
while(mpDXGIAdapter->EnumOutputs(numOutputs, &mpDXGIOutput) != DXGI_ERROR_NOT_FOUND)
{
++numOutputs;
}
ReleaseCOM(mpDXGIDevice);
ReleaseCOM(mpDXGIAdapter);
ReleaseCOM(mpDXGIFactory);
ReleaseCOM(mpDXGIOutput);

New Topic/Question
Reply



MultiQuote



|