DXGL r513 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r512‎ | r513 | r514 >
Date:22:18, 1 September 2014
Author:admin
Status:new
Tags:
Comment:
Unify glDirectDraw and glDirect3D refcounts.
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
@@ -175,64 +175,24 @@
176176 d3ddesc_default.wMaxSimultaneousTextures
177177 };
178178
179 -const D3DDevice devices[3] =
180 -{
181 - {
182 - "Simulated RGB Rasterizer",
183 - "DXGL RGB Rasterizer",
184 - },
185 - {
186 - "DXGL Hardware Accelerator",
187 - "DXGL D3D HAL",
188 - },
189 - {
190 - "DXGL Hardware Accelerator with Transform and Lighting",
191 - "DXGL D3D T&L HAL",
192 - }
193 -};
194179 glDirect3D7::glDirect3D7(glDirectDraw7 *gl_DD7)
195180 {
196181 TRACE_ENTER(1,14,this,14,gl_DD7);
197 - d3ddesc = d3ddesc_default;
198 - d3ddesc3 = d3ddesc3_default;
199 - refcount=1;
200 - glD3D3 = NULL;
201 - glD3D2 = NULL;
202 - glD3D1 = NULL;
203182 glDD7 = gl_DD7;
204 - glDD7->AddRef();
205 - memcpy(stored_devices, devices, 3 * sizeof(D3DDevice));
206183 TRACE_EXIT(-1, 0);
207184 }
208185
209 -glDirect3D7::~glDirect3D7()
210 -{
211 - TRACE_ENTER(1,14,this);
212 - glDD7->Release();
213 - if(glD3D3) glD3D3->Release();
214 - if(glD3D2) glD3D2->Release();
215 - if(glD3D1) glD3D1->Release();
216 - TRACE_EXIT(-1,0);
217 -}
218 -
219186 ULONG WINAPI glDirect3D7::AddRef()
220187 {
221188 TRACE_ENTER(1,14,this);
222189 if(!this) TRACE_RET(ULONG,8,0);
223 - refcount++;
224 - TRACE_EXIT(8,refcount);
225 - return refcount;
 190+ TRACE_RET(ULONG, 8, glDD7->AddRef());
226191 }
227192 ULONG WINAPI glDirect3D7::Release()
228193 {
229194 TRACE_ENTER(1,14,this);
230195 if(!this) TRACE_RET(ULONG,8,0);
231 - ULONG ret;
232 - refcount--;
233 - ret = refcount;
234 - if(refcount == 0) delete this;
235 - TRACE_EXIT(8,refcount);
236 - return ret;
 196+ TRACE_RET(ULONG, 8, glDD7->Release());
237197 }
238198
239199 HRESULT WINAPI glDirect3D7::QueryInterface(REFIID riid, void** ppvObj)
@@ -239,77 +199,7 @@
240200 {
241201 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
242202 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
243 - if(!ppvObj) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
244 - if(riid == IID_IUnknown)
245 - {
246 - this->AddRef();
247 - *ppvObj = this;
248 - TRACE_VAR("*ppvObj",14,*ppvObj);
249 - TRACE_EXIT(23,D3D_OK);
250 - return D3D_OK;
251 - }
252 - if(riid == IID_IDirect3D3)
253 - {
254 - if(glD3D3)
255 - {
256 - *ppvObj = glD3D3;
257 - glD3D3->AddRef();
258 - TRACE_VAR("*ppvObj",14,*ppvObj);
259 - TRACE_EXIT(23,D3D_OK);
260 - return D3D_OK;
261 - }
262 - else
263 - {
264 - this->AddRef();
265 - *ppvObj = new glDirect3D3(this);
266 - glD3D3 = (glDirect3D3*)*ppvObj;
267 - TRACE_VAR("*ppvObj",14,*ppvObj);
268 - TRACE_EXIT(23,D3D_OK);
269 - return D3D_OK;
270 - }
271 - }
272 - if(riid == IID_IDirect3D2)
273 - {
274 - if(glD3D2)
275 - {
276 - *ppvObj = glD3D2;
277 - glD3D2->AddRef();
278 - TRACE_VAR("*ppvObj",14,*ppvObj);
279 - TRACE_EXIT(23,D3D_OK);
280 - return D3D_OK;
281 - }
282 - else
283 - {
284 - this->AddRef();
285 - *ppvObj = new glDirect3D2(this);
286 - glD3D2 = (glDirect3D2*)*ppvObj;
287 - TRACE_VAR("*ppvObj",14,*ppvObj);
288 - TRACE_EXIT(23,D3D_OK);
289 - return D3D_OK;
290 - }
291 - }
292 - if(riid == IID_IDirect3D)
293 - {
294 - if(glD3D1)
295 - {
296 - *ppvObj = glD3D1;
297 - glD3D1->AddRef();
298 - TRACE_VAR("*ppvObj",14,*ppvObj);
299 - TRACE_EXIT(23,D3D_OK);
300 - return D3D_OK;
301 - }
302 - else
303 - {
304 - this->AddRef();
305 - *ppvObj = new glDirect3D1(this);
306 - glD3D1 = (glDirect3D1*)*ppvObj;
307 - TRACE_VAR("*ppvObj",14,*ppvObj);
308 - TRACE_EXIT(23,D3D_OK);
309 - return D3D_OK;
310 - }
311 - }
312 - TRACE_EXIT(23,E_NOINTERFACE);
313 - return E_NOINTERFACE;
 203+ TRACE_RET(HRESULT, 23, glDD7->QueryInterface(riid, ppvObj));
314204 }
315205
316206
@@ -382,7 +272,7 @@
383273 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
384274 if(!lpEnumDevicesCallback) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
385275 HRESULT result;
386 - D3DDEVICEDESC7 desc = d3ddesc;
 276+ D3DDEVICEDESC7 desc = glDD7->d3ddesc;
387277 for(int i = 0; i < 3; i++)
388278 {
389279 switch(i)
@@ -399,7 +289,7 @@
400290 desc.dwDevCaps |= D3DDEVCAPS_HWRASTERIZATION | D3DDEVCAPS_HWTRANSFORMANDLIGHT;
401291 break;
402292 }
403 - result = lpEnumDevicesCallback(stored_devices[i].name,stored_devices[i].devname,&desc,lpUserArg);
 293+ result = lpEnumDevicesCallback(glDD7->stored_devices[i].name,glDD7->stored_devices[i].devname,&desc,lpUserArg);
404294 if(result != D3DENUMRET_OK) break;
405295 }
406296 TRACE_EXIT(23,D3D_OK);
@@ -412,12 +302,12 @@
413303 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
414304 if(!lpEnumDevicesCallback) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
415305 HRESULT result;
416 - D3DDEVICEDESC desc = d3ddesc3;
 306+ D3DDEVICEDESC desc = glDD7->d3ddesc3;
417307 GUID guid = IID_IDirect3DRGBDevice;
418 - result = lpEnumDevicesCallback(&guid,stored_devices[0].name,stored_devices[0].devname,&desc,&desc,lpUserArg);
 308+ result = lpEnumDevicesCallback(&guid,glDD7->stored_devices[0].name,glDD7->stored_devices[0].devname,&desc,&desc,lpUserArg);
419309 if(result != D3DENUMRET_OK) TRACE_RET(HRESULT,23,D3D_OK);
420310 guid = IID_IDirect3DHALDevice;
421 - result = lpEnumDevicesCallback(&guid,stored_devices[1].name,stored_devices[1].devname,&desc,&desc,lpUserArg);
 311+ result = lpEnumDevicesCallback(&guid,glDD7->stored_devices[1].name,glDD7->stored_devices[1].devname,&desc,&desc,lpUserArg);
422312 TRACE_EXIT(23,D3D_OK);
423313 return D3D_OK;
424314 }
@@ -477,58 +367,58 @@
478368 {
479369 if(lpD3DFDS->dwFlags & D3DFDS_ALPHACMPCAPS)
480370 {
481 - if((d3ddesc.dpcTriCaps.dwAlphaCmpCaps & lpD3DFDS->dpcPrimCaps.dwAlphaCmpCaps)
 371+ if((glDD7->d3ddesc.dpcTriCaps.dwAlphaCmpCaps & lpD3DFDS->dpcPrimCaps.dwAlphaCmpCaps)
482372 != lpD3DFDS->dpcPrimCaps.dwAlphaCmpCaps) found = false;
483373 }
484374 if(lpD3DFDS->dwFlags & D3DFDS_DSTBLENDCAPS)
485375 {
486 - if((d3ddesc.dpcTriCaps.dwDestBlendCaps & lpD3DFDS->dpcPrimCaps.dwDestBlendCaps)
 376+ if ((glDD7->d3ddesc.dpcTriCaps.dwDestBlendCaps & lpD3DFDS->dpcPrimCaps.dwDestBlendCaps)
487377 != lpD3DFDS->dpcPrimCaps.dwDestBlendCaps) found = false;
488378 }
489379 if(lpD3DFDS->dwFlags & D3DFDS_MISCCAPS)
490380 {
491 - if((d3ddesc.dpcTriCaps.dwMiscCaps & lpD3DFDS->dpcPrimCaps.dwMiscCaps)
 381+ if ((glDD7->d3ddesc.dpcTriCaps.dwMiscCaps & lpD3DFDS->dpcPrimCaps.dwMiscCaps)
492382 != lpD3DFDS->dpcPrimCaps.dwMiscCaps) found = false;
493383 }
494384 if(lpD3DFDS->dwFlags & D3DFDS_RASTERCAPS)
495385 {
496 - if((d3ddesc.dpcTriCaps.dwRasterCaps & lpD3DFDS->dpcPrimCaps.dwRasterCaps)
 386+ if ((glDD7->d3ddesc.dpcTriCaps.dwRasterCaps & lpD3DFDS->dpcPrimCaps.dwRasterCaps)
497387 != lpD3DFDS->dpcPrimCaps.dwRasterCaps) found = false;
498388 }
499389 if(lpD3DFDS->dwFlags & D3DFDS_SHADECAPS)
500390 {
501 - if((d3ddesc.dpcTriCaps.dwShadeCaps & lpD3DFDS->dpcPrimCaps.dwShadeCaps)
 391+ if ((glDD7->d3ddesc.dpcTriCaps.dwShadeCaps & lpD3DFDS->dpcPrimCaps.dwShadeCaps)
502392 != lpD3DFDS->dpcPrimCaps.dwShadeCaps) found = false;
503393 }
504394 if(lpD3DFDS->dwFlags & D3DFDS_SRCBLENDCAPS)
505395 {
506 - if((d3ddesc.dpcTriCaps.dwSrcBlendCaps & lpD3DFDS->dpcPrimCaps.dwSrcBlendCaps)
 396+ if ((glDD7->d3ddesc.dpcTriCaps.dwSrcBlendCaps & lpD3DFDS->dpcPrimCaps.dwSrcBlendCaps)
507397 != lpD3DFDS->dpcPrimCaps.dwSrcBlendCaps) found = false;
508398 }
509399 if(lpD3DFDS->dwFlags & D3DFDS_TEXTUREBLENDCAPS)
510400 {
511 - if((d3ddesc.dpcTriCaps.dwTextureBlendCaps & lpD3DFDS->dpcPrimCaps.dwTextureBlendCaps)
 401+ if ((glDD7->d3ddesc.dpcTriCaps.dwTextureBlendCaps & lpD3DFDS->dpcPrimCaps.dwTextureBlendCaps)
512402 != lpD3DFDS->dpcPrimCaps.dwTextureBlendCaps) found = false;
513403 }
514404 if(lpD3DFDS->dwFlags & D3DFDS_TEXTURECAPS)
515405 {
516 - if((d3ddesc.dpcTriCaps.dwTextureCaps & lpD3DFDS->dpcPrimCaps.dwTextureCaps)
 406+ if ((glDD7->d3ddesc.dpcTriCaps.dwTextureCaps & lpD3DFDS->dpcPrimCaps.dwTextureCaps)
517407 != lpD3DFDS->dpcPrimCaps.dwTextureCaps) found = false;
518408 }
519409 if(lpD3DFDS->dwFlags & D3DFDS_TEXTUREFILTERCAPS)
520410 {
521 - if((d3ddesc.dpcTriCaps.dwTextureFilterCaps & lpD3DFDS->dpcPrimCaps.dwTextureFilterCaps)
 411+ if ((glDD7->d3ddesc.dpcTriCaps.dwTextureFilterCaps & lpD3DFDS->dpcPrimCaps.dwTextureFilterCaps)
522412 != lpD3DFDS->dpcPrimCaps.dwTextureFilterCaps) found = false;
523413 }
524414 if(lpD3DFDS->dwCaps & D3DFDS_ZCMPCAPS)
525415 {
526 - if((d3ddesc.dpcTriCaps.dwZCmpCaps & lpD3DFDS->dpcPrimCaps.dwZCmpCaps)
 416+ if ((glDD7->d3ddesc.dpcTriCaps.dwZCmpCaps & lpD3DFDS->dpcPrimCaps.dwZCmpCaps)
527417 != lpD3DFDS->dpcPrimCaps.dwZCmpCaps) found = false;
528418 }
529419 }
530420 if(lpD3DFDS->dwFlags & D3DFDS_COLORMODEL)
531421 {
532 - if((d3ddesc3.dcmColorModel & lpD3DFDS->dcmColorModel) != lpD3DFDS->dcmColorModel) found = false;
 422+ if ((glDD7->d3ddesc3.dcmColorModel & lpD3DFDS->dcmColorModel) != lpD3DFDS->dcmColorModel) found = false;
533423 }
534424 if(lpD3DFDS->dwFlags & D3DFDS_GUID)
535425 {
@@ -546,8 +436,8 @@
547437 else if(!lpD3DFDS->bHardware) guid = IID_IDirect3DRGBDevice;
548438 }
549439 if(!found) TRACE_RET(HRESULT,23,DDERR_NOTFOUND);
550 - if(guid == IID_IDirect3DRGBDevice) lpD3DFDR->ddSwDesc = d3ddesc3;
551 - else lpD3DFDR->ddHwDesc = d3ddesc3;
 440+ if(guid == IID_IDirect3DRGBDevice) lpD3DFDR->ddSwDesc = glDD7->d3ddesc3;
 441+ else lpD3DFDR->ddHwDesc = glDD7->d3ddesc3;
552442 lpD3DFDR->guid = guid;
553443 TRACE_EXIT(23,D3D_OK);
554444 return D3D_OK;
@@ -559,18 +449,9 @@
560450 {
561451 TRACE_ENTER(2,14,this,14,glD3D7);
562452 this->glD3D7 = glD3D7;
563 - refcount = 1;
564453 TRACE_EXIT(-1,0);
565454 }
566455
567 -glDirect3D3::~glDirect3D3()
568 -{
569 - TRACE_ENTER(1,14,this);
570 - glD3D7->Release();
571 - glD3D7->glD3D3 = NULL;
572 - TRACE_EXIT(-1,0);
573 -}
574 -
575456 HRESULT WINAPI glDirect3D3::QueryInterface(REFIID riid, void** ppvObj)
576457 {
577458 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
@@ -590,9 +471,7 @@
591472 {
592473 TRACE_ENTER(1,14,this);
593474 if(!this) TRACE_RET(ULONG,8,0);
594 - refcount++;
595 - TRACE_EXIT(8,refcount);
596 - return refcount;
 475+ TRACE_RET(ULONG, 8, glD3D7->glDD7->AddRef1());
597476 }
598477
599478 ULONG WINAPI glDirect3D3::Release()
@@ -599,12 +478,7 @@
600479 {
601480 TRACE_ENTER(1,14,this);
602481 if(!this) TRACE_RET(ULONG,8,0);
603 - ULONG ret;
604 - refcount--;
605 - ret = refcount;
606 - if(refcount == 0) delete this;
607 - TRACE_EXIT(8,ret);
608 - return ret;
 482+ TRACE_RET(ULONG, 8, glD3D7->glDD7->Release1());
609483 }
610484
611485 HRESULT WINAPI glDirect3D3::CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE4 lpDDS, LPDIRECT3DDEVICE3 *lplpD3DDevice, LPUNKNOWN pUnkOuter)
@@ -694,18 +568,9 @@
695569 {
696570 TRACE_ENTER(2,14,this,14,glD3D7);
697571 this->glD3D7 = glD3D7;
698 - refcount = 1;
699572 TRACE_EXIT(-1,0);
700573 }
701574
702 -glDirect3D2::~glDirect3D2()
703 -{
704 - TRACE_ENTER(1,14,this);
705 - glD3D7->Release();
706 - glD3D7->glD3D2 = NULL;
707 - TRACE_EXIT(-1,0);
708 -}
709 -
710575 HRESULT WINAPI glDirect3D2::QueryInterface(REFIID riid, void** ppvObj)
711576 {
712577 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
@@ -725,9 +590,7 @@
726591 {
727592 TRACE_ENTER(1,14,this);
728593 if(!this) TRACE_RET(ULONG,8,0);
729 - refcount++;
730 - TRACE_EXIT(8,refcount);
731 - return refcount;
 594+ TRACE_RET(ULONG, 8, glD3D7->glDD7->AddRef1());
732595 }
733596
734597 ULONG WINAPI glDirect3D2::Release()
@@ -734,12 +597,7 @@
735598 {
736599 TRACE_ENTER(1,14,this);
737600 if(!this) TRACE_RET(ULONG,8,0);
738 - ULONG ret;
739 - refcount--;
740 - ret = refcount;
741 - if(refcount == 0) delete this;
742 - TRACE_EXIT(8,ret);
743 - return ret;
 601+ TRACE_RET(ULONG, 8, glD3D7->glDD7->Release1());
744602 }
745603
746604 HRESULT WINAPI glDirect3D2::CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DDEVICE2 *lplpD3DDevice)
@@ -816,18 +674,9 @@
817675 {
818676 TRACE_ENTER(2,14,this,14,glD3D7);
819677 this->glD3D7 = glD3D7;
820 - refcount = 1;
821678 TRACE_EXIT(-1,0);
822679 }
823680
824 -glDirect3D1::~glDirect3D1()
825 -{
826 - TRACE_ENTER(1,14,this);
827 - glD3D7->Release();
828 - glD3D7->glD3D1 = NULL;
829 - TRACE_EXIT(-1,0);
830 -}
831 -
832681 HRESULT WINAPI glDirect3D1::QueryInterface(REFIID riid, void** ppvObj)
833682 {
834683 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
@@ -847,9 +696,7 @@
848697 {
849698 TRACE_ENTER(1,14,this);
850699 if(!this) TRACE_RET(ULONG,8,0);
851 - refcount++;
852 - TRACE_EXIT(8,refcount);
853 - return refcount;
 700+ TRACE_RET(ULONG, 8, glD3D7->glDD7->AddRef1());
854701 }
855702
856703 ULONG WINAPI glDirect3D1::Release()
@@ -856,12 +703,7 @@
857704 {
858705 TRACE_ENTER(1,14,this);
859706 if(!this) TRACE_RET(ULONG,8,0);
860 - ULONG ret;
861 - refcount--;
862 - ret = refcount;
863 - if(refcount == 0) delete this;
864 - TRACE_EXIT(8,ret);
865 - return ret;
 707+ TRACE_RET(ULONG, 8, glD3D7->glDD7->Release1());
866708 }
867709
868710 HRESULT WINAPI glDirect3D1::CreateLight(LPDIRECT3DLIGHT* lplpDirect3DLight, IUnknown* pUnkOuter)
Index: ddraw/glDirect3D.h
@@ -27,17 +27,10 @@
2828 class glDirect3D2;
2929 class glDirect3D1;
3030
31 -struct D3DDevice
32 -{
33 - char name[64];
34 - char devname[64];
35 -};
36 -
3731 class glDirect3D7 : public IDirect3D7
3832 {
3933 public:
4034 glDirect3D7(glDirectDraw7 *gl_DD7);
41 - virtual ~glDirect3D7();
4235 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
4336 ULONG WINAPI AddRef();
4437 ULONG WINAPI Release();
@@ -51,15 +44,7 @@
5245 HRESULT WINAPI EnumZBufferFormats(REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext);
5346 HRESULT WINAPI EvictManagedTextures();
5447 HRESULT WINAPI FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR);
55 - glDirect3D3 *glD3D3;
56 - glDirect3D2 *glD3D2;
57 - glDirect3D1 *glD3D1;
5848 glDirectDraw7 *glDD7;
59 -private:
60 - D3DDevice stored_devices[3];
61 - ULONG refcount;
62 - D3DDEVICEDESC7 d3ddesc;
63 - D3DDEVICEDESC d3ddesc3;
6449 };
6550
6651 class glDirect3D3 : public IDirect3D3
@@ -66,7 +51,6 @@
6752 {
6853 public:
6954 glDirect3D3(glDirect3D7 *glD3D7);
70 - virtual ~glDirect3D3();
7155 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
7256 ULONG WINAPI AddRef();
7357 ULONG WINAPI Release();
@@ -80,7 +64,6 @@
8165 HRESULT WINAPI EvictManagedTextures();
8266 HRESULT WINAPI FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR);
8367 private:
84 - ULONG refcount;
8568 glDirect3D7 *glD3D7;
8669 };
8770
@@ -88,7 +71,6 @@
8972 {
9073 public:
9174 glDirect3D2(glDirect3D7 *glD3D7);
92 - virtual ~glDirect3D2();
9375 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
9476 ULONG WINAPI AddRef();
9577 ULONG WINAPI Release();
@@ -99,7 +81,6 @@
10082 HRESULT WINAPI EnumDevices(LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg);
10183 HRESULT WINAPI FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR);
10284 private:
103 - ULONG refcount;
10485 glDirect3D7 *glD3D7;
10586 };
10687
@@ -107,7 +88,6 @@
10889 {
10990 public:
11091 glDirect3D1(glDirect3D7 *glD3D7);
111 - virtual ~glDirect3D1();
11292 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
11393 ULONG WINAPI AddRef();
11494 ULONG WINAPI Release();
@@ -118,7 +98,6 @@
11999 HRESULT WINAPI FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR);
120100 HRESULT WINAPI Initialize(REFIID lpREFIID);
121101 private:
122 - ULONG refcount;
123102 glDirect3D7 *glD3D7;
124103 };
125104
Index: ddraw/glDirect3DDevice.cpp
@@ -2453,10 +2453,10 @@
24542454 (*output)[i+dest].dvTV = input[i+start].dvTV;
24552455 diffuse.r = diffuse.g = diffuse.b = diffuse.a = 0;
24562456 specular.r = specular.g = specular.b = specular.a = 0;
2457 - ambient.r = (D3DVALUE)RGBA_GETRED(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0;
2458 - ambient.g = (D3DVALUE)RGBA_GETGREEN(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0;
2459 - ambient.b = (D3DVALUE)RGBA_GETBLUE(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0;
2460 - ambient.a = (D3DVALUE)RGBA_GETALPHA(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0;
 2457+ ambient.r = (D3DVALUE)RGBA_GETRED(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0f;
 2458+ ambient.g = (D3DVALUE)RGBA_GETGREEN(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0f;
 2459+ ambient.b = (D3DVALUE)RGBA_GETBLUE(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0f;
 2460+ ambient.a = (D3DVALUE)RGBA_GETALPHA(renderstate[D3DRENDERSTATE_AMBIENT]) / 255.0f;
24612461 for(int l = 0; l < 8; l++)
24622462 {
24632463 if(gllights[l] != -1)
@@ -2496,15 +2496,15 @@
24972497 length = len3(V);
24982498 if((length > lights[gllights[l]]->light.dvRange) && (lights[gllights[l]]->light.dvRange != 0.0)) continue;
24992499 normalize(V);
2500 - attenuation = 1.0/(lights[gllights[l]]->light.dvAttenuation0+(length*lights[gllights[l]]->light.dvAttenuation1)
 2500+ attenuation = 1.0f/(lights[gllights[l]]->light.dvAttenuation0+(length*lights[gllights[l]]->light.dvAttenuation1)
25012501 +((length*length)*lights[gllights[l]]->light.dvAttenuation2));
2502 - NdotV = max(0.0,dot3((float*)&input[i+start].dvNX,V));
 2502+ NdotV = max(0.0f,dot3((float*)&input[i+start].dvNX,V));
25032503 AddVec3(V,eye);
25042504 normalize(V);
2505 - NdotHV = max(0.0,dot3((float*)&input[i+start].dvNX,V));
2506 - if(NdotV == 0.0) pf = 0.0;
2507 - else if(material.dvPower != 0.0) pf = pow(NdotHV,material.dvPower);
2508 - else pf = 0.0;
 2505+ NdotHV = max(0.0f,dot3((float*)&input[i+start].dvNX,V));
 2506+ if(NdotV == 0.0f) pf = 0.0f;
 2507+ else if(material.dvPower != 0.0f) pf = pow(NdotHV,material.dvPower);
 2508+ else pf = 0.0f;
25092509 color1 = lights[gllights[l]]->light.dcvDiffuse;
25102510 MulD3DCVFloat(&color1,NdotV*attenuation);
25112511 AddD3DCV(&diffuse,&color1);
Index: ddraw/glDirectDraw.cpp
@@ -39,6 +39,22 @@
4040 0,0,0,0,
4141 0,0};
4242
 43+const D3DDevice d3ddevices[3] =
 44+{
 45+ {
 46+ "Simulated RGB Rasterizer",
 47+ "DXGL RGB Rasterizer",
 48+ },
 49+ {
 50+ "DXGL Hardware Accelerator",
 51+ "DXGL D3D HAL",
 52+ },
 53+ {
 54+ "DXGL Hardware Accelerator with Transform and Lighting",
 55+ "DXGL D3D T&L HAL",
 56+ }
 57+};
 58+
4359 void DiscardDuplicateModes(DEVMODE **array, DWORD *count)
4460 {
4561 DEVMODE *newarray = (DEVMODE *)malloc(sizeof(DEVMODE)*(*count));
@@ -557,17 +573,26 @@
558574 glDirectDraw7::glDirectDraw7()
559575 {
560576 TRACE_ENTER(1,14,this);
561 - glDD1 = NULL;
562 - glDD2 = NULL;
563 - glDD4 = NULL;
564 - glD3D7 = NULL;
 577+ glDD1 = new glDirectDraw1(this);
 578+ glDD2 = new glDirectDraw2(this);
 579+ glDD4 = new glDirectDraw4(this);
 580+ glD3D7 = new glDirect3D7(this);
 581+ glD3D3 = new glDirect3D3(glD3D7);
 582+ glD3D2 = new glDirect3D2(glD3D7);
 583+ glD3D1 = new glDirect3D1(glD3D7);
565584 clippers = NULL;
566585 surfaces = NULL;
567586 initialized = false;
568587 devid.liDriverVersion.QuadPart = DXGLVERQWORD;
569 - refcount = 1;
 588+ refcount7 = 1;
 589+ refcount4 = 0;
 590+ refcount2 = 0;
 591+ refcount1 = 0;
570592 renderer = NULL;
571 - TRACE_EXIT(-1,0);
 593+ d3ddesc = d3ddesc_default;
 594+ d3ddesc3 = d3ddesc3_default;
 595+ memcpy(stored_devices, d3ddevices, 3 * sizeof(D3DDevice));
 596+ TRACE_EXIT(-1, 0);
572597 }
573598
574599 glDirectDraw7::glDirectDraw7(GUID FAR* lpGUID, IUnknown FAR* pUnkOuter)
@@ -574,7 +599,14 @@
575600 {
576601 TRACE_ENTER(3,14,this,24,lpGUID,14,pUnkOuter);
577602 initialized = false;
578 - if(((ULONG_PTR)lpGUID > 2) && !IsReadablePointer(lpGUID))
 603+ glDD1 = new glDirectDraw1(this);
 604+ glDD2 = new glDirectDraw2(this);
 605+ glDD4 = new glDirectDraw4(this);
 606+ glD3D7 = new glDirect3D7(this);
 607+ glD3D3 = new glDirect3D3(glD3D7);
 608+ glD3D2 = new glDirect3D2(glD3D7);
 609+ glD3D1 = new glDirect3D1(glD3D7);
 610+ if (((ULONG_PTR)lpGUID > 2) && !IsReadablePointer(lpGUID))
579611 {
580612 error = DDERR_INVALIDPARAMS ;
581613 TRACE_EXIT(-1,0);
@@ -601,8 +633,11 @@
602634 devid.liDriverVersion.QuadPart = DXGLVERQWORD;
603635 renderer = NULL;
604636 error = glDirectDraw7::Initialize(lpGUID);
605 - refcount = 1;
606 - TRACE_EXIT(-1,0);
 637+ refcount7 = 1;
 638+ refcount4 = 0;
 639+ refcount2 = 0;
 640+ refcount1 = 0;
 641+ TRACE_EXIT(-1, 0);
607642 }
608643
609644 glDirectDraw7::~glDirectDraw7()
@@ -637,6 +672,13 @@
638673 }
639674 renderer = NULL;
640675 }
 676+ if (glDD1) delete glDD1;
 677+ if (glDD2) delete glDD2;
 678+ if (glDD4) delete glDD4;
 679+ if (glD3D7) delete glD3D7;
 680+ if (glD3D3) delete glD3D3;
 681+ if (glD3D2) delete glD3D2;
 682+ if (glD3D1) delete glD3D1;
641683 TRACE_EXIT(-1,0);
642684 }
643685
@@ -645,7 +687,7 @@
646688 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
647689 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
648690 if(!ppvObj) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
649 - if(riid == IID_IUnknown)
 691+ if((riid == IID_IUnknown) || (riid == IID_IDirectDraw7))
650692 {
651693 this->AddRef();
652694 *ppvObj = this;
@@ -655,72 +697,24 @@
656698 }
657699 if(riid == IID_IDirectDraw)
658700 {
659 - if(glDD1)
660 - {
661 - *ppvObj = glDD1;
662 - glDD1->AddRef();
663 - TRACE_VAR("*ppvObj",14,*ppvObj);
664 - TRACE_EXIT(23,DD_OK);
665 - return DD_OK;
666 - }
667 - else
668 - {
669 - // Create an IDirectDraw1 interface
670 - this->AddRef();
671 - *ppvObj = new glDirectDraw1(this);
672 - glDD1 = (glDirectDraw1*)*ppvObj;
673 - TRACE_VAR("*ppvObj",14,*ppvObj);
674 - TRACE_EXIT(23,DD_OK);
675 - return DD_OK;
676 - }
 701+ this->AddRef1();
 702+ *ppvObj = glDD1;
 703+ TRACE_VAR("*ppvObj",14,*ppvObj);
 704+ TRACE_EXIT(23,DD_OK);
 705+ return DD_OK;
677706 }
678707 if(riid == IID_IDirectDraw2)
679708 {
680 - if(glDD2)
681 - {
682 - *ppvObj = glDD2;
683 - glDD2->AddRef();
684 - TRACE_VAR("*ppvObj",14,*ppvObj);
685 - TRACE_EXIT(23,DD_OK);
686 - return DD_OK;
687 - }
688 - else
689 - {
690 - // Create an IDirectDraw2 interface
691 - this->AddRef();
692 - *ppvObj = new glDirectDraw2(this);
693 - glDD2 = (glDirectDraw2*)*ppvObj;
694 - TRACE_VAR("*ppvObj",14,*ppvObj);
695 - TRACE_EXIT(23,DD_OK);
696 - return DD_OK;
697 - }
 709+ this->AddRef2();
 710+ *ppvObj = glDD2;
 711+ TRACE_VAR("*ppvObj",14,*ppvObj);
 712+ TRACE_EXIT(23,DD_OK);
 713+ return DD_OK;
698714 }
699715 if(riid == IID_IDirectDraw4)
700716 {
701 - if(glDD4)
702 - {
703 - *ppvObj = glDD4;
704 - glDD4->AddRef();
705 - TRACE_VAR("*ppvObj",14,*ppvObj);
706 - TRACE_EXIT(23,DD_OK);
707 - return DD_OK;
708 - }
709 - else
710 - {
711 - // Create an IDirectDraw4 interface
712 - this->AddRef();
713 - *ppvObj = new glDirectDraw4(this);
714 - glDD4 = (glDirectDraw4*)*ppvObj;
715 - TRACE_VAR("*ppvObj",14,*ppvObj);
716 - TRACE_EXIT(23,DD_OK);
717 - return DD_OK;
718 - }
719 - }
720 - if(riid == IID_IDirectDraw7)
721 - {
722 - // Probably non-DX compliant, but give a copy of the IDirectDraw7 interface
723 - this->AddRef();
724 - *ppvObj = this;
 717+ this->AddRef4();
 718+ *ppvObj = glDD4;
725719 TRACE_VAR("*ppvObj",14,*ppvObj);
726720 TRACE_EXIT(23,DD_OK);
727721 return DD_OK;
@@ -727,9 +721,8 @@
728722 }
729723 if(riid == IID_IDirect3D)
730724 {
731 - glDirect3D7 *tmp = new glDirect3D7(this);
732 - tmp->QueryInterface(IID_IDirect3D,ppvObj);
733 - tmp->Release();
 725+ this->AddRef1();
 726+ *ppvObj = glD3D1;
734727 TRACE_VAR("*ppvObj",14,*ppvObj);
735728 TRACE_EXIT(23,DD_OK);
736729 return DD_OK;
@@ -736,9 +729,8 @@
737730 }
738731 if(riid == IID_IDirect3D2)
739732 {
740 - glDirect3D7 *tmp = new glDirect3D7(this);
741 - tmp->QueryInterface(IID_IDirect3D2,ppvObj);
742 - tmp->Release();
 733+ this->AddRef1();
 734+ *ppvObj = glD3D2;
743735 TRACE_VAR("*ppvObj",14,*ppvObj);
744736 TRACE_EXIT(23,DD_OK);
745737 return DD_OK;
@@ -745,9 +737,8 @@
746738 }
747739 if(riid == IID_IDirect3D3)
748740 {
749 - glDirect3D7 *tmp = new glDirect3D7(this);
750 - tmp->QueryInterface(IID_IDirect3D3,ppvObj);
751 - tmp->Release();
 741+ this->AddRef1();
 742+ *ppvObj = glD3D3;
752743 TRACE_VAR("*ppvObj",14,*ppvObj);
753744 TRACE_EXIT(23,DD_OK);
754745 return DD_OK;
@@ -754,7 +745,8 @@
755746 }
756747 if(riid == IID_IDirect3D7)
757748 {
758 - *ppvObj = new glDirect3D7(this);
 749+ this->AddRef();
 750+ *ppvObj = glD3D7;
759751 TRACE_VAR("*ppvObj",14,*ppvObj);
760752 TRACE_EXIT(23,DD_OK);
761753 return DD_OK;
@@ -770,15 +762,15 @@
771763 ERR(DDERR_GENERIC);
772764 }*/
773765 TRACE_EXIT(23,E_NOINTERFACE);
774 - ERR(E_NOINTERFACE);
 766+ return E_NOINTERFACE;
775767 }
776768 ULONG WINAPI glDirectDraw7::AddRef()
777769 {
778770 TRACE_ENTER(1,14,this);
779771 if(!this) TRACE_RET(ULONG,8,0);
780 - refcount++;
781 - TRACE_EXIT(8,refcount);
782 - return refcount;
 772+ refcount7++;
 773+ TRACE_EXIT(8,refcount7);
 774+ return refcount7;
783775 }
784776 ULONG WINAPI glDirectDraw7::Release()
785777 {
@@ -785,13 +777,81 @@
786778 TRACE_ENTER(1,14,this);
787779 if(!this) TRACE_RET(ULONG,8,0);
788780 ULONG ret;
789 - refcount--;
790 - ret = refcount;
791 - if(refcount == 0)
 781+ if (refcount7 == 0) TRACE_RET(ULONG,8,0);
 782+ refcount7--;
 783+ ret = refcount7;
 784+ if((refcount7 == 0) && (refcount4 == 0) && (refcount2 == 0) && (refcount1 == 0))
792785 delete this;
793786 TRACE_EXIT(8,ret);
794787 return ret;
795788 }
 789+
 790+ULONG WINAPI glDirectDraw7::AddRef4()
 791+{
 792+ TRACE_ENTER(1, 14, this);
 793+ if (!this) TRACE_RET(ULONG, 8, 0);
 794+ refcount4++;
 795+ TRACE_EXIT(8, refcount4);
 796+ return refcount4;
 797+}
 798+ULONG WINAPI glDirectDraw7::Release4()
 799+{
 800+ TRACE_ENTER(1, 14, this);
 801+ if (!this) TRACE_RET(ULONG, 8, 0);
 802+ ULONG ret;
 803+ if (refcount4 == 0) TRACE_RET(ULONG, 8, 0);
 804+ refcount4--;
 805+ ret = refcount4;
 806+ if ((refcount7 == 0) && (refcount4 == 0) && (refcount2 == 0) && (refcount1 == 0))
 807+ delete this;
 808+ TRACE_EXIT(8, ret);
 809+ return ret;
 810+}
 811+
 812+ULONG WINAPI glDirectDraw7::AddRef2()
 813+{
 814+ TRACE_ENTER(1, 14, this);
 815+ if (!this) TRACE_RET(ULONG, 8, 0);
 816+ refcount2++;
 817+ TRACE_EXIT(8, refcount2);
 818+ return refcount2;
 819+}
 820+ULONG WINAPI glDirectDraw7::Release2()
 821+{
 822+ TRACE_ENTER(1, 14, this);
 823+ if (!this) TRACE_RET(ULONG, 8, 0);
 824+ ULONG ret;
 825+ if (refcount2 == 0) TRACE_RET(ULONG, 8, 0);
 826+ refcount2--;
 827+ ret = refcount2;
 828+ if ((refcount7 == 0) && (refcount4 == 0) && (refcount2 == 0) && (refcount1 == 0))
 829+ delete this;
 830+ TRACE_EXIT(8, ret);
 831+ return ret;
 832+}
 833+
 834+ULONG WINAPI glDirectDraw7::AddRef1()
 835+{
 836+ TRACE_ENTER(1, 14, this);
 837+ if (!this) TRACE_RET(ULONG, 8, 0);
 838+ refcount1++;
 839+ TRACE_EXIT(8, refcount1);
 840+ return refcount1;
 841+}
 842+ULONG WINAPI glDirectDraw7::Release1()
 843+{
 844+ TRACE_ENTER(1, 14, this);
 845+ if (!this) TRACE_RET(ULONG, 8, 0);
 846+ ULONG ret;
 847+ if (refcount1 == 0) TRACE_RET(ULONG, 8, 0);
 848+ refcount1--;
 849+ ret = refcount1;
 850+ if ((refcount7 == 0) && (refcount4 == 0) && (refcount2 == 0) && (refcount1 == 0))
 851+ delete this;
 852+ TRACE_EXIT(8, ret);
 853+ return ret;
 854+}
 855+
796856 HRESULT WINAPI glDirectDraw7::Compact()
797857 {
798858 TRACE_ENTER(1,14,this);
@@ -1277,10 +1337,6 @@
12781338 if(initialized) TRACE_RET(HRESULT,23,DDERR_ALREADYINITIALIZED);
12791339 devid = devid_default;
12801340 primarylost = true;
1281 - glD3D7 = NULL;
1282 - glDD1 = NULL;
1283 - glDD2 = NULL;
1284 - glDD4 = NULL;
12851341 renderer = NULL;
12861342 primary = NULL;
12871343 lastsync = false;
@@ -1908,16 +1964,8 @@
19091965 {
19101966 TRACE_ENTER(2,14,this,14,gl_DD7);
19111967 glDD7 = gl_DD7;
1912 - refcount = 1;
19131968 TRACE_EXIT(-1,0);
19141969 }
1915 -glDirectDraw1::~glDirectDraw1()
1916 -{
1917 - TRACE_ENTER(1,14,this);
1918 - glDD7->glDD1 = NULL;
1919 - glDD7->Release();
1920 - TRACE_EXIT(-1,0);
1921 -}
19221970 HRESULT WINAPI glDirectDraw1::QueryInterface(REFIID riid, void** ppvObj)
19231971 {
19241972 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
@@ -1938,20 +1986,13 @@
19391987 {
19401988 TRACE_ENTER(1,14,this);
19411989 if(!this) TRACE_RET(ULONG,8,0);
1942 - refcount++;
1943 - TRACE_EXIT(8,refcount);
1944 - return refcount;
 1990+ TRACE_RET(ULONG, 8, glDD7->AddRef1());
19451991 }
19461992 ULONG WINAPI glDirectDraw1::Release()
19471993 {
19481994 TRACE_ENTER(1,14,this);
19491995 if(!this) TRACE_RET(ULONG,8,0);
1950 - ULONG ret;
1951 - refcount--;
1952 - ret = refcount;
1953 - if(refcount == 0) delete this;
1954 - TRACE_EXIT(8,ret);
1955 - return ret;
 1996+ TRACE_RET(ULONG, 8, glDD7->Release1());
19561997 }
19571998 HRESULT WINAPI glDirectDraw1::Compact()
19581999 {
@@ -2117,16 +2158,8 @@
21182159 {
21192160 TRACE_ENTER(2,14,this,14,gl_DD7);
21202161 glDD7 = gl_DD7;
2121 - refcount = 1;
21222162 TRACE_EXIT(-1,0);
21232163 }
2124 -glDirectDraw2::~glDirectDraw2()
2125 -{
2126 - TRACE_ENTER(1,14,this);
2127 - glDD7->glDD2 = NULL;
2128 - glDD7->Release();
2129 - TRACE_EXIT(-1,0);
2130 -}
21312164 HRESULT WINAPI glDirectDraw2::QueryInterface(REFIID riid, void** ppvObj)
21322165 {
21332166 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
@@ -2145,20 +2178,13 @@
21462179 {
21472180 TRACE_ENTER(1,14,this);
21482181 if(!this) TRACE_RET(ULONG,8,0);
2149 - refcount++;
2150 - TRACE_EXIT(8,refcount);
2151 - return refcount;
 2182+ TRACE_RET(ULONG, 8, glDD7->AddRef2());
21522183 }
21532184 ULONG WINAPI glDirectDraw2::Release()
21542185 {
21552186 TRACE_ENTER(1,14,this);
21562187 if(!this) TRACE_RET(ULONG,8,0);
2157 - ULONG ret;
2158 - refcount--;
2159 - ret = refcount;
2160 - if(refcount == 0) delete this;
2161 - TRACE_EXIT(8,ret);
2162 - return ret;
 2188+ TRACE_RET(ULONG, 8, glDD7->Release2());
21632189 }
21642190 HRESULT WINAPI glDirectDraw2::Compact()
21652191 {
@@ -2349,16 +2375,8 @@
23502376 {
23512377 TRACE_ENTER(2,14,this,14,gl_DD7);
23522378 glDD7 = gl_DD7;
2353 - refcount = 1;
23542379 TRACE_EXIT(-1,0);
23552380 }
2356 -glDirectDraw4::~glDirectDraw4()
2357 -{
2358 - TRACE_ENTER(1,14,this);
2359 - glDD7->glDD4 = NULL;
2360 - glDD7->Release();
2361 - TRACE_EXIT(-1,0);
2362 -}
23632381 HRESULT WINAPI glDirectDraw4::QueryInterface(REFIID riid, void** ppvObj)
23642382 {
23652383 TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
@@ -2376,20 +2394,13 @@
23772395 {
23782396 TRACE_ENTER(1,14,this);
23792397 if(!this) TRACE_RET(ULONG,8,0);
2380 - refcount++;
2381 - TRACE_EXIT(8,refcount);
2382 - return refcount;
 2398+ TRACE_RET(ULONG, 8, glDD7->AddRef());
23832399 }
23842400 ULONG WINAPI glDirectDraw4::Release()
23852401 {
23862402 TRACE_ENTER(1,14,this);
23872403 if(!this) TRACE_RET(ULONG,8,0);
2388 - ULONG ret;
2389 - refcount--;
2390 - ret = refcount;
2391 - if(refcount == 0) delete this;
2392 - TRACE_EXIT(8,ret);
2393 - return ret;
 2404+ TRACE_RET(ULONG, 8, glDD7->Release());
23942405 }
23952406 HRESULT WINAPI glDirectDraw4::Compact()
23962407 {
Index: ddraw/glDirectDraw.h
@@ -24,8 +24,17 @@
2525 class glDirectDrawSurface7;
2626 struct glDirectDrawClipper;
2727 class glDirect3D7;
 28+class glDirect3D3;
 29+class glDirect3D2;
 30+class glDirect3D1;
2831 struct glRenderer;
2932
 33+struct D3DDevice
 34+{
 35+ char name[64];
 36+ char devname[64];
 37+};
 38+
3039 class glDirectDraw1;
3140 class glDirectDraw2;
3241 class glDirectDraw4;
@@ -72,6 +81,12 @@
7382 HRESULT WINAPI EvaluateMode(DWORD dwFlags, DWORD *pSecondsUntilTimeout);
7483
7584 // internal functions
 85+ ULONG WINAPI AddRef4();
 86+ ULONG WINAPI Release4();
 87+ ULONG WINAPI AddRef2();
 88+ ULONG WINAPI Release2();
 89+ ULONG WINAPI AddRef1();
 90+ ULONG WINAPI Release1();
7691 HRESULT CreateSurface2(LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPDIRECTDRAWSURFACE7 FAR *lplpDDSurface, IUnknown FAR *pUnkOuter, BOOL RecordSurface);
7792 HRESULT err() {return error;}
7893 void RemoveSurface(glDirectDrawSurface7 *surface);
@@ -95,9 +110,12 @@
96111 DDDEVICEIDENTIFIER2 devid;
97112 glRenderer *renderer;
98113 glDirectDrawSurface7 *tmpsurface;
 114+ D3DDevice stored_devices[3];
 115+ D3DDEVICEDESC7 d3ddesc;
 116+ D3DDEVICEDESC d3ddesc3;
99117 private:
100118 HRESULT error;
101 - ULONG refcount;
 119+ ULONG refcount7, refcount4, refcount2, refcount1;
102120 HWND hWnd;
103121 bool fullscreen;
104122 bool fpupreserve;
@@ -112,6 +130,9 @@
113131 DEVMODE oldmode;
114132 bool initialized;
115133 glDirect3D7 *glD3D7;
 134+ glDirect3D3 *glD3D3;
 135+ glDirect3D2 *glD3D2;
 136+ glDirect3D1 *glD3D1;
116137 DWORD timer;
117138 bool devwnd;
118139 };
@@ -120,7 +141,6 @@
121142 {
122143 public:
123144 glDirectDraw1(glDirectDraw7 *gl_DD7);
124 - virtual ~glDirectDraw1();
125145 // ddraw 1+ api
126146 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
127147 ULONG WINAPI AddRef();
@@ -147,7 +167,6 @@
148168 HRESULT WINAPI WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent);
149169 HRESULT err() {return glDD7->err();}
150170 private:
151 - ULONG refcount;
152171 glDirectDraw7 *glDD7;
153172 };
154173
@@ -155,7 +174,6 @@
156175 {
157176 public:
158177 glDirectDraw2(glDirectDraw7 *gl_DD7);
159 - virtual ~glDirectDraw2();
160178 // ddraw 1+ api
161179 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
162180 ULONG WINAPI AddRef();
@@ -185,7 +203,6 @@
186204
187205 HRESULT err() {return glDD7->err();}
188206 private:
189 - ULONG refcount;
190207 glDirectDraw7 *glDD7;
191208 };
192209 class glDirectDraw4 : public IDirectDraw4
@@ -192,7 +209,6 @@
193210 {
194211 public:
195212 glDirectDraw4(glDirectDraw7 *gl_DD7);
196 - virtual ~glDirectDraw4();
197213 // ddraw 1+ api
198214 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
199215 ULONG WINAPI AddRef();
@@ -227,7 +243,6 @@
228244
229245 HRESULT err() {return glDD7->err();}
230246 private:
231 - ULONG refcount;
232247 glDirectDraw7 *glDD7;
233248 };
234249