So I've got a quite interesting problem that only happens on my laptop. I have a window with the following WNDCLASSEX struct specifed:
m_Desc.hInstance = (HINSTANCE)GetModuleHandle(0); m_Desc.lpfnWndProc = stdWinProc; m_Desc.cbClsExtra = 0; m_Desc.cbWndExtra = 0; m_Desc.hbrBackground = RE_WINDOW_BACKGROUND_COLOR_DARKGRAY; m_Desc.hCursor = RE_CURSOR_STANDARD; m_Desc.hIcon = RE_ICON_STANDARD; m_Desc.hIconSm = 0; m_Desc.cbSize = sizeof(WNDCLASSEX); m_Desc.style = CS_HREDRAW | CS_VREDRAW; m_Desc.lpszClassName = L"DefWndClass"; m_Desc.lpszMenuName = 0;
And I have a swapchain that have the following struct:
DXGI_SWAP_CHAIN_DESC swapChainDesc; swapChainDesc.BufferCount = 1; swapChainDesc.BufferDesc.Format = format; swapChainDesc.BufferDesc.Height = height; swapChainDesc.BufferDesc.Width = width; swapChainDesc.BufferDesc.RefreshRate = mode.RefreshRate; swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; swapChainDesc.OutputWindow = (HWND)windowHandle; swapChainDesc.SampleDesc.Count = 1; swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapChainDesc.Windowed = true;
I then bind and clear the rendertarget- and depthstencilview that is created for swapchain. And I do get the expected result as long as I don't resize my window. If I do the only thing that is displayed is the background that is specified in the WNDCLASSEX struct. I have had this problem before but haven't been able to really solve it. If I resize the buffers when I repond to the WM_SIZE message it works, but I want the buffers that are getting rendered to depend on the application's settings, like when you set the settings within the game for example. Or is the best practise to always resize the swapchain's buffers when the window gets resized and have I seperate rendertarget that I render my scene to, and then render that onto a quad to the buffers in the swapchain? And why do I not get the same results on my laptop and stationary computer? They are both nvidia and intelbased with the latest drivers so it should result in the same result right?
Would be nice if someone could shed some light on this, because I haven't been able to find any relevant information about this.