Right then I'll explain my fix which actually poses another question. Ensure all temporary COM objects are released
the user is happy to use software emulation so make a final attempt at creating the device and swap chain at the desired level using the the user doesn't want to use software emulation - therefore initialisation has failed. Do you want to use software emulation instead? Note: This will be very slow!", "No compatible graphics hardware was detected. after looping through the devices we still couldn't find what we needed, therefore see if the user will use software emulation as a last attempt
if we've reached this point then a compatible graphics device must've been found so break from the loop set the flag to fail and then try again with the next device this device failed to create the devie and swap chain - ensure no handles are left by safely releasing what we were trying to create,
Int error = wcstombs_s(&stringLength, videoCardDescription, 128, adapterDesc.Description, 128) ĭriverType = D3D_DRIVER_TYPE_UNKNOWN // as we're specifying an adapter to use, we must specify that the driver type is unknown!!! step through the adapters until we find a compatible adapter and successfully create a device and swap chainįor(int i = 0 factory->EnumAdapters(i, &adapter) != DXGI_ERROR_NOT_FOUND i++)įailedToCreateDeviceAndSwapChain = false initialise to true, as if there aren't any adapters - then we've failed to create the device and swap chainīool failedToCreateDeviceAndSwapChain = true
SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD Discard the back buffer contents after presenting. Set the scan line ordering and scaling to unspecified. Set the handle for the window to render to. SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT TODO:FLAG - These can be altered to make the rendering match the refresh rate of the hardware Set regular 32-bit surface for the back buffer. Set the width and height of the back buffer. ZeroMemory(&swapChainDesc, sizeof(swapChainDesc)) Initialize the swap chain description. Result = CreateDXGIFactory(_uuidof(IDXGIFactory), (void**)&factory) this will be used to step through the devices to find a DX11 compatible one driverType = D3D_DRIVER_TYPE_REFERENCE a hardware driver is preferred so this is default. As a last ditch if it really can't do it - it'll go for software emulation but let you opt out if you want.
The creation code enumerates through the adapters trying to create everything at feature level 11, if it fails it moves to the next. It just fills out the swap chain description, and creates a DXGI Factory. So.any ideas on why it won't let me build my device and swap chain a feature leve 11?
I've also tried letting DX try and pick the adapter for me by leaving the corresponding argument blank and simply specifying a feature level but it only manages feature level 10.1
Infact I can run all of the DX11 samples in the SDK Sample browser!!! I've also made sure all of my drivers are up to date and still I can't get it build my D3D objects at feature level 11. I've checked the NVidia website and my card is definitly fully DX 11 compatible. On inspection of my device manager under Display Adapters I can see 2 adapters listed - this Intel® HD Graphics Family (that DX 11 seems to be able to find) and my NVIDIA GeForce GT 555M (which DX11 can't seem to find). I extracted the adapters description in the debugger and it says it's an intel graphics family chip. It only returns 1 adapter before returning DXGI_ERROR_NOT_FOUND. I'm developing on a laptop so on these lines, I enumerated through all of the available graphics adapters using an IDXGIFactory and try to set up my D3D objects at feature level 11 on all of them until I succeed. I read somewhere that sometimes, especially on laptops the primary graphcis adapter is a low powered DX10.1 chip and the more powerful DX11 card has to be selected. I'll try and explain everything I've tried and give you a code listing below. It won't build me a context at feature level 11. Now my problem is with the creation of a device and swap chain using, D3D11CreateDeviceAndSwapChain(). Originally my aim was to do deferred shading (the original thread is here), but the code got a little hacky and a long story short, I started again trying to keep things clean and tidy.