First off, some background. The thing that strikes me as odd, specifically, is the fact that I had this program working prior to this moment. It did exactly what it was supposed to with no crash. Then it started crashing numerous times in a row, so I restarted my computer, but the problem still continues.
I'm using SDL to create the window, then I retrieve the platform-specific information so that I can use the necessary
HWND (window handle) that DX10 needs for the swap chain description.
Since it does matter, here is the swap chain description initialization:
[source="cpp"]
DXGI_SWAP_CHAIN_DESC scd;
scd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
scd.OutputWindow = sdlMgr->getWindowHandle();
scd.Windowed = TRUE;
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
scd.BufferDesc.Width = 640;
scd.BufferDesc.Height = 480;
scd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
scd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
scd.BufferDesc.RefreshRate.Numerator = 60;
scd.BufferDesc.RefreshRate.Denominator = 1;
scd.SampleDesc.Count = 1;
scd.SampleDesc.Quality = 0;
scd.Flags = 0;
Pretty standard, as you can probably see. Now the real problem comes when creating the device and swap chain with
D3D10CreateDeviceAndSwapChain. Here's the code for that:
[source="cpp"]
if( FAILED( hr = D3D10CreateDeviceAndSwapChain(
NULL,
D3D10_DRIVER_TYPE_HARDWARE,
NULL,
0,
D3D10_SDK_VERSION,
&scd,
&g_SwapChain,
&g_Device ) ) )
{
Now in the block of code that comes after that, I check all the possible values (according to documentation) that
D3D10CreateDeviceAndSwapChain can return.
Here's the full list: D3D10_ERROR_FILE_NOT_FOUND, D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS, D3DERR_INVALIDCALL, D3DERR_WASSTILLDRAWING, E_FAIL, E_INVALIDARG, E_OUTOFMEMORY, S_FALSE, S_OK.
In my switch statement, I included a
default clause as well. The result of
D3D10CreateDeviceAndSwapChain always goes to
default, meaning an unrecognized error. So the only possible thing I can think of is the fact that there must be some kind of error value that isn't documented in the DX10 documentation.
By the way, here's the hexadecimal equivalent of the
HRESULT that is returned: 0x887A0001
Denzel Morris (@drdizzy) :: Software Engineer :: SkyTech Enterprises, Inc.
"When men are most sure and arrogant they are commonly most mistaken, giving views to passion without that proper deliberation which alone can secure them from the grossest absurdities." - David Hume