So I just recently switched to Visual studio 2013 community edition and I am having trouble creating the device. Code that would work perfectly under VS2012 seems to be very broken in VS2013. On the mp_Device, mp_ImmediateContext and m_FeatureLevel I am having unhandled exceptions of 0xCDCDCDCD. I have included all of the appropriate headers and libs, I also have a GTX 980 so my system is more than capable of DirectX11.
bool D3DRenderSystem::InitializeDevice()
{
// Set the desired target feature levels.
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3
};
HRESULT result = S_OK;
D3D_FEATURE_LEVEL featureLevel;
// Create the D3D11 Device with a hardware driver as well as with desired feature levels.
// This also creates the Immediate Context and sets which feature level we are using.
result = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, featureLevels, 3, D3D11_SDK_VERSION, &mp_Device, &featureLevel, &mp_ImmediateContext);
if (FAILED(result))
return false;
return true;
}
class D3DRenderSystem
{
public:
D3DRenderSystem();
~D3DRenderSystem();
bool InitializeDevice();
bool InitializeSwapChain();
void Shutdown();
void Draw();
ID3D11Device* GetDevice();
private:
ID3D11Device* mp_Device;
ID3D11DeviceContext* mp_ImmediateContext;
ID3D11DepthStencilState* mp_DepthStencilState;
ID3D11DepthStencilView* mp_DepthStencilView;
D3D_FEATURE_LEVEL m_FeatureLevel;
WindowClass* mh_OutputWindow;
};