DXGL r427 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r426‎ | r427 | r428 >
Date:18:55, 13 April 2014
Author:admin
Status:new
Tags:
Comment:
Make global variables in glDirect3D.cpp constant.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/glDirect3D.h (modified) (history)
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirect3DDevice.h (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -29,7 +29,7 @@
3030 #include "glDirect3DMaterial.h"
3131 #include "glDirect3DLight.h"
3232
33 -D3DDEVICEDESC7 d3ddesc =
 33+const D3DDEVICEDESC7 d3ddesc =
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 -D3DDEVICEDESC d3ddesc3 =
 131+const D3DDEVICEDESC d3ddesc3 =
132132 {
133133 sizeof(D3DDEVICEDESC), // dwSize
134134 D3DDD_BCLIPPING|D3DDD_COLORMODEL|D3DDD_DEVCAPS|D3DDD_DEVICERENDERBITDEPTH|
@@ -180,7 +180,7 @@
181181 char *name;
182182 char *devname;
183183 };
184 -D3DDevice devices[3] =
 184+const D3DDevice devices[3] =
185185 {
186186 {
187187 "Simulated RGB Rasterizer",
Index: ddraw/glDirect3D.h
@@ -19,8 +19,8 @@
2020 #ifndef __GLDIRECT3D_H
2121 #define __GLDIRECT3D_H
2222
23 -extern D3DDEVICEDESC7 d3ddesc;
24 -extern D3DDEVICEDESC d3ddesc3;
 23+extern const D3DDEVICEDESC7 d3ddesc;
 24+extern const D3DDEVICEDESC d3ddesc3;
2525 class glDirectDraw7;
2626
2727 class glDirect3D3;
Index: ddraw/glDirect3DDevice.cpp
@@ -74,7 +74,7 @@
7575 DWORD dwMinStippleHeight,dwMaxStippleHeight;
7676 } D3DDEVICEDESC2,*LPD3DDEVICEDESC2;
7777
78 -extern D3DDEVICEDESC7 d3ddesc;
 78+extern const D3DDEVICEDESC7 d3ddesc;
7979
8080 const DWORD renderstate_default[153] = {0, // 0
8181 NULL, //texturehandle
@@ -276,6 +276,8 @@
277277 glDirect3DDevice7::glDirect3DDevice7(REFCLSID rclsid, glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
278278 {
279279 TRACE_ENTER(4,14,this,24,&rclsid,14,glD3D7,14,glDDS7);
 280+ memcpy(&d3ddesc, &::d3ddesc, sizeof(D3DDEVICEDESC));
 281+ memcpy(&d3ddesc3, &::d3ddesc3, sizeof(D3DDEVICEDESC));
280282 int zbuffer = 0;
281283 glD3DDev3 = NULL;
282284 glD3DDev2 = NULL;
Index: ddraw/glDirect3DDevice.h
@@ -230,6 +230,8 @@
231231 D3DMATRIXHANDLE mhWorld;
232232 D3DMATRIXHANDLE mhView;
233233 D3DMATRIXHANDLE mhProjection;
 234+ D3DDEVICEDESC7 d3ddesc;
 235+ D3DDEVICEDESC d3ddesc3;
234236 };
235237
236238 #endif //__GLDIRECT3DDEVICE_H