From eac6f0f39d3cb8e61f7df5dd82618bd9fb9996ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 7 Dec 2012 10:48:41 +0000 Subject: [PATCH] apps/d3d8: Be precise with window size and format. --- apps/d3d8/tri.cpp | 25 ++++++++++++------------- apps/d3d8/tri.ref.txt | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/d3d8/tri.cpp b/apps/d3d8/tri.cpp index 156d0c5..d0665a6 100644 --- a/apps/d3d8/tri.cpp +++ b/apps/d3d8/tri.cpp @@ -100,26 +100,25 @@ int main(int argc, char *argv[]) dwBehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING; } + D3DDISPLAYMODE Mode; + hr = g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &Mode); + if (FAILED(hr)) { + return 1; + } + ZeroMemory(&g_PresentationParameters, sizeof g_PresentationParameters); g_PresentationParameters.Windowed = Windowed; - if (!Windowed) { + if (Windowed) { g_PresentationParameters.BackBufferWidth = WindowWidth; g_PresentationParameters.BackBufferHeight = WindowHeight; + } else { + g_PresentationParameters.BackBufferWidth = Mode.Width; + g_PresentationParameters.BackBufferHeight = Mode.Height; } + g_PresentationParameters.BackBufferFormat = Mode.Format; g_PresentationParameters.BackBufferCount = 1; g_PresentationParameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - if (Windowed) { - // Must matche the format of the current display mode - D3DDISPLAYMODE Mode; - hr = g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &Mode); - if (FAILED(hr)) { - g_pD3D->Release(); - g_pD3D = NULL; - return 1; - } - g_PresentationParameters.BackBufferFormat = Mode.Format; - } else { - g_PresentationParameters.BackBufferFormat = D3DFMT_X8R8G8B8; + if (!Windowed) { g_PresentationParameters.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; } g_PresentationParameters.hDeviceWindow = hWnd; diff --git a/apps/d3d8/tri.ref.txt b/apps/d3d8/tri.ref.txt index e1dae45..7a8358c 100644 --- a/apps/d3d8/tri.ref.txt +++ b/apps/d3d8/tri.ref.txt @@ -1,7 +1,7 @@ Direct3DCreate8(SDKVersion = 220) = IDirect3D8::GetDeviceCaps(this = , Adapter = D3DADAPTER_DEFAULT, DeviceType = D3DDEVTYPE_HAL, pCaps = &) = D3D_OK IDirect3D8::GetAdapterDisplayMode(this = , Adapter = D3DADAPTER_DEFAULT, pMode = &{Width = 1440, Height = 900, RefreshRate = 60, Format = D3DFMT_X8R8G8B8}) = D3D_OK -IDirect3D8::CreateDevice(this = , Adapter = D3DADAPTER_DEFAULT, DeviceType = D3DDEVTYPE_HAL, hFocusWindow = , BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING, pPresentationParameters = &{BackBufferWidth = 0, BackBufferHeight = 0, BackBufferFormat = D3DFMT_X8R8G8B8, BackBufferCount = 1, MultiSampleType = D3DMULTISAMPLE_NONE, SwapEffect = D3DSWAPEFFECT_DISCARD, hDeviceWindow = , Windowed = TRUE, EnableAutoDepthStencil = FALSE, AutoDepthStencilFormat = D3DFMT_UNKNOWN, Flags = 0x0, FullScreen_RefreshRateInHz = 0, FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT}, ppReturnedDeviceInterface = &) = D3D_OK +IDirect3D8::CreateDevice(this = , Adapter = D3DADAPTER_DEFAULT, DeviceType = D3DDEVTYPE_HAL, hFocusWindow = , BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING, pPresentationParameters = &{BackBufferWidth = 250, BackBufferHeight = 250, BackBufferFormat = , BackBufferCount = 1, MultiSampleType = D3DMULTISAMPLE_NONE, SwapEffect = D3DSWAPEFFECT_DISCARD, hDeviceWindow = , Windowed = TRUE, EnableAutoDepthStencil = FALSE, AutoDepthStencilFormat = D3DFMT_UNKNOWN, Flags = 0x0, FullScreen_RefreshRateInHz = 0, FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT}, ppReturnedDeviceInterface = &) = D3D_OK IDirect3DDevice8::Clear(this = , Count = 0, pRects = NULL, Flags = D3DCLEAR_TARGET, Color = 0xff4c194c, Z = 1, Stencil = 0) = D3D_OK IDirect3DDevice8::BeginScene(this = ) = D3D_OK IDirect3DDevice8::SetRenderState(this = , State = D3DRS_LIGHTING, Value = FALSE) = D3D_OK -- 2.43.0