设备创建成功后
DXGI_SWAP_CHAIN_DESC sd;
sd.BufferDesc.Width = kClientWidth;
sd.BufferDesc.Height = kClientHeight;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
sd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
// No multisampling.
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.BufferCount = 1;
sd.OutputWindow = static_cast<HWND>(m_CreationParam.wnd);
sd.Windowed = true;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
sd.Flags = 0;
UINT createDeviceFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)
createDeviceFlags |= D3D10_CREATE_DEVICE_DEBUG;
#endif
HRESULT hRes = D3D11CreateDeviceAndSwapChain(
NULL, //default adapter
D3D_DRIVER_TYPE_HARDWARE,
NULL,
createDeviceFlags,
NULL,
NULL,
D3D11_SDK_VERSION,
&sd,
&m_SwapChain,
&m_d3dDevice,
NULL,
&m_d3dDevCon);
if (FAILED(hRes))
{
m_SwapChain = NULL;
m_d3dDevice = NULL;
m_d3dDevCon = NULL;
assert(0 && "Failed to create Device and SwapChain");
}
当我调用 RSGetState 我得到空指针
// Fill state
m_d3dDevCon->RSGetState(&m_RasterState);
m_RasterState->GetDesc(&m_rsDesc);
怎么了?