DXGL r429 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r428‎ | r429 | r430 >
Date:19:11, 13 April 2014
Author:admin
Status:new
Tags:
Comment:
Move DDDEVICEIDENTIFIER2 structure to glDirectDraw7 class.
Move D3DDEVICEDESC7 and D3DDEVICEDESC structures to glDirec3D and glDirect3DDevice classes.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/glDirect3D.h (modified) (history)
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDraw.h (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -29,7 +29,7 @@
3030 #include "glDirect3DMaterial.h"
3131 #include "glDirect3DLight.h"
3232
33 -const D3DDEVICEDESC7 d3ddesc =
 33+const D3DDEVICEDESC7 d3ddesc_default =
3434 {
3535 D3DDEVCAPS_CANBLTSYSTONONLOCAL | D3DDEVCAPS_CANRENDERAFTERFLIP | D3DDEVCAPS_DRAWPRIMTLVERTEX |
3636 D3DDEVCAPS_FLOATTLVERTEX | D3DDEVCAPS_TEXTURENONLOCALVIDMEM | D3DDEVCAPS_TEXTURESYSTEMMEMORY |
@@ -127,7 +127,7 @@
128128 0,0,0,0 //dwReserved1 through dwReserved4
129129 };
130130
131 -const D3DDEVICEDESC d3ddesc3 =
 131+const D3DDEVICEDESC d3ddesc3_default =
132132 {
133133 sizeof(D3DDEVICEDESC), // dwSize
134134 D3DDD_BCLIPPING|D3DDD_COLORMODEL|D3DDD_DEVCAPS|D3DDD_DEVICERENDERBITDEPTH|
@@ -134,7 +134,7 @@
135135 D3DDD_DEVICEZBUFFERBITDEPTH|D3DDD_LIGHTINGCAPS|D3DDD_LINECAPS|D3DDD_MAXBUFFERSIZE|
136136 D3DDD_MAXVERTEXCOUNT|D3DDD_TRANSFORMCAPS|D3DDD_TRICAPS, // dwFlags
137137 D3DCOLOR_RGB, // dcmColorModel
138 - d3ddesc.dwDevCaps,
 138+ d3ddesc_default.dwDevCaps,
139139 { //dtcTransformCaps
140140 sizeof(D3DTRANSFORMCAPS), //dwSize
141141 0 // dwCaps
@@ -146,33 +146,33 @@
147147 D3DLIGHTINGMODEL_RGB, // dwLightingModel
148148 8 //dwNumLights
149149 },
150 - d3ddesc.dpcLineCaps,
151 - d3ddesc.dpcTriCaps,
152 - d3ddesc.dwDeviceRenderBitDepth,
153 - d3ddesc.dwDeviceZBufferBitDepth,
 150+ d3ddesc_default.dpcLineCaps,
 151+ d3ddesc_default.dpcTriCaps,
 152+ d3ddesc_default.dwDeviceRenderBitDepth,
 153+ d3ddesc_default.dwDeviceZBufferBitDepth,
154154 0, // dwMaxBufferSize
155155 65536, // dwMaxVertexCount
156 - d3ddesc.dwMinTextureWidth,
157 - d3ddesc.dwMinTextureHeight,
158 - d3ddesc.dwMaxTextureWidth,
159 - d3ddesc.dwMaxTextureHeight,
 156+ d3ddesc_default.dwMinTextureWidth,
 157+ d3ddesc_default.dwMinTextureHeight,
 158+ d3ddesc_default.dwMaxTextureWidth,
 159+ d3ddesc_default.dwMaxTextureHeight,
160160 0, // dwMinStippleWidth
161161 32, // dwMaxStippleWidth
162162 0, // dwMinStippleHeight
163163 32, // dwMaxStippleHeight
164 - d3ddesc.dwMaxTextureRepeat,
165 - d3ddesc.dwMaxTextureAspectRatio,
166 - d3ddesc.dwMaxAnisotropy,
167 - d3ddesc.dvGuardBandLeft,
168 - d3ddesc.dvGuardBandTop,
169 - d3ddesc.dvGuardBandRight,
170 - d3ddesc.dvGuardBandBottom,
171 - d3ddesc.dvExtentsAdjust,
172 - d3ddesc.dwStencilCaps,
173 - d3ddesc.dwFVFCaps,
174 - d3ddesc.dwTextureOpCaps,
175 - d3ddesc.wMaxTextureBlendStages,
176 - d3ddesc.wMaxSimultaneousTextures
 164+ d3ddesc_default.dwMaxTextureRepeat,
 165+ d3ddesc_default.dwMaxTextureAspectRatio,
 166+ d3ddesc_default.dwMaxAnisotropy,
 167+ d3ddesc_default.dvGuardBandLeft,
 168+ d3ddesc_default.dvGuardBandTop,
 169+ d3ddesc_default.dvGuardBandRight,
 170+ d3ddesc_default.dvGuardBandBottom,
 171+ d3ddesc_default.dvExtentsAdjust,
 172+ d3ddesc_default.dwStencilCaps,
 173+ d3ddesc_default.dwFVFCaps,
 174+ d3ddesc_default.dwTextureOpCaps,
 175+ d3ddesc_default.wMaxTextureBlendStages,
 176+ d3ddesc_default.wMaxSimultaneousTextures
177177 };
178178
179179 struct D3DDevice
@@ -198,6 +198,8 @@
199199 glDirect3D7::glDirect3D7()
200200 {
201201 TRACE_ENTER(1,14,this);
 202+ d3ddesc = d3ddesc_default;
 203+ d3ddesc3 = d3ddesc3_default;
202204 refcount=1;
203205 glD3D3 = NULL;
204206 glD3D2 = NULL;
Index: ddraw/glDirect3D.h
@@ -19,8 +19,8 @@
2020 #ifndef __GLDIRECT3D_H
2121 #define __GLDIRECT3D_H
2222
23 -extern const D3DDEVICEDESC7 d3ddesc;
24 -extern const D3DDEVICEDESC d3ddesc3;
 23+extern const D3DDEVICEDESC7 d3ddesc_default;
 24+extern const D3DDEVICEDESC d3ddesc3_default;
2525 class glDirectDraw7;
2626
2727 class glDirect3D3;
@@ -49,6 +49,8 @@
5050 glDirect3D1 *glD3D1;
5151 private:
5252 ULONG refcount;
 53+ D3DDEVICEDESC7 d3ddesc;
 54+ D3DDEVICEDESC d3ddesc3;
5355 };
5456
5557 class glDirect3D3 : public IDirect3D3
Index: ddraw/glDirect3DDevice.cpp
@@ -74,8 +74,6 @@
7575 DWORD dwMinStippleHeight,dwMaxStippleHeight;
7676 } D3DDEVICEDESC2,*LPD3DDEVICEDESC2;
7777
78 -extern const D3DDEVICEDESC7 d3ddesc;
79 -
8078 const DWORD renderstate_default[153] = {0, // 0
8179 NULL, //texturehandle
8280 D3DANTIALIAS_NONE, //antialias
@@ -276,8 +274,8 @@
277275 glDirect3DDevice7::glDirect3DDevice7(REFCLSID rclsid, glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
278276 {
279277 TRACE_ENTER(4,14,this,24,&rclsid,14,glD3D7,14,glDDS7);
280 - memcpy(&d3ddesc, &::d3ddesc, sizeof(D3DDEVICEDESC));
281 - memcpy(&d3ddesc3, &::d3ddesc3, sizeof(D3DDEVICEDESC));
 278+ d3ddesc = d3ddesc_default;
 279+ d3ddesc3 = d3ddesc3_default;
282280 int zbuffer = 0;
283281 glD3DDev3 = NULL;
284282 glD3DDev2 = NULL;
Index: ddraw/glDirectDraw.cpp
@@ -33,7 +33,7 @@
3434 #include "glRenderer.h"
3535 #include "../common/version.h"
3636
37 -DDDEVICEIDENTIFIER2 devid = {
 37+const DDDEVICEIDENTIFIER2 devid_default = {
3838 "ddraw.dll",
3939 "DXGL DDraw Wrapper",
4040 0,
@@ -1132,6 +1132,7 @@
11331133 TRACE_ENTER(2,14,this,24,lpGUID);
11341134 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
11351135 if(initialized) TRACE_RET(HRESULT,23,DDERR_ALREADYINITIALIZED);
 1136+ devid = devid_default;
11361137 primarylost = true;
11371138 glD3D7 = NULL;
11381139 glDD1 = NULL;
@@ -2309,8 +2310,8 @@
23102311 TRACE_ENTER(3,14,this,14,lpdddi,9,dwFlags);
23112312 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
23122313 if(!lpdddi) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
2313 - devid.guidDeviceIdentifier = device_template;
2314 - memcpy(lpdddi,&devid,sizeof(DDDEVICEIDENTIFIER));
 2314+ glDD7->devid.guidDeviceIdentifier = device_template;
 2315+ memcpy(lpdddi,&glDD7->devid,sizeof(DDDEVICEIDENTIFIER));
23152316 TRACE_EXIT(23,DD_OK);
23162317 return DD_OK;
23172318 }
\ No newline at end of file
Index: ddraw/glDirectDraw.h
@@ -89,6 +89,7 @@
9090 glDirectDraw1 *glDD1;
9191 glDirectDraw2 *glDD2;
9292 glDirectDraw4 *glDD4;
 93+ DDDEVICEIDENTIFIER2 devid;
9394 private:
9495 HRESULT error;
9596 ULONG refcount;