]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_wgl.c
remove two unused vars
[xonotic/darkplaces.git] / vid_wgl.c
index 832ceb05466ee099989d552b5f7c216044251257..7b3e095f9707caa9c019c09a039a3781c4f81f5a 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -284,7 +284,7 @@ void VID_Finish (void)
 #ifdef SUPPORTD3D
        if (vid_d3d9dev)
        {
-               DWORD d;
+               HRESULT hr;
                if (vid_begunscene)
                {
                        IDirect3DDevice9_EndScene(vid_d3d9dev);
@@ -292,25 +292,39 @@ void VID_Finish (void)
                }
                if (vid_reallyhidden)
                        return;
-               d = IDirect3DDevice9_TestCooperativeLevel(vid_d3d9dev);
-               switch(d)
+               if (!vid_d3ddevicelost)
                {
-               case D3DERR_DEVICELOST:
-                       vid_d3ddevicelost = true;
-                       vid_hidden = true;
-                       Sleep(100);
-                       break;
-               case D3DERR_DEVICENOTRESET:
-                       vid_d3ddevicelost = false;
-                       vid_hidden = vid_reallyhidden;
-                       R_Modules_DeviceLost();
-                       IDirect3DDevice9_Reset(vid_d3d9dev, &vid_d3dpresentparameters);
-                       R_Modules_DeviceRestored();
-                       break;
-               case D3D_OK:
                        vid_hidden = vid_reallyhidden;
-                       IDirect3DDevice9_Present(vid_d3d9dev, NULL, NULL, NULL, NULL);
-                       break;
+                       hr = IDirect3DDevice9_Present(vid_d3d9dev, NULL, NULL, NULL, NULL);
+                       if (hr == D3DERR_DEVICELOST)
+                       {
+                               vid_d3ddevicelost = true;
+                               vid_hidden = true;
+                               Sleep(100);
+                       }
+               }
+               else
+               {
+                       hr = IDirect3DDevice9_TestCooperativeLevel(vid_d3d9dev);
+                       switch(hr)
+                       {
+                       case D3DERR_DEVICELOST:
+                               vid_d3ddevicelost = true;
+                               vid_hidden = true;
+                               Sleep(100);
+                               break;
+                       case D3DERR_DEVICENOTRESET:
+                               vid_d3ddevicelost = false;
+                               vid_hidden = vid_reallyhidden;
+                               R_Modules_DeviceLost();
+                               IDirect3DDevice9_Reset(vid_d3d9dev, &vid_d3dpresentparameters);
+                               R_Modules_DeviceRestored();
+                               break;
+                       case D3D_OK:
+                               vid_hidden = vid_reallyhidden;
+                               IDirect3DDevice9_Present(vid_d3d9dev, NULL, NULL, NULL, NULL);
+                               break;
+                       }
                }
                if (!vid_begunscene && !vid_hidden)
                {
@@ -1365,7 +1379,6 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version)
        int deviceindex;
        RECT rect;
        MSG msg;
-       int pixelformat, newpixelformat;
        DWORD WindowStyle, ExWindowStyle;
        int CenterX, CenterY;
        int bpp = mode->bitsperpixel;
@@ -1419,8 +1432,6 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version)
        rect.top += CenterY;
        rect.bottom += CenterY;
 
-       pixelformat = 0;
-       newpixelformat = 0;
        gl_extensions = "";
        gl_platformextensions = "";
 
@@ -1444,7 +1455,8 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version)
        for (deviceindex = 0;deviceindex < numdevices && !vid_d3d9dev;deviceindex++)
        {
                memset(&vid_d3dpresentparameters, 0, sizeof(vid_d3dpresentparameters));
-               vid_d3dpresentparameters.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;
+//             vid_d3dpresentparameters.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;
+               vid_d3dpresentparameters.Flags = 0;
                vid_d3dpresentparameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
                vid_d3dpresentparameters.hDeviceWindow = mainwindow;
                vid_d3dpresentparameters.BackBufferWidth = width;
@@ -1523,7 +1535,7 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version)
 
        CHECKGLERROR
 
-       vid.forcevbo = true;
+       vid.forcevbo = false;
        vid.support.arb_depth_texture = true;
        vid.support.arb_draw_buffers = vid_d3d9caps.NumSimultaneousRTs > 1;
        vid.support.arb_occlusion_query = true; // can't find a cap for this