]> git.cworth.org Git - apitrace-tests/commitdiff
apps/d3d8: Be precise with window size and format.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 7 Dec 2012 10:48:41 +0000 (10:48 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 7 Dec 2012 10:48:41 +0000 (10:48 +0000)
apps/d3d8/tri.cpp
apps/d3d8/tri.ref.txt

index 156d0c5e800d8ded9f252a0dd1a769870d06a887..d0665a682cec9e45a64226dcbc72b6a8466fb70e 100644 (file)
@@ -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;
index e1dae45b85d10cd0beac2ffae9b00654da63f5fe..7a8358c40ca0a3854f62c0e109521b43124b7f5a 100644 (file)
@@ -1,7 +1,7 @@
 Direct3DCreate8(SDKVersion = 220) = <pD3D>
 IDirect3D8::GetDeviceCaps(this = <pD3D>, Adapter = D3DADAPTER_DEFAULT, DeviceType = D3DDEVTYPE_HAL, pCaps = &<Caps>) = D3D_OK
 IDirect3D8::GetAdapterDisplayMode(this = <pD3D>, Adapter = D3DADAPTER_DEFAULT, pMode = &{Width = 1440, Height = 900, RefreshRate = 60, Format = D3DFMT_X8R8G8B8}) = D3D_OK
-IDirect3D8::CreateDevice(this = <pD3D>, Adapter = D3DADAPTER_DEFAULT, DeviceType = D3DDEVTYPE_HAL, hFocusWindow = <hWnd>, BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING, pPresentationParameters = &{BackBufferWidth = 0, BackBufferHeight = 0, BackBufferFormat = D3DFMT_X8R8G8B8, BackBufferCount = 1, MultiSampleType = D3DMULTISAMPLE_NONE, SwapEffect = D3DSWAPEFFECT_DISCARD, hDeviceWindow = <hWnd>, Windowed = TRUE, EnableAutoDepthStencil = FALSE, AutoDepthStencilFormat = D3DFMT_UNKNOWN, Flags = 0x0, FullScreen_RefreshRateInHz = 0, FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT}, ppReturnedDeviceInterface = &<pDevice>) = D3D_OK
+IDirect3D8::CreateDevice(this = <pD3D>, Adapter = D3DADAPTER_DEFAULT, DeviceType = D3DDEVTYPE_HAL, hFocusWindow = <hWnd>, BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING, pPresentationParameters = &{BackBufferWidth = 250, BackBufferHeight = 250, BackBufferFormat = <BackBufferFormat>, BackBufferCount = 1, MultiSampleType = D3DMULTISAMPLE_NONE, SwapEffect = D3DSWAPEFFECT_DISCARD, hDeviceWindow = <hWnd>, Windowed = TRUE, EnableAutoDepthStencil = FALSE, AutoDepthStencilFormat = D3DFMT_UNKNOWN, Flags = 0x0, FullScreen_RefreshRateInHz = 0, FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT}, ppReturnedDeviceInterface = &<pDevice>) = D3D_OK
 IDirect3DDevice8::Clear(this = <pDevice>, Count = 0, pRects = NULL, Flags = D3DCLEAR_TARGET, Color = 0xff4c194c, Z = 1, Stencil = 0) = D3D_OK
 IDirect3DDevice8::BeginScene(this = <pDevice>) = D3D_OK
 IDirect3DDevice8::SetRenderState(this = <pDevice>, State = D3DRS_LIGHTING, Value = FALSE) = D3D_OK