2 Replies - 370 Views - Last Post: 24 January 2012 - 02:26 AM Rate Topic: -----

Topic Sponsor:

#1 RedShift  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-January 12

Trying to enumerate through Outputs(Direct3D)

Posted 23 January 2012 - 04:07 PM

Hey all,
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);



Is This A Good Question/Topic? 0
  • +

Replies To: Trying to enumerate through Outputs(Direct3D)

#2 RedShift  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-January 12

Re: Trying to enumerate through Outputs(Direct3D)

Posted 23 January 2012 - 06:12 PM

After some frustration I got it to work. Nothing to see here. :bananaman:
Was This Post Helpful? 0
  • +
  • -

#3 stayscrisp  Icon User is offline

  • Lets-a play!
  • member icon

Reputation: 800
  • View blog
  • Posts: 3,691
  • Joined: 14-February 08

Re: Trying to enumerate through Outputs(Direct3D)

Posted 24 January 2012 - 02:26 AM

Share your solution for future reference :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1