d3d11/context: fix device creation retries and log error code on failure
Older versions of the Direct3D 11 runtime return an error code from D3D11CreateDevice when they don't recognise one of the requested feature levels. Previously, we'd try to work around those errors by retrying device creation with a smaller set of feature levels, but since we did that regardless of the error code, when device creation failed for reasons other than invalid feature levels, we'd still try creating the device up to 6 times, and we'd never actually log the error code until the last attempt, which might have failed for a different reason. These unnecessary retries could also be especially annoying under Wine, which can log debug messages for every failed attempt. When D3D11CreateDevice fails due to unrecognised feature levels, it returns E_INVALIDARG, so only adjust the feature levels on E_INVALIDARG. When falling back to the WARP driver, log the error code. That way we always know the error code when device creation fails, and we eliminate some unnecessary retries.
Please register or sign in to comment