DXGL r890 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r889‎ | r890 | r891 >
Date:01:26, 9 January 2019
Author:admin
Status:new
Tags:
Comment:
Redraw surface format test window when contents change in windowed mode.
Attempt to initialize a reference D3D device in software D3D mode (non-DXGL mode).
Modified paths:
  • /dxglcfg/tests.cpp (modified) (history)

Diff [purge]

Index: dxglcfg/tests.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2011 William Feely
 3+// Copyright (C) 2011-2019 William Feely
44
55 // This library is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU Lesser General Public
@@ -557,7 +557,12 @@
558558 if (FAILED(error)) d3dfail = TRUE;
559559 else
560560 {
561 - if(softd3d) error = d3d7->EnumZBufferFormats(IID_IDirect3DRGBDevice, zcallback, &ddpfz);
 561+ if(softd3d)
 562+ {
 563+ error = d3d7->CreateDevice(IID_IDirect3DRefDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
 564+ if(error != D3D_OK)
 565+ error = d3d7->EnumZBufferFormats(IID_IDirect3DRGBDevice, zcallback, &ddpfz);
 566+ }
562567 else error = d3d7->EnumZBufferFormats(IID_IDirect3DHALDevice, zcallback, &ddpfz);
563568 error = ddsrender->GetSurfaceDesc(&ddsd);
564569 ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
@@ -580,7 +585,9 @@
581586 {
582587 if (!softd3d)
583588 {
584 - error = d3d7->CreateDevice(IID_IDirect3DRGBDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
 589+ error = d3d7->CreateDevice(IID_IDirect3DRefDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
 590+ if(error != D3D_OK)
 591+ error = d3d7->CreateDevice(IID_IDirect3DRGBDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
585592 if (error != D3D_OK)
586593 {
587594 d3dfail = TRUE;
@@ -2323,6 +2330,8 @@
23242331 D3DVIEWPORT7 viewport;
23252332 D3DDEVICEDESC7 d3ddevdesc;
23262333 DWORD texwidth, texheight;
 2334+ POINT p;
 2335+ RECT srcrect,destrect;
23272336 errorlocation = 0;
23282337 errornumber = 0;
23292338 if (ddver > 3)
@@ -2621,6 +2630,16 @@
26222631 }
26232632 DrawFormatTestHUD(ddsrender, srcformat, destformat, showhud, testpattern,
26242633 testmethod, ddsd.dwWidth, ddsd.dwHeight, errorlocation, errornumber);
 2634+ if (!fullscreen)
 2635+ {
 2636+ p.x = 0;
 2637+ p.y = 0;
 2638+ ClientToScreen(hWnd, &p);
 2639+ GetClientRect(hWnd, &destrect);
 2640+ OffsetRect(&destrect, p.x, p.y);
 2641+ SetRect(&srcrect, 0, 0, width, height);
 2642+ if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
 2643+ }
26252644 }
26262645
26272646 void RunTestLooped(int test)