DXGL r355 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r354‎ | r355 | r356 >
Date:21:00, 19 March 2013
Author:admin
Status:new
Tags:
Comment:
Trace glDirect3D.cpp and fix invalid object return values.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -195,6 +195,7 @@
196196 };
197197 glDirect3D7::glDirect3D7(glDirectDraw7 *glDD7)
198198 {
 199+ TRACE_ENTER(2,14,this,14,glDD7);
199200 refcount=1;
200201 this->glDD7 = glDD7;
201202 glDD7->AddRef();
@@ -201,39 +202,49 @@
202203 glD3D3 = NULL;
203204 glD3D2 = NULL;
204205 glD3D1 = NULL;
 206+ TRACE_EXIT(-1,0);
205207 }
206208
207209 glDirect3D7::~glDirect3D7()
208210 {
 211+ TRACE_ENTER(1,14,this);
209212 if(glD3D3) glD3D3->Release();
210213 if(glD3D2) glD3D2->Release();
211214 glDD7->Release();
 215+ TRACE_EXIT(-1,0);
212216 }
213217
214218 ULONG WINAPI glDirect3D7::AddRef()
215219 {
216 - if(!this) return 0;
 220+ TRACE_ENTER(1,14,this);
 221+ if(!this) TRACE_RET(8,0);
217222 refcount++;
 223+ TRACE_EXIT(8,refcount);
218224 return refcount;
219225 }
220226 ULONG WINAPI glDirect3D7::Release()
221227 {
222 - if(!this) return 0;
 228+ TRACE_ENTER(1,14,this);
 229+ if(!this) TRACE_RET(8,0);
223230 ULONG ret;
224231 refcount--;
225232 ret = refcount;
226233 if(refcount == 0) delete this;
 234+ TRACE_EXIT(8,refcount);
227235 return ret;
228236 }
229237
230238 HRESULT WINAPI glDirect3D7::QueryInterface(REFIID riid, void** ppvObj)
231239 {
232 - if(!this) return DDERR_INVALIDOBJECT;
233 - if(!ppvObj) return DDERR_INVALIDPARAMS;
 240+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 241+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 242+ if(!ppvObj) TRACE_RET(23,DDERR_INVALIDPARAMS);
234243 if(riid == IID_IUnknown)
235244 {
236245 this->AddRef();
237246 *ppvObj = this;
 247+ TRACE_VAR("*ppvObj",14,*ppvObj);
 248+ TRACE_EXIT(23,D3D_OK);
238249 return D3D_OK;
239250 }
240251 if(riid == IID_IDirect3D3)
@@ -242,6 +253,8 @@
243254 {
244255 *ppvObj = glD3D3;
245256 glD3D3->AddRef();
 257+ TRACE_VAR("*ppvObj",14,*ppvObj);
 258+ TRACE_EXIT(23,D3D_OK);
246259 return D3D_OK;
247260 }
248261 else
@@ -249,6 +262,8 @@
250263 this->AddRef();
251264 *ppvObj = new glDirect3D3(this);
252265 glD3D3 = (glDirect3D3*)*ppvObj;
 266+ TRACE_VAR("*ppvObj",14,*ppvObj);
 267+ TRACE_EXIT(23,D3D_OK);
253268 return D3D_OK;
254269 }
255270 }
@@ -258,6 +273,8 @@
259274 {
260275 *ppvObj = glD3D2;
261276 glD3D2->AddRef();
 277+ TRACE_VAR("*ppvObj",14,*ppvObj);
 278+ TRACE_EXIT(23,D3D_OK);
262279 return D3D_OK;
263280 }
264281 else
@@ -265,6 +282,8 @@
266283 this->AddRef();
267284 *ppvObj = new glDirect3D2(this);
268285 glD3D2 = (glDirect3D2*)*ppvObj;
 286+ TRACE_VAR("*ppvObj",14,*ppvObj);
 287+ TRACE_EXIT(23,D3D_OK);
269288 return D3D_OK;
270289 }
271290 }
@@ -274,6 +293,8 @@
275294 {
276295 *ppvObj = glD3D1;
277296 glD3D1->AddRef();
 297+ TRACE_VAR("*ppvObj",14,*ppvObj);
 298+ TRACE_EXIT(23,D3D_OK);
278299 return D3D_OK;
279300 }
280301 else
@@ -281,9 +302,12 @@
282303 this->AddRef();
283304 *ppvObj = new glDirect3D1(this);
284305 glD3D1 = (glDirect3D1*)*ppvObj;
 306+ TRACE_VAR("*ppvObj",14,*ppvObj);
 307+ TRACE_EXIT(23,D3D_OK);
285308 return D3D_OK;
286309 }
287310 }
 311+ TRACE_EXIT(23,E_NOINTERFACE);
288312 return E_NOINTERFACE;
289313 }
290314
@@ -290,55 +314,72 @@
291315
292316 HRESULT WINAPI glDirect3D7::CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECT3DDEVICE7 *lplpD3DDevice)
293317 {
294 - if(!this) return DDERR_INVALIDPARAMS;
 318+ TRACE_ENTER(4,14,this,24,&rclsid,14,lpDDS,14,lplpD3DDevice);
 319+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
295320 HRESULT ret;
296321 glDirect3DDevice7 *glD3DDev7 = new glDirect3DDevice7(rclsid,this,(glDirectDrawSurface7*)lpDDS);
297 - if(!glD3DDev7) return DDERR_OUTOFMEMORY;
 322+ if(!glD3DDev7) TRACE_RET(23,DDERR_OUTOFMEMORY);
298323 if(FAILED(glD3DDev7->err()))
299324 {
300325 ret = glD3DDev7->err();
301326 delete glD3DDev7;
 327+ TRACE_EXIT(23,ret);
302328 return ret;
303329 }
304330 *lplpD3DDevice = (LPDIRECT3DDEVICE7) glD3DDev7;
 331+ TRACE_VAR("*lplpD3DDevice",14,*lplpD3DDevice);
 332+ TRACE_EXIT(23,D3D_OK);
305333 return D3D_OK;
306334 }
307335 HRESULT WINAPI glDirect3D7::CreateLight(LPDIRECT3DLIGHT* lplpDirect3DLight, IUnknown* pUnkOuter)
308336 {
309 - if(!this) return DDERR_INVALIDPARAMS;
310 - if(!lplpDirect3DLight) return DDERR_INVALIDPARAMS;
311 - if(pUnkOuter) return DDERR_INVALIDPARAMS;
 337+ TRACE_ENTER(3,14,this,14,lplpDirect3DLight,14,pUnkOuter);
 338+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 339+ if(!lplpDirect3DLight) TRACE_RET(23,DDERR_INVALIDPARAMS);
 340+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
312341 *lplpDirect3DLight = new glDirect3DLight();
 342+ TRACE_VAR("*lplpDirect3DLight",14,*lplpDirect3DLight);
 343+ TRACE_EXIT(23,D3D_OK);
313344 return D3D_OK;
314345 }
315346 HRESULT WINAPI glDirect3D7::CreateMaterial(LPDIRECT3DMATERIAL3* lplpDirect3DMaterial, IUnknown* pUnkOuter)
316347 {
317 - if(!this) return DDERR_INVALIDPARAMS;
318 - if(!lplpDirect3DMaterial) return D3D_OK;
319 - if(pUnkOuter) return DDERR_INVALIDPARAMS;
 348+ TRACE_ENTER(3,14,this,14,lplpDirect3DMaterial,14,pUnkOuter);
 349+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 350+ if(!lplpDirect3DMaterial) TRACE_RET(23,DDERR_INVALIDPARAMS);
 351+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
320352 *lplpDirect3DMaterial = new glDirect3DMaterial3();
 353+ TRACE_VAR("*lplpDirect3DMaterial",14,*lplpDirect3DMaterial);
 354+ TRACE_EXIT(23,D3D_OK);
321355 return D3D_OK;
322356 }
323357 HRESULT WINAPI glDirect3D7::CreateVertexBuffer(LPD3DVERTEXBUFFERDESC lpVBDesc, LPDIRECT3DVERTEXBUFFER7* lplpD3DVertexBuffer, DWORD dwFlags)
324358 {
325 - if(!this) return DDERR_INVALIDPARAMS;
326 - if(!lplpD3DVertexBuffer) return DDERR_INVALIDPARAMS;
327 - if(!lpVBDesc) return DDERR_INVALIDPARAMS;
 359+ TRACE_ENTER(4,14,this,14,lpVBDesc,14,lplpD3DVertexBuffer,9,dwFlags);
 360+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 361+ if(!lplpD3DVertexBuffer) TRACE_RET(23,DDERR_INVALIDPARAMS);
 362+ if(!lpVBDesc) TRACE_RET(23,DDERR_INVALIDPARAMS);
328363 *lplpD3DVertexBuffer = (LPDIRECT3DVERTEXBUFFER7)new glDirect3DVertexBuffer7(this,*lpVBDesc,dwFlags);
 364+ TRACE_VAR("*lplpD3DVertexBuffer",14,*lplpD3DVertexBuffer);
 365+ TRACE_EXIT(23,D3D_OK);
329366 return D3D_OK;
330367 }
331368 HRESULT WINAPI glDirect3D7::CreateViewport(LPDIRECT3DVIEWPORT3* lplpD3DViewport, IUnknown* pUnkOuter)
332369 {
333 - if(!this) return DDERR_INVALIDPARAMS;
334 - if(!lplpD3DViewport) return DDERR_INVALIDPARAMS;
335 - if(pUnkOuter) return DDERR_INVALIDPARAMS;
 370+ TRACE_ENTER(3,14,this,14,lplpD3DViewport,14,pUnkOuter);
 371+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 372+ if(!lplpD3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
 373+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
336374 *lplpD3DViewport = new glDirect3DViewport3();
 375+ TRACE_VAR("*lplpD3DViewport",14,*lplpD3DViewport);
 376+ TRACE_EXIT(23,D3D_OK);
337377 return D3D_OK;
338378 }
339379 HRESULT WINAPI glDirect3D7::EnumDevices(LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPVOID lpUserArg)
340380 {
341 - if(!this) return DDERR_INVALIDPARAMS;
342 - if(!lpEnumDevicesCallback) return DDERR_INVALIDPARAMS;
 381+ TRACE_ENTER(3,14,this,14,lpEnumDevicesCallback,14,lpUserArg);
 382+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 383+ if(!lpEnumDevicesCallback) TRACE_RET(23,DDERR_INVALIDPARAMS);
343384 HRESULT result;
344385 D3DDEVICEDESC7 desc = d3ddesc;
345386 for(int i = 0; i < 3; i++)
@@ -360,25 +401,29 @@
361402 result = lpEnumDevicesCallback(devices[i].name,devices[i].devname,&desc,lpUserArg);
362403 if(result != D3DENUMRET_OK) break;
363404 }
 405+ TRACE_EXIT(23,D3D_OK);
364406 return D3D_OK;
365407 }
366408
367409 HRESULT WINAPI glDirect3D7::EnumDevices3(LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg)
368410 {
369 - if(!this) return DDERR_INVALIDPARAMS;
370 - if(!lpEnumDevicesCallback) return DDERR_INVALIDPARAMS;
 411+ TRACE_ENTER(3,14,this,14,lpEnumDevicesCallback,14,lpUserArg);
 412+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 413+ if(!lpEnumDevicesCallback) TRACE_RET(23,DDERR_INVALIDPARAMS);
371414 HRESULT result;
372415 D3DDEVICEDESC desc = d3ddesc3;
373416 GUID guid = IID_IDirect3DRGBDevice;
374417 result = lpEnumDevicesCallback(&guid,devices[0].name,devices[0].devname,&desc,&desc,lpUserArg);
375 - if(result != D3DENUMRET_OK) return D3D_OK;
 418+ if(result != D3DENUMRET_OK) TRACE_RET(23,D3D_OK);
376419 guid = IID_IDirect3DHALDevice;
377420 result = lpEnumDevicesCallback(&guid,devices[1].name,devices[1].devname,&desc,&desc,lpUserArg);
 421+ TRACE_EXIT(23,D3D_OK);
378422 return D3D_OK;
379423 }
380424 HRESULT WINAPI glDirect3D7::EnumZBufferFormats(REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext)
381425 {
382 - if(!this) return DDERR_INVALIDPARAMS;
 426+ TRACE_ENTER(4,14,this,24,&riidDevice,14,lpEnumCallback,14,lpContext);
 427+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
383428 DDPIXELFORMAT ddpf;
384429 ZeroMemory(&ddpf,sizeof(DDPIXELFORMAT));
385430 ddpf.dwSize = sizeof(DDPIXELFORMAT);
@@ -385,14 +430,14 @@
386431 ddpf.dwFlags = DDPF_ZBUFFER;
387432 ddpf.dwZBufferBitDepth = 16;
388433 ddpf.dwZBitMask = 0xffff;
389 - if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) return D3D_OK;
 434+ if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) TRACE_RET(23,D3D_OK);
390435 ddpf.dwZBufferBitDepth = 24;
391436 ddpf.dwZBitMask = 0xffffff00;
392 - if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) return D3D_OK;
 437+ if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) TRACE_RET(23,D3D_OK);
393438 ddpf.dwZBufferBitDepth = 32;
394 - if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) return D3D_OK;
 439+ if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) TRACE_RET(23,D3D_OK);
395440 ddpf.dwZBitMask = 0xffffffff;
396 - if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) return D3D_OK;
 441+ if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) TRACE_RET(23,D3D_OK);
397442 if(GLEXT_EXT_packed_depth_stencil || GLEXT_NV_packed_depth_stencil)
398443 {
399444 ddpf.dwZBufferBitDepth = 32;
@@ -399,25 +444,29 @@
400445 ddpf.dwStencilBitDepth = 8;
401446 ddpf.dwZBitMask = 0xffffff00;
402447 ddpf.dwStencilBitMask = 0xff;
403 - if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) return D3D_OK;
 448+ if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) TRACE_RET(23,D3D_OK);
404449 ddpf.dwZBitMask = 0x00ffffff;
405450 ddpf.dwStencilBitMask = 0xff000000;
406 - if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) return D3D_OK;
 451+ if(lpEnumCallback(&ddpf,lpContext) == D3DENUMRET_CANCEL) TRACE_RET(23,D3D_OK);
407452 }
 453+ TRACE_EXIT(23,D3D_OK);
408454 return D3D_OK;
409455 }
410456 HRESULT WINAPI glDirect3D7::EvictManagedTextures()
411457 {
 458+ TRACE_ENTER(1,14,this);
 459+ TRACE_EXIT(23,D3D_OK);
412460 return D3D_OK;
413461 }
414462
415463 HRESULT WINAPI glDirect3D7::FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR)
416464 {
417 - if(!this) return DDERR_INVALIDPARAMS;
418 - if(!lpD3DFDS) return DDERR_INVALIDPARAMS;
419 - if(!lpD3DFDR) return DDERR_INVALIDPARAMS;
420 - if(lpD3DFDR->dwSize < sizeof(D3DFINDDEVICERESULT)) return DDERR_INVALIDPARAMS;
421 - if(lpD3DFDS->dwSize < sizeof(D3DFINDDEVICESEARCH)) return DDERR_INVALIDPARAMS;
 465+ TRACE_ENTER(3,14,this,14,lpD3DFDS,14,lpD3DFDR);
 466+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 467+ if(!lpD3DFDS) TRACE_RET(23,DDERR_INVALIDPARAMS);
 468+ if(!lpD3DFDR) TRACE_RET(23,DDERR_INVALIDPARAMS);
 469+ if(lpD3DFDR->dwSize < sizeof(D3DFINDDEVICERESULT)) TRACE_RET(23,DDERR_INVALIDPARAMS);
 470+ if(lpD3DFDS->dwSize < sizeof(D3DFINDDEVICESEARCH)) TRACE_RET(23,DDERR_INVALIDPARAMS);
422471 bool found = true;
423472 GUID guid = IID_IDirect3DHALDevice;
424473 if((lpD3DFDS->dwFlags & D3DFDS_LINES) || (lpD3DFDS->dwFlags & D3DFDS_TRIANGLES))
@@ -492,10 +541,11 @@
493542 }
494543 else if(!lpD3DFDS->bHardware) guid = IID_IDirect3DRGBDevice;
495544 }
496 - if(!found) return DDERR_NOTFOUND;
 545+ if(!found) TRACE_RET(23,DDERR_NOTFOUND);
497546 if(guid == IID_IDirect3DRGBDevice) lpD3DFDR->ddSwDesc = d3ddesc3;
498547 else lpD3DFDR->ddHwDesc = d3ddesc3;
499548 lpD3DFDR->guid = guid;
 549+ TRACE_EXIT(23,D3D_OK);
500550 return D3D_OK;
501551 }
502552
@@ -503,74 +553,92 @@
504554 // IDirect3D3 wrapper
505555 glDirect3D3::glDirect3D3(glDirect3D7 *glD3D7)
506556 {
 557+ TRACE_ENTER(2,14,this,14,glD3D7);
507558 this->glD3D7 = glD3D7;
508559 refcount = 1;
 560+ TRACE_EXIT(-1,0);
509561 }
510562
511563 glDirect3D3::~glDirect3D3()
512564 {
 565+ TRACE_ENTER(1,14,this);
513566 glD3D7->Release();
514567 glD3D7->glD3D3 = NULL;
 568+ TRACE_EXIT(-1,0);
515569 }
516570
517571 HRESULT WINAPI glDirect3D3::QueryInterface(REFIID riid, void** ppvObj)
518572 {
519 - if(!this) return DDERR_INVALIDPARAMS;
 573+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 574+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
520575 if(riid == IID_IUnknown)
521576 {
522577 this->AddRef();
523578 *ppvObj = this;
 579+ TRACE_VAR("*ppvObj",14,*ppvObj);
 580+ TRACE_EXIT(23,DD_OK);
524581 return DD_OK;
525582 }
526 - return glD3D7->QueryInterface(riid,ppvObj);
 583+ TRACE_RET(23,glD3D7->QueryInterface(riid,ppvObj));
527584 }
528585
529586 ULONG WINAPI glDirect3D3::AddRef()
530587 {
531 - if(!this) return 0;
 588+ TRACE_ENTER(1,14,this);
 589+ if(!this) TRACE_RET(8,0);
532590 refcount++;
 591+ TRACE_EXIT(8,refcount);
533592 return refcount;
534593 }
535594
536595 ULONG WINAPI glDirect3D3::Release()
537596 {
538 - if(!this) return 0;
 597+ TRACE_ENTER(1,14,this);
 598+ if(!this) TRACE_RET(8,0);
539599 ULONG ret;
540600 refcount--;
541601 ret = refcount;
542602 if(refcount == 0) delete this;
 603+ TRACE_EXIT(8,ret);
543604 return ret;
544605 }
545606
546607 HRESULT WINAPI glDirect3D3::CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE4 lpDDS, LPDIRECT3DDEVICE3 *lplpD3DDevice, LPUNKNOWN pUnkOuter)
547608 {
548 - if(!this) return DDERR_INVALIDPARAMS;
549 - if(pUnkOuter) return DDERR_INVALIDPARAMS;
 609+ TRACE_ENTER(5,14,this,24,&rclsid,14,lpDDS,14,lplpD3DDevice,14,pUnkOuter);
 610+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 611+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
550612 LPDIRECT3DDEVICE7 lpD3DDev7;
551613 HRESULT err = glD3D7->CreateDevice(rclsid,((glDirectDrawSurface4*)lpDDS)->GetDDS7(),&lpD3DDev7);
552614 if(err == D3D_OK)
553615 {
554 - lpD3DDev7->QueryInterface(IID_IDirect3DDevice3,(LPVOID*) lplpD3DDevice);
 616+ lpD3DDev7->QueryInterface(IID_IDirect3DDevice3,(LPVOID*)lplpD3DDevice);
555617 lpD3DDev7->Release();
 618+ TRACE_VAR("*lplpD3DDevice",14,*lplpD3DDevice);
 619+ TRACE_EXIT(23,D3D_OK);
556620 return D3D_OK;
557621 }
 622+ TRACE_EXIT(23,err);
558623 return err;
559624 }
560625
561626 HRESULT WINAPI glDirect3D3::CreateLight(LPDIRECT3DLIGHT* lplpDirect3DLight, IUnknown* pUnkOuter)
562627 {
563 - if(!this) return DDERR_INVALIDPARAMS;
564 - return glD3D7->CreateLight(lplpDirect3DLight,pUnkOuter);
 628+ TRACE_ENTER(3,14,this,14,lplpDirect3DLight,14,pUnkOuter);
 629+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 630+ TRACE_RET(23,glD3D7->CreateLight(lplpDirect3DLight,pUnkOuter));
565631 }
566632 HRESULT WINAPI glDirect3D3::CreateMaterial(LPDIRECT3DMATERIAL3* lplpDirect3DMaterial, IUnknown* pUnkOuter)
567633 {
568 - if(!this) return DDERR_INVALIDPARAMS;
569 - return glD3D7->CreateMaterial(lplpDirect3DMaterial,pUnkOuter);
 634+ TRACE_ENTER(3,14,this,14,lplpDirect3DMaterial,14,pUnkOuter);
 635+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 636+ TRACE_RET(23,glD3D7->CreateMaterial(lplpDirect3DMaterial,pUnkOuter));
570637 }
571638 HRESULT WINAPI glDirect3D3::CreateVertexBuffer(LPD3DVERTEXBUFFERDESC lpVBDesc, LPDIRECT3DVERTEXBUFFER* lplpD3DVertexBuffer, DWORD dwFlags, LPUNKNOWN pUnkOuter)
572639 {
573 - if(!this) return DDERR_INVALIDPARAMS;
574 - if(pUnkOuter) return DDERR_INVALIDPARAMS;
 640+ TRACE_ENTER(5,14,this,14,lpVBDesc,14,lplpD3DVertexBuffer,9,dwFlags,14,pUnkOuter);
 641+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 642+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
575643 LPDIRECT3DVERTEXBUFFER7 lpD3DVB7;
576644 HRESULT err = glD3D7->CreateVertexBuffer(lpVBDesc,&lpD3DVB7,dwFlags);
577645 if(err == D3D_OK)
@@ -577,83 +645,104 @@
578646 {
579647 lpD3DVB7->QueryInterface(IID_IDirect3DVertexBuffer,(LPVOID*)lplpD3DVertexBuffer);
580648 lpD3DVB7->Release();
 649+ TRACE_VAR("*lplpD3DVertexBuffer",14,*lplpD3DVertexBuffer);
 650+ TRACE_EXIT(23,D3D_OK);
581651 return D3D_OK;
582652 }
 653+ TRACE_EXIT(23,err);
583654 return err;
584655 }
585656 HRESULT WINAPI glDirect3D3::CreateViewport(LPDIRECT3DVIEWPORT3* lplpD3DViewport, IUnknown* pUnkOuter)
586657 {
587 - if(!this) return DDERR_INVALIDPARAMS;
588 - return glD3D7->CreateViewport(lplpD3DViewport,pUnkOuter);
 658+ TRACE_ENTER(3,14,this,14,lplpD3DViewport,14,pUnkOuter);
 659+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 660+ TRACE_RET(23,glD3D7->CreateViewport(lplpD3DViewport,pUnkOuter));
589661 }
590662
591663 HRESULT WINAPI glDirect3D3::EnumDevices(LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg)
592664 {
593 - if(!this) return DDERR_INVALIDPARAMS;
594 - return glD3D7->EnumDevices3(lpEnumDevicesCallback,lpUserArg);
 665+ TRACE_ENTER(3,14,this,14,lpEnumDevicesCallback,14,lpUserArg);
 666+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 667+ TRACE_RET(23,glD3D7->EnumDevices3(lpEnumDevicesCallback,lpUserArg));
595668 }
596669
597670 HRESULT WINAPI glDirect3D3::EnumZBufferFormats(REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext)
598671 {
599 - if(!this) return DDERR_INVALIDPARAMS;
600 - return glD3D7->EnumZBufferFormats(riidDevice,lpEnumCallback,lpContext);
 672+ TRACE_ENTER(4,14,this,24,&riidDevice,14,lpEnumCallback,14,lpContext);
 673+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 674+ TRACE_RET(23,glD3D7->EnumZBufferFormats(riidDevice,lpEnumCallback,lpContext));
601675 }
602676 HRESULT WINAPI glDirect3D3::EvictManagedTextures()
603677 {
604 - if(!this) return DDERR_INVALIDPARAMS;
605 - return glD3D7->EvictManagedTextures();
 678+ TRACE_ENTER(1,14,this);
 679+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 680+ TRACE_RET(23,glD3D7->EvictManagedTextures());
606681 }
607682 HRESULT WINAPI glDirect3D3::FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR)
608683 {
609 - if(!this) return DDERR_INVALIDPARAMS;
610 - return glD3D7->FindDevice(lpD3DFDS,lpD3DFDR);
 684+ TRACE_ENTER(3,14,this,14,lpD3DFDS,14,lpD3DFDR);
 685+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 686+ TRACE_RET(23,glD3D7->FindDevice(lpD3DFDS,lpD3DFDR));
611687 }
612688
613689
614690 glDirect3D2::glDirect3D2(glDirect3D7 *glD3D7)
615691 {
 692+ TRACE_ENTER(2,14,this,14,glD3D7);
616693 this->glD3D7 = glD3D7;
617694 refcount = 1;
 695+ TRACE_EXIT(-1,0);
618696 }
619697
620698 glDirect3D2::~glDirect3D2()
621699 {
 700+ TRACE_ENTER(1,14,this);
622701 glD3D7->Release();
623702 glD3D7->glD3D2 = NULL;
 703+ TRACE_EXIT(-1,0);
624704 }
625705
626706 HRESULT WINAPI glDirect3D2::QueryInterface(REFIID riid, void** ppvObj)
627707 {
628 - if(!this) return DDERR_INVALIDPARAMS;
 708+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 709+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
629710 if(riid == IID_IUnknown)
630711 {
631712 this->AddRef();
632713 *ppvObj = this;
 714+ TRACE_VAR("*ppvObj",14,*ppvObj);
 715+ TRACE_ENTER(23,DD_OK);
633716 return DD_OK;
634717 }
635 - return glD3D7->QueryInterface(riid,ppvObj);
 718+ TRACE_RET(23,glD3D7->QueryInterface(riid,ppvObj));
636719 }
637720
638721 ULONG WINAPI glDirect3D2::AddRef()
639722 {
640 - if(!this) return 0;
 723+ TRACE_ENTER(1,14,this);
 724+ if(!this) TRACE_RET(8,0);
641725 refcount++;
 726+ TRACE_EXIT(8,refcount);
642727 return refcount;
643728 }
644729
645730 ULONG WINAPI glDirect3D2::Release()
646731 {
647 - if(!this) return 0;
 732+ TRACE_ENTER(1,14,this);
 733+ if(!this) TRACE_RET(8,0);
648734 ULONG ret;
649735 refcount--;
650736 ret = refcount;
651737 if(refcount == 0) delete this;
 738+ TRACE_EXIT(8,ret);
652739 return ret;
653740 }
654741
655742 HRESULT WINAPI glDirect3D2::CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DDEVICE2 *lplpD3DDevice)
656743 {
657 - if(!this) return DDERR_INVALIDPARAMS;
 744+ TRACE_ENTER(4,14,this,24,&rclsid,14,lpDDS,14,lplpD3DDevice);
 745+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 746+ if(!lplpD3DDevice) TRACE_RET(23,DDERR_INVALIDPARAMS);
658747 LPDIRECT3DDEVICE7 lpD3DDev7;
659748 HRESULT err = glD3D7->CreateDevice(rclsid,((glDirectDrawSurface1*)lpDDS)->GetDDS7(),&lpD3DDev7);
660749 if(err == D3D_OK)
@@ -660,138 +749,171 @@
661750 {
662751 lpD3DDev7->QueryInterface(IID_IDirect3DDevice2,(LPVOID*)lplpD3DDevice);
663752 lpD3DDev7->Release();
 753+ TRACE_VAR("*lplpD3DDevice",14,*lplpD3DDevice);
 754+ TRACE_EXIT(23,D3D_OK);
664755 return D3D_OK;
665756 }
 757+ TRACE_EXIT(23,err);
666758 return err;
667759 }
668760
669761 HRESULT WINAPI glDirect3D2::CreateLight(LPDIRECT3DLIGHT* lplpDirect3DLight, IUnknown* pUnkOuter)
670762 {
671 - if(!this) return DDERR_INVALIDPARAMS;
672 - return glD3D7->CreateLight(lplpDirect3DLight,pUnkOuter);
 763+ TRACE_ENTER(3,14,this,14,lplpDirect3DLight,14,pUnkOuter);
 764+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 765+ TRACE_RET(23,glD3D7->CreateLight(lplpDirect3DLight,pUnkOuter));
673766 }
674767
675768 HRESULT WINAPI glDirect3D2::CreateMaterial(LPDIRECT3DMATERIAL2* lplpDirect3DMaterial2, IUnknown* pUnkOuter)
676769 {
677 - if(!this) return DDERR_INVALIDPARAMS;
678 - if(!lplpDirect3DMaterial2) return DDERR_INVALIDPARAMS;
 770+ TRACE_ENTER(3,14,this,14,lplpDirect3DMaterial2,14,pUnkOuter);
 771+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 772+ if(!lplpDirect3DMaterial2) TRACE_RET(23,DDERR_INVALIDPARAMS);
679773 glDirect3DMaterial3 *glD3DM3;
680774 HRESULT error = glD3D7->CreateMaterial((LPDIRECT3DMATERIAL3*)&glD3DM3,pUnkOuter);
681 - if(FAILED(error)) return error;
 775+ if(FAILED(error)) TRACE_RET(23,error);
682776 glD3DM3->QueryInterface(IID_IDirect3DMaterial2,(void**)lplpDirect3DMaterial2);
683777 glD3DM3->Release();
 778+ TRACE_VAR("*lplpDirect3DMaterial2",14,*lplpDirect3DMaterial2);
 779+ TRACE_EXIT(23,D3D_OK);
684780 return D3D_OK;
685781 }
686782
687783 HRESULT WINAPI glDirect3D2::CreateViewport(LPDIRECT3DVIEWPORT2* lplpD3DViewport2, IUnknown* pUnkOuter)
688784 {
689 - if(!this) return DDERR_INVALIDPARAMS;
690 - if(!lplpD3DViewport2) return DDERR_INVALIDPARAMS;
 785+ TRACE_ENTER(3,14,this,14,lplpD3DViewport2,14,pUnkOuter);
 786+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 787+ if(!lplpD3DViewport2) TRACE_RET(23,DDERR_INVALIDPARAMS);
691788 glDirect3DMaterial3 *glD3DV3;
692789 HRESULT error = glD3D7->CreateViewport((LPDIRECT3DVIEWPORT3*)&glD3DV3,pUnkOuter);
693 - if(FAILED(error)) return error;
 790+ if(FAILED(error)) TRACE_RET(23,error);
694791 glD3DV3->QueryInterface(IID_IDirect3DViewport2,(void**)lplpD3DViewport2);
695792 glD3DV3->Release();
 793+ TRACE_VAR("*lplpD3DViewport2",14,*lplpD3DViewport2);
 794+ TRACE_EXIT(23,D3D_OK);
696795 return D3D_OK;
697796 }
698797
699798 HRESULT WINAPI glDirect3D2::EnumDevices(LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg)
700799 {
701 - if(!this) return DDERR_INVALIDPARAMS;
702 - return glD3D7->EnumDevices3(lpEnumDevicesCallback,lpUserArg);
 800+ TRACE_ENTER(3,14,this,14,lpEnumDevicesCallback,14,lpUserArg);
 801+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 802+ TRACE_RET(23,glD3D7->EnumDevices3(lpEnumDevicesCallback,lpUserArg));
703803 }
704804
705805 HRESULT WINAPI glDirect3D2::FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR)
706806 {
707 - if(!this) return DDERR_INVALIDPARAMS;
708 - return glD3D7->FindDevice(lpD3DFDS,lpD3DFDR);
 807+ TRACE_ENTER(3,14,this,14,lpD3DFDS,14,lpD3DFDR);
 808+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 809+ TRACE_RET(23,glD3D7->FindDevice(lpD3DFDS,lpD3DFDR));
709810 }
710811
711812 glDirect3D1::glDirect3D1(glDirect3D7 *glD3D7)
712813 {
 814+ TRACE_ENTER(2,14,this,14,glD3D7);
713815 this->glD3D7 = glD3D7;
714816 refcount = 1;
 817+ TRACE_EXIT(-1,0);
715818 }
716819
717820 glDirect3D1::~glDirect3D1()
718821 {
 822+ TRACE_ENTER(1,14,this);
719823 glD3D7->Release();
720824 glD3D7->glD3D1 = NULL;
 825+ TRACE_EXIT(-1,0);
721826 }
722827
723828 HRESULT WINAPI glDirect3D1::QueryInterface(REFIID riid, void** ppvObj)
724829 {
725 - if(!this) return DDERR_INVALIDPARAMS;
 830+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 831+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
726832 if(riid == IID_IUnknown)
727833 {
728834 this->AddRef();
729835 *ppvObj = this;
 836+ TRACE_VAR("*ppvObj",14,*ppvObj);
 837+ TRACE_EXIT(23,DD_OK);
730838 return DD_OK;
731839 }
732 - return glD3D7->QueryInterface(riid,ppvObj);
 840+ TRACE_RET(23,glD3D7->QueryInterface(riid,ppvObj));
733841 }
734842
735843 ULONG WINAPI glDirect3D1::AddRef()
736844 {
737 - if(!this) return 0;
 845+ TRACE_ENTER(1,14,this);
 846+ if(!this) TRACE_RET(8,0);
738847 refcount++;
 848+ TRACE_EXIT(8,refcount);
739849 return refcount;
740850 }
741851
742852 ULONG WINAPI glDirect3D1::Release()
743853 {
744 - if(!this) return 0;
 854+ TRACE_ENTER(1,14,this);
 855+ if(!this) TRACE_RET(8,0);
745856 ULONG ret;
746857 refcount--;
747858 ret = refcount;
748859 if(refcount == 0) delete this;
 860+ TRACE_EXIT(8,ret);
749861 return ret;
750862 }
751863
752864 HRESULT WINAPI glDirect3D1::CreateLight(LPDIRECT3DLIGHT* lplpDirect3DLight, IUnknown* pUnkOuter)
753865 {
754 - if(!this) return DDERR_INVALIDPARAMS;
755 - return glD3D7->CreateLight(lplpDirect3DLight,pUnkOuter);
 866+ TRACE_ENTER(3,14,this,14,pUnkOuter);
 867+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 868+ TRACE_RET(23,glD3D7->CreateLight(lplpDirect3DLight,pUnkOuter));
756869 }
757870
758871 HRESULT WINAPI glDirect3D1::CreateMaterial(LPDIRECT3DMATERIAL* lplpDirect3DMaterial, IUnknown* pUnkOuter)
759872 {
760 - if(!this) return DDERR_INVALIDPARAMS;
761 - if(!lplpDirect3DMaterial) return DDERR_INVALIDPARAMS;
 873+ TRACE_ENTER(3,14,this,14,lplpDirect3DMaterial,14,pUnkOuter);
 874+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 875+ if(!lplpDirect3DMaterial) TRACE_RET(23,DDERR_INVALIDPARAMS);
762876 glDirect3DMaterial3 *glD3DM3;
763877 HRESULT error = glD3D7->CreateMaterial((LPDIRECT3DMATERIAL3*)&glD3DM3,pUnkOuter);
764 - if(FAILED(error)) return error;
 878+ if(FAILED(error)) TRACE_RET(23,error);
765879 glD3DM3->QueryInterface(IID_IDirect3DMaterial,(void**)lplpDirect3DMaterial);
766880 glD3DM3->Release();
 881+ TRACE_VAR("*lplpDirect3DMaterial",14,*lplpDirect3DMaterial);
 882+ TRACE_EXIT(23,D3D_OK);
767883 return D3D_OK;
768884 }
769885
770886 HRESULT WINAPI glDirect3D1::CreateViewport(LPDIRECT3DVIEWPORT* lplpD3DViewport, IUnknown* pUnkOuter)
771887 {
772 - if(!this) return DDERR_INVALIDPARAMS;
773 - if(!lplpD3DViewport) return DDERR_INVALIDPARAMS;
 888+ TRACE_ENTER(3,14,this,14,lplpD3DViewport,14,pUnkOuter);
 889+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 890+ if(!lplpD3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
774891 glDirect3DMaterial3 *glD3DV3;
775892 HRESULT error = glD3D7->CreateViewport((LPDIRECT3DVIEWPORT3*)&glD3DV3,pUnkOuter);
776 - if(FAILED(error)) return error;
 893+ if(FAILED(error)) TRACE_RET(23,error);
777894 glD3DV3->QueryInterface(IID_IDirect3DViewport,(void**)lplpD3DViewport);
778895 glD3DV3->Release();
 896+ TRACE_VAR("*lplpD3DViewport",14,*lplpD3DViewport);
 897+ TRACE_EXIT(23,D3D_OK);
779898 return D3D_OK;
780899 }
781900
782901 HRESULT WINAPI glDirect3D1::EnumDevices(LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg)
783902 {
784 - if(!this) return DDERR_INVALIDPARAMS;
785 - return glD3D7->EnumDevices3(lpEnumDevicesCallback,lpUserArg);
 903+ TRACE_ENTER(3,14,this,14,lpEnumDevicesCallback,14,lpUserArg);
 904+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 905+ TRACE_RET(23,glD3D7->EnumDevices3(lpEnumDevicesCallback,lpUserArg));
786906 }
787907
788908 HRESULT WINAPI glDirect3D1::FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICERESULT lpD3DFDR)
789909 {
790 - if(!this) return DDERR_INVALIDPARAMS;
791 - return glD3D7->FindDevice(lpD3DFDS,lpD3DFDR);
 910+ TRACE_ENTER(3,14,this,14,lpD3DFDS,14,lpD3DFDR);
 911+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 912+ TRACE_RET(23,glD3D7->FindDevice(lpD3DFDS,lpD3DFDR));
792913 }
793914
794915 HRESULT WINAPI glDirect3D1::Initialize(REFIID lpREFIID)
795916 {
796 - if(!this) return DDERR_INVALIDPARAMS;
797 - return DDERR_ALREADYINITIALIZED;
 917+ TRACE_ENTER(2,14,this,24,&lpREFIID);
 918+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 919+ TRACE_RET(23,DDERR_ALREADYINITIALIZED);
798920 }