DXGL r360 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r359‎ | r360 | r361 >
Date:13:12, 23 March 2013
Author:admin
Status:new
Tags:
Comment:
Trace glDirect3DDevice.cpp
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -274,6 +274,7 @@
275275
276276 glDirect3DDevice7::glDirect3DDevice7(REFCLSID rclsid, glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
277277 {
 278+ TRACE_ENTER(4,14,this,24,&rclsid,14,glD3D7,14,glDDS7);
278279 int zbuffer = 0;
279280 glD3DDev3 = NULL;
280281 glD3DDev2 = NULL;
@@ -283,6 +284,7 @@
284285 if(!materials)
285286 {
286287 error = DDERR_OUTOFMEMORY;
 288+ TRACE_EXIT(-1,0);
287289 return;
288290 }
289291 materialcount = 1;
@@ -294,6 +296,7 @@
295297 {
296298 free(materials);
297299 error = DDERR_OUTOFMEMORY;
 300+ TRACE_EXIT(-1,0);
298301 return;
299302 }
300303 texturecount = 1;
@@ -307,6 +310,7 @@
308311 free(materials);
309312 free(textures);
310313 error = DDERR_OUTOFMEMORY;
 314+ TRACE_EXIT(-1,0);
311315 return;
312316 }
313317 ZeroMemory(viewports,32*sizeof(glDirect3DViewport3*));
@@ -346,6 +350,7 @@
347351 free(textures);
348352 free(viewports);
349353 error = DDERR_OUTOFMEMORY;
 354+ TRACE_EXIT(-1,0);
350355 return;
351356 }
352357 ZeroMemory(lights,16*sizeof(glDirect3DLight*));
@@ -361,9 +366,11 @@
362367 mhWorld = mhView = mhProjection = 0;
363368 renderer->InitD3D(zbuffer);
364369 error = D3D_OK;
 370+ TRACE_EXIT(-1,0);
365371 }
366372 glDirect3DDevice7::~glDirect3DDevice7()
367373 {
 374+ TRACE_ENTER(1,14,this);
368375 for(int i = 0; i < lightsmax; i++)
369376 if(lights[i]) delete lights[i];
370377 delete lights;
@@ -391,6 +398,7 @@
392399 if(matrices) free(matrices);
393400 glD3D7->Release();
394401 glDDS7->Release();
 402+ TRACE_EXIT(-1,0);
395403 }
396404
397405 int ExpandLightBuffer(glDirect3DLight ***lights, DWORD *maxlights, DWORD newmax)
@@ -407,12 +415,15 @@
408416
409417 HRESULT WINAPI glDirect3DDevice7::QueryInterface(REFIID riid, void** ppvObj)
410418 {
411 - if(!this) return DDERR_INVALIDOBJECT;
412 - if(!ppvObj) return DDERR_INVALIDPARAMS;
 419+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 420+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 421+ if(!ppvObj) TRACE_RET(23,DDERR_INVALIDPARAMS);
413422 if(riid == IID_IUnknown)
414423 {
415424 this->AddRef();
416425 *ppvObj = this;
 426+ TRACE_VAR("*ppvObj",14,*ppvObj);
 427+ TRACE_EXIT(23,D3D_OK);
417428 return D3D_OK;
418429 }
419430 if(riid == IID_IDirect3DDevice7)
@@ -419,6 +430,8 @@
420431 {
421432 this->AddRef();
422433 *ppvObj = this;
 434+ TRACE_VAR("*ppvObj",14,*ppvObj);
 435+ TRACE_EXIT(23,D3D_OK);
423436 return D3D_OK;
424437 }
425438 if(riid == IID_IDirect3DDevice3)
@@ -427,6 +440,8 @@
428441 {
429442 *ppvObj = glD3DDev3;
430443 glD3DDev3->AddRef();
 444+ TRACE_VAR("*ppvObj",14,*ppvObj);
 445+ TRACE_EXIT(23,D3D_OK);
431446 return D3D_OK;
432447 }
433448 else
@@ -434,6 +449,8 @@
435450 this->AddRef();
436451 *ppvObj = new glDirect3DDevice3(this);
437452 glD3DDev3 = (glDirect3DDevice3*)*ppvObj;
 453+ TRACE_VAR("*ppvObj",14,*ppvObj);
 454+ TRACE_EXIT(23,D3D_OK);
438455 return D3D_OK;
439456 }
440457 }
@@ -443,6 +460,8 @@
444461 {
445462 *ppvObj = glD3DDev2;
446463 glD3DDev2->AddRef();
 464+ TRACE_VAR("*ppvObj",14,*ppvObj);
 465+ TRACE_EXIT(23,D3D_OK);
447466 return D3D_OK;
448467 }
449468 else
@@ -450,6 +469,8 @@
451470 this->AddRef();
452471 *ppvObj = new glDirect3DDevice2(this);
453472 glD3DDev2 = (glDirect3DDevice2*)*ppvObj;
 473+ TRACE_VAR("*ppvObj",14,*ppvObj);
 474+ TRACE_EXIT(23,D3D_OK);
454475 return D3D_OK;
455476 }
456477 }
@@ -459,6 +480,8 @@
460481 {
461482 *ppvObj = glD3DDev1;
462483 glD3DDev1->AddRef();
 484+ TRACE_VAR("*ppvObj",14,*ppvObj);
 485+ TRACE_EXIT(23,D3D_OK);
463486 return D3D_OK;
464487 }
465488 else
@@ -466,89 +489,114 @@
467490 this->AddRef();
468491 *ppvObj = new glDirect3DDevice1(this);
469492 glD3DDev1 = (glDirect3DDevice1*)*ppvObj;
 493+ TRACE_VAR("*ppvObj",14,*ppvObj);
 494+ TRACE_EXIT(23,D3D_OK);
470495 return D3D_OK;
471496 }
472497 }
 498+ TRACE_EXIT(23,E_NOINTERFACE);
473499 return E_NOINTERFACE;
474500 }
475501
476502 ULONG WINAPI glDirect3DDevice7::AddRef()
477503 {
478 - if(!this) return 0;
 504+ TRACE_ENTER(1,14,this);
 505+ if(!this) TRACE_RET(8,0);
479506 refcount++;
 507+ TRACE_EXIT(8,refcount);
480508 return refcount;
481509 }
482510 ULONG WINAPI glDirect3DDevice7::Release()
483511 {
484 - if(!this) return 0;
 512+ TRACE_ENTER(1,14,this);
 513+ if(!this) TRACE_RET(8,0);
485514 ULONG ret;
486515 refcount--;
487516 ret = refcount;
488517 if(refcount == 0) delete this;
 518+ TRACE_EXIT(8,ret);
489519 return ret;
490520 }
491521
492522 HRESULT WINAPI glDirect3DDevice7::ApplyStateBlock(DWORD dwBlockHandle)
493523 {
494 - if(!this) return DDERR_INVALIDOBJECT;
 524+ TRACE_ENTER(2,14,this,9,dwBlockHandle);
 525+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
495526 FIXME("glDirect3DDevice7::ApplyStateBlock: stub");
 527+ TRACE_EXIT(23,DDERR_GENERIC);
496528 ERR(DDERR_GENERIC);
497529 }
498530 HRESULT WINAPI glDirect3DDevice7::BeginScene()
499531 {
500 - if(!this) return DDERR_INVALIDOBJECT;
501 - if(inscene) return D3DERR_SCENE_IN_SCENE;
 532+ TRACE_ENTER(1,14,this);
 533+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 534+ if(inscene) TRACE_RET(23,D3DERR_SCENE_IN_SCENE);
502535 inscene = true;
 536+ TRACE_EXIT(23,D3D_OK);
503537 return D3D_OK;
504538 }
505539 HRESULT WINAPI glDirect3DDevice7::BeginStateBlock()
506540 {
507 - if(!this) return DDERR_INVALIDOBJECT;
 541+ TRACE_ENTER(1,14,this);
 542+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
508543 FIXME("glDirect3DDevice7::BeginStateBlock: stub");
 544+ TRACE_EXIT(23,D3D_OK);
509545 ERR(DDERR_GENERIC);
510546 }
511547 HRESULT WINAPI glDirect3DDevice7::CaptureStateBlock(DWORD dwBlockHandle)
512548 {
513 - if(!this) return DDERR_INVALIDOBJECT;
 549+ TRACE_ENTER(2,14,this,9,dwBlockHandle);
 550+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
514551 FIXME("glDirect3DDevice7::CaptureStateBlock: stub");
 552+ TRACE_EXIT(23,D3D_OK);
515553 ERR(DDERR_GENERIC);
516554 }
517555 HRESULT WINAPI glDirect3DDevice7::CreateStateBlock(D3DSTATEBLOCKTYPE d3dsbtype, LPDWORD lpdwBlockHandle)
518556 {
519 - if(!this) return DDERR_INVALIDOBJECT;
 557+ TRACE_ENTER(3,14,this,9,d3dsbtype,14,lpdwBlockHandle);
 558+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
520559 FIXME("glDirect3DDevice7::CreateStateBlock: stub");
 560+ TRACE_EXIT(23,D3D_OK);
521561 ERR(DDERR_GENERIC);
522562 }
523563 HRESULT WINAPI glDirect3DDevice7::Clear(DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil)
524564 {
525 - if(!this) return DDERR_INVALIDOBJECT;
526 - if(dwCount && !lpRects) return DDERR_INVALIDPARAMS;
527 - return renderer->Clear(glDDS7,dwCount,lpRects,dwFlags,dwColor,dvZ,dwStencil);
 565+ TRACE_ENTER(7,14,this,8,dwCount,14,lpRects,9,dwFlags,9,dwColor,19,&dvZ,9,dwStencil);
 566+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 567+ if(dwCount && !lpRects) TRACE_RET(23,DDERR_INVALIDPARAMS);
 568+ TRACE_RET(23,renderer->Clear(glDDS7,dwCount,lpRects,dwFlags,dwColor,dvZ,dwStencil));
528569 }
529570 HRESULT WINAPI glDirect3DDevice7::ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres,
530571 DWORD dwFlags, LPDWORD lpdwReturnValues)
531572 {
532 - if(!this) return DDERR_INVALIDOBJECT;
 573+ TRACE_ENTER(6,14,this,14,lpCenters,14,lpRadii,8,dwNumSpheres,9,dwFlags,14,lpdwReturnValues);
 574+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
533575 FIXME("glDirect3DDevice7::ComputeSphereVisibility: stub");
 576+ TRACE_EXIT(23,DDERR_GENERIC);
534577 ERR(DDERR_GENERIC);
535578 }
536579 HRESULT WINAPI glDirect3DDevice7::DeleteStateBlock(DWORD dwBlockHandle)
537580 {
538 - if(!this) return DDERR_INVALIDOBJECT;
 581+ TRACE_ENTER(2,14,this,9,dwBlockHandle);
 582+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
539583 FIXME("glDirect3DDevice7::DeleteStateBlock: stub");
 584+ TRACE_EXIT(23,DDERR_GENERIC);
540585 ERR(DDERR_GENERIC);
541586 }
542587
543588 void glDirect3DDevice7::SetArraySize(DWORD size, DWORD vertex, DWORD texcoord)
544589 {
 590+ TRACE_ENTER(4,14,this,8,size,8,vertex,8,texcoord);
545591 if(!vertices) vertices = (GLfloat*)malloc(size*4*sizeof(GLfloat));
546592 else if(size > maxarray) vertices = (GLfloat*)realloc(vertices,size*4*sizeof(GLfloat));
547593 if(!normals) normals = (GLfloat*)malloc(size*4*sizeof(GLfloat));
548594 else if(size > maxarray) normals = (GLfloat*)realloc(normals,size*4*sizeof(GLfloat));
 595+ TRACE_EXIT(0,0);
549596 }
550597
551598 __int64 glDirect3DDevice7::SelectShader(GLVERTEX *VertexType)
552599 {
 600+ TRACE_ENTER(2,14,this,14,VertexType);
553601 int i;
554602 __int64 shader = 0;
555603 switch(renderstate[D3DRENDERSTATE_SHADEMODE])
@@ -650,15 +698,17 @@
651699 if(texstages[i].texture->ddsd.dwFlags & DDSD_CKSRCBLT) texstages[i].shaderid |= 1i64 << 60;
652700 }
653701 }
 702+ TRACE_EXIT(10,&shader);
654703 return shader;
655704 }
656705
657706 HRESULT glDirect3DDevice7::fvftoglvertex(DWORD dwVertexTypeDesc,LPDWORD vertptr)
658707 {
 708+ TRACE_ENTER(3,14,this,9,dwVertexTypeDesc,14,vertptr);
659709 int i;
660710 int ptr = 0;
661711 if((dwVertexTypeDesc & D3DFVF_XYZ) && (dwVertexTypeDesc & D3DFVF_XYZRHW))
662 - return DDERR_INVALIDPARAMS;
 712+ TRACE_RET(23,DDERR_INVALIDPARAMS);
663713 if(dwVertexTypeDesc & D3DFVF_XYZ)
664714 {
665715 vertdata[0].data = vertptr;
@@ -672,7 +722,7 @@
673723 vertdata[1].data = &vertptr[3];
674724 ptr += 4;
675725 }
676 - else return DDERR_INVALIDPARAMS;
 726+ else TRACE_RET(23,DDERR_INVALIDPARAMS);
677727 for(i = 0; i < 5; i++)
678728 vertdata[i+2].data = NULL;
679729 if(((dwVertexTypeDesc >> 1) & 7) >= 3)
@@ -728,6 +778,7 @@
729779 int stride = NextMultipleOf8(ptr*4);
730780 for(i = 0; i < 17; i++)
731781 vertdata[i].stride = stride;
 782+ TRACE_EXIT(23,D3D_OK);
732783 return D3D_OK;
733784 }
734785
@@ -734,67 +785,82 @@
735786 HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
736787 LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
737788 {
738 - if(!this) return DDERR_INVALIDOBJECT;
739 - if(!inscene) return D3DERR_SCENE_NOT_IN_SCENE;
 789+ TRACE_ENTER(8,9,d3dptPrimitiveType,9,dwVertexTypeDesc,14,lpvVertices,8,dwVertexCount,14,lpwIndices,8,dwIndexCount,9,dwFlags);
 790+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 791+ if(!inscene) TRACE_RET(23,D3DERR_SCENE_NOT_IN_SCENE);
740792 HRESULT err = fvftoglvertex(dwVertexTypeDesc,(LPDWORD)lpvVertices);
741793 if(lpwIndices) AddStats(d3dptPrimitiveType,dwIndexCount,&stats);
742794 else AddStats(d3dptPrimitiveType,dwVertexCount,&stats);
743 - if(err != D3D_OK) return err;
744 - return renderer->DrawPrimitives(this,setdrawmode(d3dptPrimitiveType),vertdata,texformats,
745 - dwVertexCount,lpwIndices,dwIndexCount,dwFlags);
 795+ if(err != D3D_OK) TRACE_RET(23,err);
 796+ TRACE_RET(23,renderer->DrawPrimitives(this,setdrawmode(d3dptPrimitiveType),vertdata,texformats,
 797+ dwVertexCount,lpwIndices,dwIndexCount,dwFlags));
746798 }
747799 HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
748 - LPD3DDRAWPRIMITIVESTRIDEDDATA lpvVerticexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
 800+ LPD3DDRAWPRIMITIVESTRIDEDDATA lpvVertexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
749801 {
750 - if(!this) return DDERR_INVALIDOBJECT;
 802+ TRACE_ENTER(8,14,this,9,d3dptPrimitiveType,9,dwVertexTypeDesc,14,lpvVertexArray,8,dwVertexCount,14,lpwIndices,8,dwIndexCount,9,dwFlags);
 803+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
751804 FIXME("glDirect3DDevice7::DrawIndexedPrimitiveStrided: stub");
 805+ TRACE_EXIT(23,DDERR_GENERIC);
752806 ERR(DDERR_GENERIC);
753807 }
754808 HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
755809 DWORD dwStartVertex, DWORD dwNumVertices, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
756810 {
757 - if(!this) return DDERR_INVALIDOBJECT;
 811+ TRACE_ENTER(8,14,this,9,d3dptPrimitiveType,14,lpd3dVertexBuffer,8,dwStartVertex,8,dwNumVertices,9,lpwIndices,8,dwIndexCount,9,dwFlags);
 812+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
758813 FIXME("glDirect3DDevice7::DrawIndexedPrimitiveVB: stub");
 814+ TRACE_EXIT(23,DDERR_GENERIC);
759815 ERR(DDERR_GENERIC);
760816 }
761817 HRESULT WINAPI glDirect3DDevice7::DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpVertices,
762818 DWORD dwVertexCount, DWORD dwFlags)
763819 {
764 - if(!this) return DDERR_INVALIDOBJECT;
765 - return DrawIndexedPrimitive(dptPrimitiveType,dwVertexTypeDesc,lpVertices,dwVertexCount,NULL,0,dwFlags);
 820+ TRACE_ENTER(6,14,this,9,dptPrimitiveType,9,dwVertexTypeDesc,14,lpVertices,8,dwVertexCount,9,dwFlags);
 821+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 822+ TRACE_RET(23,DrawIndexedPrimitive(dptPrimitiveType,dwVertexTypeDesc,lpVertices,dwVertexCount,NULL,0,dwFlags));
766823 }
767824 HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveStrided(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc,
768825 LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, DWORD dwFlags)
769826 {
770 - if(!this) return DDERR_INVALIDOBJECT;
 827+ TRACE_ENTER(6,14,this,9,dptPrimitiveType,9,dwVertexTypeDesc,14,lpVertexArray,8,dwVertexCount,9,dwFlags);
 828+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
771829 FIXME("glDirect3DDevice7::DrawPrimitiveStrided: stub");
 830+ TRACE_EXIT(23,DDERR_GENERIC);
772831 ERR(DDERR_GENERIC);
773832 }
774833 HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
775834 DWORD dwStartVertex, DWORD dwNumVertices, DWORD dwFlags)
776835 {
777 - if(!this) return DDERR_INVALIDOBJECT;
 836+ TRACE_ENTER(5,14,this,9,d3dptPrimitiveType,14,lpd3dVertexBuffer,8,dwStartVertex,8,dwNumVertices,9,dwFlags);
 837+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
778838 FIXME("glDirect3DDevice7::DrawPrimitiveVB: stub");
 839+ TRACE_EXIT(23,DDERR_GENERIC);
779840 ERR(DDERR_GENERIC);
780841 }
781842 HRESULT WINAPI glDirect3DDevice7::EndScene()
782843 {
783 - if(!this) return DDERR_INVALIDOBJECT;
784 - if(!inscene) return D3DERR_SCENE_NOT_IN_SCENE;
 844+ TRACE_ENTER(1,14,this);
 845+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 846+ if(!inscene) TRACE_RET(23,D3DERR_SCENE_NOT_IN_SCENE);
785847 inscene = false;
786848 renderer->Flush();
 849+ TRACE_EXIT(23,D3D_OK);
787850 return D3D_OK;
788851 }
789852 HRESULT WINAPI glDirect3DDevice7::EndStateBlock(LPDWORD lpdwBlockHandle)
790853 {
791 - if(!this) return DDERR_INVALIDOBJECT;
 854+ TRACE_ENTER(2,14,this,14,lpdwBlockHandle);
 855+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
792856 FIXME("glDirect3DDevice7::EndStateBlock: stub");
 857+ TRACE_EXIT(23,DDERR_GENERIC);
793858 ERR(DDERR_GENERIC);
794859 }
795860
796861 HRESULT WINAPI glDirect3DDevice7::EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg)
797862 {
798 - if(!this) return DDERR_INVALIDOBJECT;
 863+ TRACE_ENTER(3,14,this,14,lpd3dEnumPixelProc,14,lpArg);
 864+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
799865 HRESULT result;
800866 DDPIXELFORMAT fmt;
801867 for(int i = 0; i < numtexformats; i++)
@@ -803,226 +869,264 @@
804870 if(::texformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
805871 memcpy(&fmt,&::texformats[i],sizeof(DDPIXELFORMAT));
806872 result = lpd3dEnumPixelProc(&fmt,lpArg);
807 - if(result != D3DENUMRET_OK) return D3D_OK;
 873+ if(result != D3DENUMRET_OK) TRACE_RET(23,D3D_OK);
808874 }
 875+ TRACE_EXIT(23,D3D_OK);
809876 return D3D_OK;
810877 }
811878 HRESULT WINAPI glDirect3DDevice7::GetCaps(LPD3DDEVICEDESC7 lpD3DDevDesc)
812879 {
813 - if(!this) return DDERR_INVALIDOBJECT;
 880+ TRACE_ENTER(2,14,this,14,lpD3DDevDesc);
 881+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
814882 D3DDEVICEDESC7 desc = d3ddesc;
815883 desc.dwDevCaps |= D3DDEVCAPS_HWRASTERIZATION | D3DDEVCAPS_HWTRANSFORMANDLIGHT;
816884 desc.deviceGUID = IID_IDirect3DTnLHalDevice;
817885 memcpy(lpD3DDevDesc,&desc,sizeof(D3DDEVICEDESC7));
 886+ TRACE_EXIT(23,D3D_OK);
818887 return D3D_OK;
819888 }
820889 HRESULT WINAPI glDirect3DDevice7::GetClipPlane(DWORD dwIndex, D3DVALUE *pPlaneEquation)
821890 {
822 - if(!this) return DDERR_INVALIDOBJECT;
 891+ TRACE_ENTER(3,14,this,8,dwIndex,9,pPlaneEquation);
 892+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
823893 FIXME("glDirect3DDevice7::GetClipPlane: stub");
 894+ TRACE_EXIT(23,DDERR_GENERIC);
824895 ERR(DDERR_GENERIC);
825896 }
826897 HRESULT WINAPI glDirect3DDevice7::GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
827898 {
828 - if(!this) return DDERR_INVALIDOBJECT;
 899+ TRACE_ENTER(2,14,this,14,lpD3DClipStatus);
 900+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
829901 FIXME("glDirect3DDevice7::GetClipStatus: stub");
 902+ TRACE_EXIT(23,DDERR_GENERIC);
830903 ERR(DDERR_GENERIC);
831904 }
832905 HRESULT WINAPI glDirect3DDevice7::GetDirect3D(LPDIRECT3D7 *lplpD3D)
833906 {
834 - if(!this) return DDERR_INVALIDOBJECT;
 907+ TRACE_ENTER(2,14,this,14,lplpD3D);
 908+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 909+ if(!lplpD3D) TRACE_RET(23,DDERR_INVALIDPARAMS);
835910 *lplpD3D = glD3D7;
836911 glD3D7->AddRef();
 912+ TRACE_VAR("*lplpD3D",14,*lplpD3D);
 913+ TRACE_EXIT(23,D3D_OK);
837914 return D3D_OK;
838915 }
839916 HRESULT WINAPI glDirect3DDevice7::GetInfo(DWORD dwDevInfoID, LPVOID pDevInfoStruct, DWORD dwSize)
840917 {
841 - if(!this) return DDERR_INVALIDOBJECT;
 918+ TRACE_ENTER(4,14,this,9,dwDevInfoID,14,pDevInfoStruct,8,dwSize);
 919+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
842920 FIXME("glDirect3DDevice7::GetInfo: stub");
 921+ TRACE_EXIT(23,DDERR_GENERIC);
843922 ERR(DDERR_GENERIC);
844923 }
845924 HRESULT WINAPI glDirect3DDevice7::GetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight)
846925 {
847 - if(!this) return DDERR_INVALIDOBJECT;
848 - if(!lpLight) return DDERR_INVALIDPARAMS;
849 - if(dwLightIndex >= lightsmax) ERR(DDERR_INVALIDOBJECT);
850 - if(!lights[dwLightIndex]) ERR(DDERR_INVALIDOBJECT);
 926+ TRACE_ENTER(3,14,this,8,dwLightIndex,14,lpLight);
 927+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 928+ if(!lpLight) TRACE_RET(23,DDERR_INVALIDPARAMS);
 929+ if(dwLightIndex >= lightsmax) TRACE_RET(23,DDERR_INVALIDOBJECT);
 930+ if(!lights[dwLightIndex]) TRACE_RET(23,DDERR_INVALIDOBJECT);
851931 lights[dwLightIndex]->GetLight7(lpLight);
 932+ TRACE_EXIT(23,D3D_OK);
852933 return D3D_OK;
853934 }
854935 HRESULT WINAPI glDirect3DDevice7::GetLightEnable(DWORD dwLightIndex, BOOL* pbEnable)
855936 {
856 - if(!this) return DDERR_INVALIDOBJECT;
857 - if(dwLightIndex >= lightsmax) ERR(DDERR_INVALIDOBJECT);
858 - if(!lights[dwLightIndex]) ERR(DDERR_INVALIDOBJECT);
859 - if(!pbEnable) return DDERR_INVALIDPARAMS;
 937+ TRACE_ENTER(3,14,this,8,dwLightIndex,14,pbEnable);
 938+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 939+ if(dwLightIndex >= lightsmax) TRACE_RET(23,DDERR_INVALIDOBJECT);
 940+ if(!lights[dwLightIndex]) TRACE_RET(23,DDERR_INVALIDOBJECT);
 941+ if(!pbEnable) TRACE_RET(23,DDERR_INVALIDPARAMS);
860942 *pbEnable = FALSE;
861943 for(int i = 0; i < 8; i++)
862944 if(gllights[i] == dwLightIndex) *pbEnable = TRUE;
 945+ TRACE_VAR("*pbEnable",22,*pbEnable);
 946+ TRACE_EXIT(23,D3D_OK);
863947 return D3D_OK;
864948 }
865949 HRESULT WINAPI glDirect3DDevice7::GetMaterial(LPD3DMATERIAL7 lpMaterial)
866950 {
867 - if(!this) return DDERR_INVALIDOBJECT;
868 - if(!lpMaterial) return DDERR_INVALIDPARAMS;
 951+ TRACE_ENTER(2,14,this,14,lpMaterial);
 952+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 953+ if(!lpMaterial) TRACE_RET(23,DDERR_INVALIDPARAMS);
869954 memcpy(lpMaterial,&material,sizeof(D3DMATERIAL7));
 955+ TRACE_EXIT(23,D3D_OK);
870956 return D3D_OK;
871957 }
872958 HRESULT WINAPI glDirect3DDevice7::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState)
873959 {
874 - if(!this) return DDERR_INVALIDOBJECT;
 960+ TRACE_ENTER(3,14,this,27,dwRenderStateType,14,lpdwRenderState);
 961+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
875962 if(dwRenderStateType <= 152)
876963 {
877964 *lpdwRenderState = renderstate[dwRenderStateType];
 965+ TRACE_VAR("*lpdwRenderState",9,*lpdwRenderState);
 966+ TRACE_EXIT(23,D3D_OK);
878967 return D3D_OK;
879968 }
 969+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
880970 return DDERR_INVALIDPARAMS;
881971 }
882972 HRESULT WINAPI glDirect3DDevice7::GetRenderTarget(LPDIRECTDRAWSURFACE7 *lplpRenderTarget)
883973 {
884 - if(!this) return DDERR_INVALIDOBJECT;
885 - if(!lplpRenderTarget) return DDERR_INVALIDPARAMS;
 974+ TRACE_ENTER(2,14,this,14,lplpRenderTarget);
 975+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 976+ if(!lplpRenderTarget) TRACE_RET(23,DDERR_INVALIDPARAMS);
886977 glDDS7->AddRef();
887978 *lplpRenderTarget = glDDS7;
 979+ TRACE_VAR("*lplpRenderTarger",14,*lplpRenderTarget);
 980+ TRACE_EXIT(23,D3D_OK);
888981 return D3D_OK;
889982 }
890983 HRESULT WINAPI glDirect3DDevice7::GetStateData(DWORD dwState, LPVOID* lplpStateData)
891984 {
892 - if(!this) return DDERR_INVALIDOBJECT;
 985+ TRACE_ENTER(3,14,this,9,dwState,14,lplpStateData);
 986+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
893987 FIXME("glDirect3DDevice7::GetStateData: stub");
 988+ TRACE_EXIT(23,DDERR_GENERIC);
894989 ERR(DDERR_GENERIC);
895990 }
896991 HRESULT WINAPI glDirect3DDevice7::GetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 *lplpTexture)
897992 {
898 - if(!lplpTexture) return DDERR_INVALIDPARAMS;
899 - if(!this) return DDERR_INVALIDOBJECT;
900 - if(dwStage > 7) return DDERR_INVALIDPARAMS;
901 - if(!texstages[dwStage].texture) return DDERR_INVALIDOBJECT;
 993+ TRACE_ENTER(3,14,this,8,dwStage,14,lplpTexture);
 994+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 995+ if(!lplpTexture) TRACE_RET(23,DDERR_INVALIDPARAMS);
 996+ if(dwStage > 7) TRACE_RET(23,DDERR_INVALIDPARAMS);
 997+ if(!texstages[dwStage].texture) TRACE_RET(23,DDERR_INVALIDOBJECT);
902998 *lplpTexture = texstages[dwStage].texture;
903999 texstages[dwStage].texture->AddRef();
 1000+ TRACE_VAR("*lplpTexture",14,*lplpTexture);
 1001+ TRACE_EXIT(23,D3D_OK);
9041002 return D3D_OK;
9051003 }
9061004 HRESULT WINAPI glDirect3DDevice7::GetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, LPDWORD lpdwValue)
9071005 {
908 - if(dwStage > 7) return DDERR_INVALIDPARAMS;
909 - if(!lpdwValue) return DDERR_INVALIDPARAMS;
910 - if(!this) return DDERR_INVALIDOBJECT;
 1006+ TRACE_ENTER(4,14,this,8,dwStage,28,dwState,14,lpdwValue);
 1007+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1008+ if(dwStage > 7) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1009+ if(!lpdwValue) TRACE_RET(23,DDERR_INVALIDPARAMS);
9111010 switch(dwState)
9121011 {
9131012 case D3DTSS_COLOROP:
9141013 *lpdwValue = texstages[dwStage].colorop;
915 - return D3D_OK;
 1014+ TRACE_RET(23,D3D_OK);
9161015 case D3DTSS_COLORARG1:
9171016 *lpdwValue = texstages[dwStage].colorarg1;
918 - return D3D_OK;
 1017+ TRACE_RET(23,D3D_OK);
9191018 case D3DTSS_COLORARG2:
9201019 *lpdwValue = texstages[dwStage].colorarg2;
921 - return D3D_OK;
 1020+ TRACE_RET(23,D3D_OK);
9221021 case D3DTSS_ALPHAOP:
9231022 *lpdwValue = texstages[dwStage].alphaop;
924 - return D3D_OK;
 1023+ TRACE_RET(23,D3D_OK);
9251024 case D3DTSS_ALPHAARG1:
9261025 *lpdwValue = texstages[dwStage].alphaarg1;
927 - return D3D_OK;
 1026+ TRACE_RET(23,D3D_OK);
9281027 case D3DTSS_ALPHAARG2:
9291028 *lpdwValue = texstages[dwStage].alphaarg2;
930 - return D3D_OK;
 1029+ TRACE_RET(23,D3D_OK);
9311030 case D3DTSS_BUMPENVMAT00:
9321031 memcpy(lpdwValue,&texstages[dwStage].bumpenv00,sizeof(D3DVALUE));
933 - return D3D_OK;
 1032+ TRACE_RET(23,D3D_OK);
9341033 case D3DTSS_BUMPENVMAT01:
9351034 memcpy(lpdwValue,&texstages[dwStage].bumpenv01,sizeof(D3DVALUE));
936 - return D3D_OK;
 1035+ TRACE_RET(23,D3D_OK);
9371036 case D3DTSS_BUMPENVMAT10:
9381037 memcpy(lpdwValue,&texstages[dwStage].bumpenv10,sizeof(D3DVALUE));
939 - return D3D_OK;
 1038+ TRACE_RET(23,D3D_OK);
9401039 case D3DTSS_BUMPENVMAT11:
9411040 memcpy(lpdwValue,&texstages[dwStage].bumpenv11,sizeof(D3DVALUE));
942 - return D3D_OK;
 1041+ TRACE_RET(23,D3D_OK);
9431042 case D3DTSS_TEXCOORDINDEX:
9441043 *lpdwValue = texstages[dwStage].texcoordindex;
945 - return D3D_OK;
 1044+ TRACE_RET(23,D3D_OK);
9461045 case D3DTSS_ADDRESS:
9471046 case D3DTSS_ADDRESSU:
9481047 *lpdwValue = texstages[dwStage].addressu;
949 - return D3D_OK;
 1048+ TRACE_RET(23,D3D_OK);
9501049 case D3DTSS_ADDRESSV:
9511050 *lpdwValue = texstages[dwStage].addressv;
952 - return D3D_OK;
 1051+ TRACE_RET(23,D3D_OK);
9531052 case D3DTSS_BORDERCOLOR:
9541053 *lpdwValue = texstages[dwStage].bordercolor;
955 - return D3D_OK;
 1054+ TRACE_RET(23,D3D_OK);
9561055 case D3DTSS_MAGFILTER:
9571056 *lpdwValue = texstages[dwStage].magfilter;
958 - return D3D_OK;
 1057+ TRACE_RET(23,D3D_OK);
9591058 case D3DTSS_MINFILTER:
9601059 *lpdwValue = texstages[dwStage].minfilter;
961 - return D3D_OK;
 1060+ TRACE_RET(23,D3D_OK);
9621061 case D3DTSS_MIPFILTER:
9631062 *lpdwValue = texstages[dwStage].mipfilter;
964 - return D3D_OK;
 1063+ TRACE_RET(23,D3D_OK);
9651064 case D3DTSS_MIPMAPLODBIAS:
9661065 memcpy(lpdwValue,&texstages[dwStage].lodbias,sizeof(D3DVALUE));
967 - return D3D_OK;
 1066+ TRACE_RET(23,D3D_OK);
9681067 case D3DTSS_MAXMIPLEVEL:
9691068 *lpdwValue = texstages[dwStage].miplevel;
970 - return D3D_OK;
 1069+ TRACE_RET(23,D3D_OK);
9711070 case D3DTSS_MAXANISOTROPY:
9721071 *lpdwValue = texstages[dwStage].anisotropy;
973 - return D3D_OK;
 1072+ TRACE_RET(23,D3D_OK);
9741073 case D3DTSS_BUMPENVLSCALE:
9751074 memcpy(lpdwValue,&texstages[dwStage].bumpenvlscale,sizeof(D3DVALUE));
976 - return D3D_OK;
 1075+ TRACE_RET(23,D3D_OK);
9771076 case D3DTSS_BUMPENVLOFFSET:
9781077 memcpy(lpdwValue,&texstages[dwStage].bumpenvloffset,sizeof(D3DVALUE));
979 - return D3D_OK;
 1078+ TRACE_RET(23,D3D_OK);
9801079 case D3DTSS_TEXTURETRANSFORMFLAGS:
9811080 *lpdwValue = texstages[dwStage].textransform;
982 - return D3D_OK;
 1081+ TRACE_RET(23,D3D_OK);
9831082 default:
984 - return DDERR_INVALIDPARAMS;
 1083+ TRACE_RET(23,DDERR_INVALIDPARAMS);
9851084 }
986 - ERR(DDERR_GENERIC);
 1085+ TRACE_RET(23,DDERR_GENERIC);
9871086 }
9881087 HRESULT WINAPI glDirect3DDevice7::GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
9891088 {
990 - if(!this) return DDERR_INVALIDOBJECT;
 1089+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 1090+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
9911091 switch(dtstTransformStateType)
9921092 {
9931093 case D3DTRANSFORMSTATE_WORLD:
9941094 memcpy(lpD3DMatrix,&matWorld,sizeof(D3DMATRIX));
995 - return D3D_OK;
 1095+ TRACE_RET(23,D3D_OK);
9961096 case D3DTRANSFORMSTATE_VIEW:
9971097 memcpy(lpD3DMatrix,&matView,sizeof(D3DMATRIX));
998 - return D3D_OK;
 1098+ TRACE_RET(23,D3D_OK);
9991099 case D3DTRANSFORMSTATE_PROJECTION:
10001100 memcpy(lpD3DMatrix,&matProjection,sizeof(D3DMATRIX));
1001 - return D3D_OK;
 1101+ TRACE_RET(23,D3D_OK);
10021102 default:
1003 - ERR(DDERR_INVALIDPARAMS);
 1103+ TRACE_RET(23,DDERR_INVALIDPARAMS);
10041104 }
 1105+ TRACE_RET(23,DDERR_GENERIC);
10051106 }
10061107 HRESULT WINAPI glDirect3DDevice7::GetViewport(LPD3DVIEWPORT7 lpViewport)
10071108 {
1008 - if(!this) return DDERR_INVALIDOBJECT;
 1109+ TRACE_ENTER(2,14,this,14,lpViewport);
 1110+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10091111 memcpy(lpViewport,&viewport,sizeof(D3DVIEWPORT7));
 1112+ TRACE_EXIT(23,D3D_OK);
10101113 return D3D_OK;
10111114 }
10121115 HRESULT WINAPI glDirect3DDevice7::LightEnable(DWORD dwLightIndex, BOOL bEnable)
10131116 {
1014 - if(!this) return DDERR_INVALIDOBJECT;
 1117+ TRACE_ENTER(3,14,this,8,dwLightIndex,22,bEnable);
 1118+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10151119 int i;
10161120 D3DLIGHT7 light;
10171121 bool foundlight = false;
10181122 if(dwLightIndex >= lightsmax)
10191123 {
1020 - if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex-1)) return DDERR_OUTOFMEMORY;
 1124+ if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex-1)) TRACE_RET(23,DDERR_OUTOFMEMORY);
10211125 }
10221126 if(!lights[dwLightIndex]) lights[dwLightIndex] = new glDirect3DLight;
10231127 if(bEnable)
10241128 {
10251129 for(i = 0; i < 8; i++)
1026 - if(gllights[i] == dwLightIndex) return D3D_OK;
 1130+ if(gllights[i] == dwLightIndex) TRACE_RET(23,D3D_OK);
10271131 for(i = 0; i < 8; i++)
10281132 {
10291133 if(gllights[i] == -1)
@@ -1032,7 +1136,7 @@
10331137 break;
10341138 }
10351139 }
1036 - if(!foundlight) return D3DERR_LIGHT_SET_FAILED;
 1140+ if(!foundlight) TRACE_RET(23,D3DERR_LIGHT_SET_FAILED);
10371141 }
10381142 else
10391143 {
@@ -1043,71 +1147,88 @@
10441148 gllights[i] = -1;
10451149 }
10461150 }
 1151+ TRACE_EXIT(23,D3D_OK);
10471152 return D3D_OK;
10481153 }
 1154+ TRACE_EXIT(23,D3D_OK);
10491155 return D3D_OK;
10501156 }
10511157 HRESULT WINAPI glDirect3DDevice7::Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex,
10521158 LPRECT lprcSrcRect, DWORD dwFlags)
10531159 {
1054 - if(!this) return DDERR_INVALIDOBJECT;
 1160+ TRACE_ENTER(6,14,this,14,lpDestTex,25,lpDestPoint,14,lpSrcTex,26,lprcSrcRect,9,dwFlags);
 1161+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10551162 FIXME("glDirect3DDevice7::Load: stub");
 1163+ TRACE_EXIT(23,DDERR_GENERIC);
10561164 ERR(DDERR_GENERIC);
10571165 }
10581166 HRESULT WINAPI glDirect3DDevice7::MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
10591167 {
1060 - if(!this) return DDERR_INVALIDOBJECT;
 1168+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 1169+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10611170 FIXME("glDirect3DDevice7::MultiplyTransform: stub");
 1171+ TRACE_EXIT(23,DDERR_GENERIC);
10621172 ERR(DDERR_GENERIC);
10631173 }
10641174 HRESULT WINAPI glDirect3DDevice7::PreLoad(LPDIRECTDRAWSURFACE7 lpddsTexture)
10651175 {
1066 - if(!this) return DDERR_INVALIDOBJECT;
 1176+ TRACE_ENTER(2,14,this,14,lpddsTexture);
 1177+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10671178 FIXME("glDirect3DDevice7::PreLoad: stub");
 1179+ TRACE_EXIT(23,DDERR_GENERIC);
10681180 ERR(DDERR_GENERIC);
10691181 }
10701182 HRESULT WINAPI glDirect3DDevice7::SetClipPlane(DWORD dwIndex, D3DVALUE* pPlaneEquation)
10711183 {
1072 - if(!this) return DDERR_INVALIDOBJECT;
 1184+ TRACE_ENTER(3,14,this,8,dwIndex,14,pPlaneEquation);
 1185+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10731186 FIXME("glDirect3DDevice7::SetClipPland: stub");
 1187+ TRACE_EXIT(23,DDERR_GENERIC);
10741188 ERR(DDERR_GENERIC);
10751189 }
10761190 HRESULT WINAPI glDirect3DDevice7::SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
10771191 {
1078 - if(!this) return DDERR_INVALIDOBJECT;
 1192+ TRACE_ENTER(2,14,this,14,lpD3DClipStatus);
 1193+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10791194 FIXME("glDirect3DDevice7::SetClipStatus: stub");
 1195+ TRACE_EXIT(23,DDERR_GENERIC);
10801196 ERR(DDERR_GENERIC);
10811197 }
10821198 HRESULT WINAPI glDirect3DDevice7::SetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight)
10831199 {
1084 - if(!this) return DDERR_INVALIDOBJECT;
 1200+ TRACE_ENTER(3,14,this,8,dwLightIndex,14,lpLight);
 1201+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10851202 bool foundlight = false;
10861203 if(dwLightIndex >= lightsmax)
10871204 {
1088 - if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex-1)) return DDERR_OUTOFMEMORY;
 1205+ if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex-1)) TRACE_RET(23,DDERR_OUTOFMEMORY);
10891206 }
10901207 if(!lights[dwLightIndex]) lights[dwLightIndex] = new glDirect3DLight;
10911208 lights[dwLightIndex]->SetLight7(lpLight);
 1209+ TRACE_EXIT(23,D3D_OK);
10921210 return D3D_OK;
10931211 }
10941212 HRESULT WINAPI glDirect3DDevice7::SetMaterial(LPD3DMATERIAL7 lpMaterial)
10951213 {
1096 - if(!this) return DDERR_INVALIDOBJECT;
1097 - if(!lpMaterial) return DDERR_INVALIDPARAMS;
 1214+ TRACE_ENTER(2,14,this,14,lpMaterial);
 1215+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1216+ if(!lpMaterial) TRACE_RET(23,DDERR_INVALIDPARAMS);
10981217 memcpy(&material,lpMaterial,sizeof(D3DMATERIAL7));
 1218+ TRACE_EXIT(23,D3D_OK);
10991219 return D3D_OK;
11001220 }
11011221
11021222 HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
11031223 {
1104 - if(!this) return DDERR_INVALIDOBJECT;
 1224+ TRACE_ENTER(3,14,this,27,dwRendStateType,9,dwRenderState);
 1225+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
11051226 switch(dwRendStateType)
11061227 {
11071228 case D3DRENDERSTATE_TEXTUREHANDLE:
1108 - if(dwRenderState > texturecount-1) return DDERR_INVALIDPARAMS;
 1229+ if(dwRenderState > texturecount-1) TRACE_RET(23,DDERR_INVALIDPARAMS);
11091230 if(dwRenderState)
11101231 {
1111 - if(!textures[dwRenderState]) return DDERR_INVALIDPARAMS;
 1232+ if(!textures[dwRenderState]) TRACE_RET(23,DDERR_INVALIDPARAMS);
11121233 SetTexture(0,textures[dwRenderState]);
11131234 }
11141235 else SetTexture(0,NULL);
@@ -1166,7 +1287,7 @@
11671288 }
11681289 break;
11691290 case D3DRENDERSTATE_TEXTUREMAPBLEND:
1170 - if(!dwRenderState || (dwRenderState > D3DTBLEND_ADD)) return DDERR_INVALIDPARAMS;
 1291+ if(!dwRenderState || (dwRenderState > D3DTBLEND_ADD)) TRACE_RET(23,DDERR_INVALIDPARAMS);
11711292 switch(dwRenderState)
11721293 {
11731294 case D3DTBLEND_DECAL:
@@ -1202,7 +1323,7 @@
12031324 case D3DTBLEND_DECALMASK:
12041325 case D3DTBLEND_MODULATEMASK:
12051326 FIXME("DX5 masked blend modes not supported.");
1206 - return DDERR_UNSUPPORTED;
 1327+ TRACE_RET(23,DDERR_UNSUPPORTED);
12071328 case D3DTBLEND_ADD:
12081329 SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
12091330 SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
@@ -1213,127 +1334,150 @@
12141335 }
12151336 break;
12161337 }
1217 - if(dwRendStateType > 152) return DDERR_INVALIDPARAMS;
1218 - if(dwRendStateType < 0) return DDERR_INVALIDPARAMS;
 1338+ if(dwRendStateType > 152) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1339+ if(dwRendStateType < 0) TRACE_RET(23,DDERR_INVALIDPARAMS);
12191340 renderstate[dwRendStateType] = dwRenderState;
 1341+ TRACE_EXIT(23,D3D_OK);
12201342 return D3D_OK;
12211343 }
12221344 HRESULT WINAPI glDirect3DDevice7::SetRenderTarget(LPDIRECTDRAWSURFACE7 lpNewRenderTarget, DWORD dwFlags)
12231345 {
1224 - if(!this) return DDERR_INVALIDOBJECT;
1225 - if(!lpNewRenderTarget) return DDERR_INVALIDPARAMS;
1226 - if(dwFlags) return DDERR_INVALIDPARAMS;
 1346+ TRACE_ENTER(3,14,this,14,lpNewRenderTarget,9,dwFlags);
 1347+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1348+ if(!lpNewRenderTarget) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1349+ if(dwFlags) TRACE_RET(23,DDERR_INVALIDPARAMS);
12271350 DDSURFACEDESC2 ddsd;
12281351 ddsd.dwSize = sizeof(DDSURFACEDESC2);
12291352 lpNewRenderTarget->GetSurfaceDesc(&ddsd);
1230 - if(!(ddsd.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) return DDERR_INVALIDSURFACETYPE;
 1353+ if(!(ddsd.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) TRACE_RET(23,DDERR_INVALIDSURFACETYPE);
12311354 glDDS7->Release();
12321355 glDDS7 = (glDirectDrawSurface7*)lpNewRenderTarget;
12331356 glDDS7->AddRef();
 1357+ TRACE_EXIT(23,D3D_OK);
12341358 return D3D_OK;
12351359 }
12361360 HRESULT WINAPI glDirect3DDevice7::SetStateData(DWORD dwState, LPVOID lpStateData)
12371361 {
1238 - if(!this) return DDERR_INVALIDOBJECT;
 1362+ TRACE_ENTER(3,14,this,8,dwState,14,lpStateData);
 1363+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
12391364 FIXME("glDirect3DDevice7::SetStateData: stub");
 1365+ TRACE_EXIT(23,DDERR_GENERIC);
12401366 ERR(DDERR_GENERIC);
12411367 }
12421368 HRESULT WINAPI glDirect3DDevice7::SetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 lpTexture)
12431369 {
1244 - if(!this) return DDERR_INVALIDOBJECT;
1245 - if(dwStage > 7) return DDERR_INVALIDPARAMS;
 1370+ TRACE_ENTER(3,14,this,8,dwStage,14,lpTexture);
 1371+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1372+ if(dwStage > 7) TRACE_RET(23,DDERR_INVALIDPARAMS);
12461373 if(texstages[dwStage].texture) texstages[dwStage].texture->Release();
12471374 texstages[dwStage].texture = (glDirectDrawSurface7*)lpTexture;
12481375 texstages[dwStage].dirty = true;
12491376 if(lpTexture) lpTexture->AddRef();
 1377+ TRACE_EXIT(23,D3D_OK);
12501378 return D3D_OK;
12511379 }
12521380 HRESULT WINAPI glDirect3DDevice7::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue)
12531381 {
1254 - if(!this) return DDERR_INVALIDOBJECT;
1255 - if(dwStage > 7) return DDERR_INVALIDPARAMS;
 1382+ TRACE_ENTER(4,14,this,8,dwStage,28,dwState,9,dwValue);
 1383+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1384+ if(dwStage > 7) TRACE_RET(23,DDERR_INVALIDPARAMS);
12561385 switch(dwState)
12571386 {
12581387 case D3DTSS_COLOROP:
1259 - if(!dwValue || (dwValue > 24)) return DDERR_INVALIDPARAMS;
 1388+ if(!dwValue || (dwValue > 24)) TRACE_RET(23,DDERR_INVALIDPARAMS);
12601389 if(dwStage == 0)renderstate[D3DRENDERSTATE_TEXTUREMAPBLEND] = 0;
12611390 texstages[dwStage].colorop = (D3DTEXTUREOP)dwValue;
12621391 texstages[dwStage].dirty = true;
 1392+ TRACE_EXIT(23,D3D_OK);
12631393 return D3D_OK;
12641394 case D3DTSS_COLORARG1:
1265 - if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
1266 - if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 1395+ if((dwValue & D3DTA_SELECTMASK) > 4) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1396+ if(dwValue > 0x34) TRACE_RET(23,DDERR_INVALIDPARAMS);
12671397 texstages[dwStage].colorarg1 = dwValue;
12681398 texstages[dwStage].dirty = true;
 1399+ TRACE_EXIT(23,D3D_OK);
12691400 return D3D_OK;
12701401 case D3DTSS_COLORARG2:
1271 - if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
1272 - if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 1402+ if((dwValue & D3DTA_SELECTMASK) > 4) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1403+ if(dwValue > 0x34) TRACE_RET(23,DDERR_INVALIDPARAMS);
12731404 texstages[dwStage].colorarg2 = dwValue;
12741405 texstages[dwStage].dirty = true;
 1406+ TRACE_EXIT(23,D3D_OK);
12751407 return D3D_OK;
12761408 case D3DTSS_ALPHAOP:
1277 - if(!dwValue || (dwValue > 24)) return DDERR_INVALIDPARAMS;
 1409+ if(!dwValue || (dwValue > 24)) TRACE_RET(23,DDERR_INVALIDPARAMS);
12781410 if(dwStage == 0)renderstate[D3DRENDERSTATE_TEXTUREMAPBLEND] = 0;
12791411 texstages[dwStage].alphaop = (D3DTEXTUREOP )dwValue;
12801412 texstages[dwStage].dirty = true;
 1413+ TRACE_EXIT(23,D3D_OK);
12811414 return D3D_OK;
12821415 case D3DTSS_ALPHAARG1:
1283 - if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
1284 - if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 1416+ if((dwValue & D3DTA_SELECTMASK) > 4) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1417+ if(dwValue > 0x34) TRACE_RET(23,DDERR_INVALIDPARAMS);
12851418 texstages[dwStage].alphaarg1 = dwValue;
12861419 texstages[dwStage].dirty = true;
 1420+ TRACE_RET(23,D3D_OK);
12871421 return D3D_OK;
12881422 case D3DTSS_ALPHAARG2:
1289 - if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
1290 - if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 1423+ if((dwValue & D3DTA_SELECTMASK) > 4) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1424+ if(dwValue > 0x34) TRACE_RET(23,DDERR_INVALIDPARAMS);
12911425 texstages[dwStage].alphaarg2 = dwValue;
12921426 texstages[dwStage].dirty = true;
 1427+ TRACE_EXIT(23,D3D_OK);
12931428 return D3D_OK;
12941429 case D3DTSS_BUMPENVMAT00:
12951430 memcpy(&texstages[dwStage].bumpenv00,&dwValue,sizeof(D3DVALUE));
12961431 texstages[dwStage].dirty = true;
 1432+ TRACE_EXIT(23,D3D_OK);
12971433 return D3D_OK;
12981434 case D3DTSS_BUMPENVMAT01:
12991435 memcpy(&texstages[dwStage].bumpenv01,&dwValue,sizeof(D3DVALUE));
13001436 texstages[dwStage].dirty = true;
 1437+ TRACE_EXIT(23,D3D_OK);
13011438 return D3D_OK;
13021439 case D3DTSS_BUMPENVMAT10:
13031440 memcpy(&texstages[dwStage].bumpenv10,&dwValue,sizeof(D3DVALUE));
13041441 texstages[dwStage].dirty = true;
 1442+ TRACE_EXIT(23,D3D_OK);
13051443 return D3D_OK;
13061444 case D3DTSS_BUMPENVMAT11:
13071445 memcpy(&texstages[dwStage].bumpenv11,&dwValue,sizeof(D3DVALUE));
13081446 texstages[dwStage].dirty = true;
 1447+ TRACE_EXIT(23,D3D_OK);
13091448 return D3D_OK;
13101449 case D3DTSS_TEXCOORDINDEX:
1311 - if((dwValue & 0xFFFF) > 7) return DDERR_INVALIDPARAMS;
1312 - if((dwValue >> 16) > 3) return DDERR_INVALIDPARAMS;
 1450+ if((dwValue & 0xFFFF) > 7) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1451+ if((dwValue >> 16) > 3) TRACE_RET(23,DDERR_INVALIDPARAMS);
13131452 texstages[dwStage].texcoordindex = dwValue;
13141453 texstages[dwStage].dirty = true;
 1454+ TRACE_EXIT(23,D3D_OK);
13151455 return D3D_OK;
13161456 case D3DTSS_ADDRESS:
1317 - if(!dwValue || (dwValue > 4)) return DDERR_INVALIDPARAMS;
 1457+ if(!dwValue || (dwValue > 4)) TRACE_RET(23,DDERR_INVALIDPARAMS);
13181458 texstages[dwStage].addressu = (D3DTEXTUREADDRESS)dwValue;
13191459 texstages[dwStage].addressv = (D3DTEXTUREADDRESS)dwValue;
13201460 texstages[dwStage].dirty = true;
 1461+ TRACE_EXIT(23,D3D_OK);
13211462 return D3D_OK;
13221463 case D3DTSS_ADDRESSU:
1323 - if(!dwValue || (dwValue > 4)) return DDERR_INVALIDPARAMS;
 1464+ if(!dwValue || (dwValue > 4)) TRACE_RET(23,DDERR_INVALIDPARAMS);
13241465 texstages[dwStage].addressu = (D3DTEXTUREADDRESS)dwValue;
13251466 texstages[dwStage].dirty = true;
 1467+ TRACE_EXIT(23,D3D_OK);
13261468 return D3D_OK;
13271469 case D3DTSS_ADDRESSV:
1328 - if(!dwValue || (dwValue > 4)) return DDERR_INVALIDPARAMS;
 1470+ if(!dwValue || (dwValue > 4)) TRACE_RET(23,DDERR_INVALIDPARAMS);
13291471 texstages[dwStage].addressv = (D3DTEXTUREADDRESS)dwValue;
13301472 texstages[dwStage].dirty = true;
 1473+ TRACE_EXIT(23,D3D_OK);
13311474 return D3D_OK;
13321475 case D3DTSS_BORDERCOLOR:
13331476 texstages[dwStage].bordercolor = dwValue;
13341477 texstages[dwStage].dirty = true;
 1478+ TRACE_EXIT(23,D3D_OK);
13351479 return D3D_OK;
13361480 case D3DTSS_MAGFILTER:
1337 - if(!dwValue || (dwValue > 5)) return DDERR_INVALIDPARAMS;
 1481+ if(!dwValue || (dwValue > 5)) TRACE_RET(23,DDERR_INVALIDPARAMS);
13381482 texstages[dwStage].magfilter = (D3DTEXTUREMAGFILTER)dwValue;
13391483 texstages[dwStage].dirty = true;
13401484 switch(texstages[dwStage].magfilter)
@@ -1349,9 +1493,10 @@
13501494 texstages[dwStage].glmagfilter = GL_LINEAR;
13511495 break;
13521496 }
 1497+ TRACE_EXIT(23,D3D_OK);
13531498 return D3D_OK;
13541499 case D3DTSS_MINFILTER:
1355 - if(!dwValue || (dwValue > 3)) return DDERR_INVALIDPARAMS;
 1500+ if(!dwValue || (dwValue > 3)) TRACE_RET(23,DDERR_INVALIDPARAMS);
13561501 texstages[dwStage].minfilter = (D3DTEXTUREMINFILTER)dwValue;
13571502 texstages[dwStage].dirty = true;
13581503 switch(texstages[dwStage].minfilter)
@@ -1389,9 +1534,10 @@
13901535 }
13911536 break;
13921537 }
 1538+ TRACE_EXIT(23,D3D_OK);
13931539 return D3D_OK;
13941540 case D3DTSS_MIPFILTER:
1395 - if(!dwValue || (dwValue > 3)) return DDERR_INVALIDPARAMS;
 1541+ if(!dwValue || (dwValue > 3)) TRACE_RET(23,DDERR_INVALIDPARAMS);
13961542 texstages[dwStage].mipfilter = (D3DTEXTUREMIPFILTER)dwValue;
13971543 texstages[dwStage].dirty = true;
13981544 switch(texstages[dwStage].mipfilter)
@@ -1431,42 +1577,51 @@
14321578 }
14331579 break;
14341580 }
 1581+ TRACE_EXIT(23,D3D_OK);
14351582 return D3D_OK;
14361583 case D3DTSS_MIPMAPLODBIAS:
14371584 memcpy(&texstages[dwStage].lodbias,&dwValue,sizeof(D3DVALUE));
14381585 texstages[dwStage].dirty = true;
 1586+ TRACE_EXIT(23,D3D_OK);
14391587 return D3D_OK;
14401588 case D3DTSS_MAXMIPLEVEL:
14411589 texstages[dwStage].miplevel = dwValue;
14421590 texstages[dwStage].dirty = true;
 1591+ TRACE_EXIT(23,D3D_OK);
14431592 return D3D_OK;
14441593 case D3DTSS_MAXANISOTROPY:
14451594 texstages[dwStage].anisotropy = dwValue;
14461595 texstages[dwStage].dirty = true;
 1596+ TRACE_EXIT(23,D3D_OK);
14471597 return D3D_OK;
14481598 case D3DTSS_BUMPENVLSCALE:
14491599 memcpy(&texstages[dwStage].bumpenvlscale,&dwValue,sizeof(D3DVALUE));
14501600 texstages[dwStage].dirty = true;
 1601+ TRACE_EXIT(23,D3D_OK);
14511602 return D3D_OK;
14521603 case D3DTSS_BUMPENVLOFFSET:
14531604 memcpy(&texstages[dwStage].bumpenvloffset,&dwValue,sizeof(D3DVALUE));
14541605 texstages[dwStage].dirty = true;
 1606+ TRACE_EXIT(23,D3D_OK);
14551607 return D3D_OK;
14561608 case D3DTSS_TEXTURETRANSFORMFLAGS:
1457 - if((dwValue & 0xFF) > 4) return DDERR_INVALIDPARAMS;
1458 - if((dwValue >> 8) > 1) return DDERR_INVALIDPARAMS;
 1609+ if((dwValue & 0xFF) > 4) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1610+ if((dwValue >> 8) > 1) TRACE_RET(23,DDERR_INVALIDPARAMS);
14591611 texstages[dwStage].textransform = (D3DTEXTURETRANSFORMFLAGS)dwValue;
14601612 texstages[dwStage].dirty = true;
 1613+ TRACE_EXIT(23,D3D_OK);
14611614 return D3D_OK;
14621615 default:
 1616+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
14631617 return DDERR_INVALIDPARAMS;
14641618 }
1465 - FIXME("glDirect3DDevice7::SetTextureStageState: stub");
 1619+ TRACE_RET(23,DDERR_GENERIC);
14661620 ERR(DDERR_GENERIC);
14671621 }
14681622 HRESULT WINAPI glDirect3DDevice7::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
14691623 {
1470 - if(!this) return DDERR_INVALIDOBJECT;
 1624+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 1625+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
14711626 switch(dtstTransformStateType)
14721627 {
14731628 case D3DTRANSFORMSTATE_WORLD:
@@ -1473,31 +1628,39 @@
14741629 memcpy(&matWorld,lpD3DMatrix,sizeof(D3DMATRIX));
14751630 modelview_dirty = true;
14761631 transform_dirty = true;
 1632+ TRACE_EXIT(23,D3D_OK);
14771633 return D3D_OK;
14781634 case D3DTRANSFORMSTATE_VIEW:
14791635 memcpy(&matView,lpD3DMatrix,sizeof(D3DMATRIX));
14801636 modelview_dirty = true;
14811637 transform_dirty = true;
 1638+ TRACE_EXIT(23,D3D_OK);
14821639 return D3D_OK;
14831640 case D3DTRANSFORMSTATE_PROJECTION:
14841641 memcpy(&matProjection,lpD3DMatrix,sizeof(D3DMATRIX));
14851642 projection_dirty = true;
14861643 transform_dirty = true;
 1644+ TRACE_EXIT(23,D3D_OK);
14871645 return D3D_OK;
14881646 default:
1489 - ERR(DDERR_INVALIDPARAMS);
 1647+ TRACE_RET(23,DDERR_INVALIDPARAMS);
14901648 }
 1649+ TRACE_EXIT(23,DDERR_GENERIC);
 1650+ return DDERR_GENERIC;
14911651 }
14921652 HRESULT WINAPI glDirect3DDevice7::SetViewport(LPD3DVIEWPORT7 lpViewport)
14931653 {
1494 - if(!this) return DDERR_INVALIDOBJECT;
 1654+ TRACE_ENTER(2,14,this,14,lpViewport);
 1655+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
14951656 memcpy(&viewport,lpViewport,sizeof(D3DVIEWPORT7));
14961657 transform_dirty = true;
 1658+ TRACE_EXIT(23,D3D_OK);
14971659 return D3D_OK;
14981660 }
14991661 HRESULT WINAPI glDirect3DDevice7::ValidateDevice(LPDWORD lpdwPasses)
15001662 {
1501 - if(!this) return DDERR_INVALIDOBJECT;
 1663+ TRACE_ENTER(2,14,this,14,lpdwPasses);
 1664+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
15021665 for(int i = 0; i < 8; i++)
15031666 {
15041667 switch(texstages[i].colorop)
@@ -1519,7 +1682,7 @@
15201683 case D3DTOP_BLENDCURRENTALPHA:
15211684 break;
15221685 default:
1523 - return D3DERR_UNSUPPORTEDCOLOROPERATION;
 1686+ TRACE_RET(23,D3DERR_UNSUPPORTEDCOLOROPERATION);
15241687 }
15251688 }
15261689 for(int i = 0; i < 8; i++)
@@ -1543,15 +1706,18 @@
15441707 case D3DTOP_BLENDCURRENTALPHA:
15451708 break;
15461709 default:
1547 - return D3DERR_UNSUPPORTEDALPHAOPERATION;
 1710+ TRACE_RET(23,D3DERR_UNSUPPORTEDALPHAOPERATION);
15481711 }
15491712 }
15501713 if(lpdwPasses) *lpdwPasses = 1;
 1714+ TRACE_VAR("*lpdwPasses",8,*lpdwPasses);
 1715+ TRACE_EXIT(23,D3D_OK);
15511716 return D3D_OK;
15521717 }
15531718
15541719 void glDirect3DDevice7::SetDepthComp()
15551720 {
 1721+ TRACE_ENTER(1,14,this);
15561722 switch(renderstate[D3DRENDERSTATE_ZFUNC])
15571723 {
15581724 case D3DCMP_NEVER:
@@ -1580,10 +1746,12 @@
15811747 ::SetDepthComp(GL_ALWAYS);
15821748 break;
15831749 }
 1750+ TRACE_EXIT(0,0);
15841751 }
15851752
15861753 D3DMATERIALHANDLE glDirect3DDevice7::AddMaterial(glDirect3DMaterial3 *material)
15871754 {
 1755+ TRACE_ENTER(2,14,this,14,material);
15881756 materials[materialcount] = material;
15891757 material->AddRef();
15901758 materialcount++;
@@ -1598,15 +1766,18 @@
15991767 materialcount--;
16001768 materials[materialcount] = NULL;
16011769 material->Release();
1602 - return -1;
 1770+ TRACE_EXIT(9,0xFFFFFFFF);
 1771+ return 0xFFFFFFFF;
16031772 }
16041773 materials = newmat;
16051774 }
 1775+ TRACE_EXIT(9,(materialcount-1));
16061776 return materialcount-1;
16071777 }
16081778
16091779 D3DTEXTUREHANDLE glDirect3DDevice7::AddTexture(glDirectDrawSurface7 *texture)
16101780 {
 1781+ TRACE_ENTER(2,14,this,14,texture);
16111782 textures[texturecount] = texture;
16121783 texture->AddRef();
16131784 texturecount++;
@@ -1621,20 +1792,23 @@
16221793 texturecount--;
16231794 textures[texturecount] = NULL;
16241795 texture->Release();
1625 - return -1;
 1796+ TRACE_EXIT(9,0xFFFFFFFF);
 1797+ return 0xFFFFFFFF;
16261798 }
16271799 textures = newtex;
16281800 }
 1801+ TRACE_EXIT(9,(texturecount-1));
16291802 return texturecount-1;
16301803 }
16311804
16321805 HRESULT glDirect3DDevice7::AddViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport)
16331806 {
1634 - if(!this) return DDERR_INVALIDOBJECT;
1635 - if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
 1807+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport);
 1808+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1809+ if(!lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
16361810 for(int i = 0; i < maxviewports; i++)
16371811 {
1638 - if(viewports[i] == lpDirect3DViewport) return DDERR_INVALIDPARAMS;
 1812+ if(viewports[i] == lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
16391813 }
16401814 viewports[viewportcount] = (glDirect3DViewport3*)lpDirect3DViewport;
16411815 viewports[viewportcount]->AddRef();
@@ -1650,17 +1824,19 @@
16511825 viewports[viewportcount]->Release();
16521826 viewports[viewportcount] = NULL;
16531827 maxviewports -= 32;
1654 - return DDERR_OUTOFMEMORY;
 1828+ TRACE_RET(23,DDERR_OUTOFMEMORY);
16551829 }
16561830 }
16571831 viewports[viewportcount-1]->SetDevice(this);
 1832+ TRACE_EXIT(23,D3D_OK);
16581833 return D3D_OK;
16591834 }
16601835
16611836 HRESULT glDirect3DDevice7::DeleteViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport)
16621837 {
1663 - if(!this) return DDERR_INVALIDOBJECT;
1664 - if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
 1838+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport);
 1839+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1840+ if(!lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
16651841 for(int i = 0; i < maxviewports; i++)
16661842 {
16671843 if(viewports[i] == lpDirect3DViewport)
@@ -1670,36 +1846,44 @@
16711847 viewports[i]->Release();
16721848 if(currentviewport == viewports[i]) currentviewport = NULL;
16731849 viewports[i] = NULL;
 1850+ TRACE_EXIT(23,D3D_OK);
16741851 return D3D_OK;
16751852 }
16761853 }
 1854+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
16771855 return DDERR_INVALIDPARAMS;
16781856 }
16791857
16801858 HRESULT glDirect3DDevice7::NextViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport, LPDIRECT3DVIEWPORT3 *lplpAnotherViewport, DWORD dwFlags)
16811859 {
1682 - if(!this) return DDERR_INVALIDOBJECT;
1683 - if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
1684 - if(!lplpAnotherViewport) return DDERR_INVALIDPARAMS;
 1860+ TRACE_ENTER(4,14,this,14,lpDirect3DViewport,14,lplpAnotherViewport,9,dwFlags);
 1861+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1862+ if(!lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1863+ if(!lplpAnotherViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
16851864 FIXME("glDirect3DDevice7::NextViewport: stub");
 1865+ TRACE_EXIT(23,DDERR_GENERIC);
16861866 return DDERR_GENERIC;
16871867 }
16881868
16891869 HRESULT glDirect3DDevice7::GetCurrentViewport(LPDIRECT3DVIEWPORT3 *lplpd3dViewport)
16901870 {
1691 - if(!this) return DDERR_INVALIDOBJECT;
1692 - if(!lplpd3dViewport) return DDERR_INVALIDPARAMS;
1693 - if(!currentviewport) return D3DERR_NOCURRENTVIEWPORT;
 1871+ TRACE_ENTER(2,14,this,14,lplpd3dViewport);
 1872+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1873+ if(!lplpd3dViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1874+ if(!currentviewport) TRACE_RET(23,D3DERR_NOCURRENTVIEWPORT);
16941875 *lplpd3dViewport = currentviewport;
16951876 currentviewport->AddRef();
 1877+ TRACE_VAR("*lplpd3dViewport",14,*lplpd3dViewport);
 1878+ TRACE_EXIT(23,D3D_OK);
16961879 return D3D_OK;
16971880 }
16981881
16991882 HRESULT glDirect3DDevice7::SetCurrentViewport(LPDIRECT3DVIEWPORT3 lpd3dViewport)
17001883 {
1701 - if(!this) return DDERR_INVALIDOBJECT;
1702 - if(!lpd3dViewport) return DDERR_INVALIDPARAMS;
1703 - if(currentviewport == lpd3dViewport) return D3D_OK;
 1884+ TRACE_ENTER(2,14,this,14,lpd3dViewport);
 1885+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1886+ if(!lpd3dViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1887+ if(currentviewport == lpd3dViewport) TRACE_RET(23,D3D_OK);
17041888 for(int i = 0; i < maxviewports; i++)
17051889 {
17061890 if(lpd3dViewport == viewports[i])
@@ -1706,61 +1890,76 @@
17071891 {
17081892 viewports[i]->SetCurrent(true);
17091893 currentviewport = (glDirect3DViewport3*)lpd3dViewport;
 1894+ TRACE_EXIT(23,D3D_OK);
17101895 return D3D_OK;
17111896 }
17121897 }
 1898+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
17131899 return DDERR_INVALIDPARAMS;
17141900 }
17151901
17161902 HRESULT glDirect3DDevice7::Begin(D3DPRIMITIVETYPE d3dpt, DWORD dwVertexTypeDesc, DWORD dwFlags)
17171903 {
1718 - if(!this) return DDERR_INVALIDOBJECT;
 1904+ TRACE_ENTER(4,14,this,8,d3dpt,9,dwVertexTypeDesc,9,dwFlags);
 1905+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
17191906 FIXME("glDirect3DDevice7::Begin: stub");
 1907+ TRACE_EXIT(23,DDERR_GENERIC);
17201908 return DDERR_GENERIC;
17211909 }
17221910 HRESULT glDirect3DDevice7::BeginIndexed(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpvVertices, DWORD dwNumVertices, DWORD dwFlags)
17231911 {
1724 - if(!this) return DDERR_INVALIDOBJECT;
1725 - if(!lpvVertices) return DDERR_INVALIDPARAMS;
 1912+ TRACE_ENTER(6,14,this,8,dptPrimitiveType,9,dwVertexTypeDesc,14,lpvVertices,8,dwNumVertices,9,dwFlags);
 1913+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1914+ if(!lpvVertices) TRACE_RET(23,DDERR_INVALIDPARAMS);
17261915 FIXME("glDirect3DDevice7::BeginIndexed: stub");
 1916+ TRACE_EXIT(23,DDERR_GENERIC);
17271917 return DDERR_GENERIC;
17281918 }
17291919 HRESULT glDirect3DDevice7::Index(WORD wVertexIndex)
17301920 {
1731 - if(!this) return DDERR_INVALIDOBJECT;
 1921+ TRACE_ENTER(2,14,this,5,wVertexIndex);
 1922+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
17321923 FIXME("glDirect3DDevice7::Index: stub");
 1924+ TRACE_EXIT(23,DDERR_GENERIC);
17331925 return DDERR_GENERIC;
17341926 }
17351927 HRESULT glDirect3DDevice7::Vertex(LPVOID lpVertex)
17361928 {
1737 - if(!this) return DDERR_INVALIDOBJECT;
1738 - if(!lpVertex) return DDERR_INVALIDPARAMS;
 1929+ TRACE_ENTER(2,14,this,14,lpVertex);
 1930+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1931+ if(!lpVertex) TRACE_RET(23,DDERR_INVALIDPARAMS);
17391932 FIXME("glDirect3DDevice7::Vertex: stub");
 1933+ TRACE_EXIT(23,DDERR_GENERIC);
17401934 return DDERR_GENERIC;
17411935 }
17421936 HRESULT glDirect3DDevice7::End(DWORD dwFlags)
17431937 {
1744 - if(!this) return DDERR_INVALIDOBJECT;
 1938+ TRACE_ENTER(2,14,this,9,dwFlags);
 1939+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
17451940 FIXME("glDirect3DDevice7::End: stub");
 1941+ TRACE_EXIT(23,DDERR_GENERIC);
17461942 return DDERR_GENERIC;
17471943 }
17481944
17491945 HRESULT glDirect3DDevice7::ComputeSphereVisibility3(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues)
17501946 {
1751 - if(!this) return DDERR_INVALIDOBJECT;
 1947+ TRACE_ENTER(6,14,this,14,lpCenters,14,lpRadii,8,dwNumSpheres,9,dwFlags,14,lpdwReturnValues);
 1948+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
17521949 FIXME("glDirect3DDevice3::ComputeSphereVisibility: stub");
 1950+ TRACE_EXIT(23,DDERR_GENERIC);
17531951 return DDERR_GENERIC;
17541952 }
17551953
17561954 HRESULT glDirect3DDevice7::GetCaps3(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc)
17571955 {
1758 - if(!this) return DDERR_INVALIDOBJECT;
1759 - if(!lpD3DHWDevDesc && !lpD3DHELDevDesc) return DDERR_INVALIDPARAMS;
 1956+ TRACE_ENTER(3,14,this,14,lpD3DHWDevDesc,14,lpD3DHELDevDesc);
 1957+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1958+ if(!lpD3DHWDevDesc && !lpD3DHELDevDesc) TRACE_RET(23,DDERR_INVALIDPARAMS);
17601959 D3DDEVICEDESC desc = d3ddesc3;
17611960 if(lpD3DHELDevDesc)
17621961 {
17631962 desc.dwSize = lpD3DHELDevDesc->dwSize;
1764 - if(desc.dwSize < sizeof(D3DDEVICEDESC1)) return DDERR_INVALIDPARAMS;
 1963+ if(desc.dwSize < sizeof(D3DDEVICEDESC1)) TRACE_RET(23,DDERR_INVALIDPARAMS);
17651964 if(desc.dwSize > sizeof(D3DDEVICEDESC1)) desc.dwSize = sizeof(D3DDEVICEDESC);
17661965 memcpy(lpD3DHELDevDesc, &desc, desc.dwSize);
17671966 }
@@ -1768,54 +1967,61 @@
17691968 if(lpD3DHWDevDesc)
17701969 {
17711970 desc.dwSize = lpD3DHWDevDesc->dwSize;
1772 - if(desc.dwSize < sizeof(D3DDEVICEDESC1)) return DDERR_INVALIDPARAMS;
 1971+ if(desc.dwSize < sizeof(D3DDEVICEDESC1)) TRACE_RET(23,DDERR_INVALIDPARAMS);
17731972 if(desc.dwSize > sizeof(D3DDEVICEDESC1)) desc.dwSize = sizeof(D3DDEVICEDESC);
17741973 memcpy(lpD3DHWDevDesc, &desc, desc.dwSize);
17751974 }
 1975+ TRACE_EXIT(23,D3D_OK);
17761976 return D3D_OK;
17771977 }
17781978
17791979 HRESULT glDirect3DDevice7::GetLightState(D3DLIGHTSTATETYPE dwLightStateType, LPDWORD lpdwLightState)
17801980 {
1781 - if(!this) return DDERR_INVALIDOBJECT;
1782 - if(!lpdwLightState)return DDERR_INVALIDPARAMS;
 1981+ TRACE_ENTER(3,14,this,30,dwLightStateType,14,lpdwLightState);
 1982+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1983+ if(!lpdwLightState)TRACE_RET(23,DDERR_INVALIDPARAMS);
17831984 switch(dwLightStateType)
17841985 {
17851986 default:
 1987+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
17861988 return DDERR_INVALIDPARAMS;
17871989 case D3DLIGHTSTATE_MATERIAL:
17881990 if(currentmaterial) *lpdwLightState = currentmaterial->handle;
17891991 else *lpdwLightState = 0;
 1992+ TRACE_EXIT(23,D3D_OK);
17901993 return D3D_OK;
17911994 case D3DLIGHTSTATE_AMBIENT:
1792 - return GetRenderState(D3DRENDERSTATE_AMBIENT,lpdwLightState);
 1995+ TRACE_RET(23,GetRenderState(D3DRENDERSTATE_AMBIENT,lpdwLightState));
17931996 case D3DLIGHTSTATE_COLORMODEL:
17941997 *lpdwLightState = D3DCOLOR_RGB;
 1998+ TRACE_EXIT(23,D3D_OK);
17951999 return D3D_OK;
17962000 case D3DLIGHTSTATE_FOGMODE:
1797 - return GetRenderState(D3DRENDERSTATE_FOGVERTEXMODE,lpdwLightState);
 2001+ TRACE_RET(23,GetRenderState(D3DRENDERSTATE_FOGVERTEXMODE,lpdwLightState));
17982002 case D3DLIGHTSTATE_FOGSTART:
1799 - return GetRenderState(D3DRENDERSTATE_FOGSTART,lpdwLightState);
 2003+ TRACE_RET(23,GetRenderState(D3DRENDERSTATE_FOGSTART,lpdwLightState));
18002004 case D3DLIGHTSTATE_FOGEND:
1801 - return GetRenderState(D3DRENDERSTATE_FOGEND,lpdwLightState);
 2005+ TRACE_RET(23,GetRenderState(D3DRENDERSTATE_FOGEND,lpdwLightState));
18022006 case D3DLIGHTSTATE_FOGDENSITY:
1803 - return GetRenderState(D3DRENDERSTATE_FOGDENSITY,lpdwLightState);
 2007+ TRACE_RET(23,GetRenderState(D3DRENDERSTATE_FOGDENSITY,lpdwLightState));
18042008 case D3DLIGHTSTATE_COLORVERTEX:
1805 - return GetRenderState(D3DRENDERSTATE_COLORVERTEX,lpdwLightState);
 2009+ TRACE_RET(23,GetRenderState(D3DRENDERSTATE_COLORVERTEX,lpdwLightState));
18062010 }
18072011 }
18082012 HRESULT glDirect3DDevice7::SetLightState(D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState)
18092013 {
1810 - if(!this) return DDERR_INVALIDOBJECT;
 2014+ TRACE_ENTER(3,14,this,30,dwLightStateType,9,dwLightState);
 2015+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
18112016 switch(dwLightStateType)
18122017 {
18132018 default:
 2019+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
18142020 return DDERR_INVALIDPARAMS;
18152021 case D3DLIGHTSTATE_MATERIAL:
1816 - if(!dwLightState) return DDERR_INVALIDPARAMS;
 2022+ if(!dwLightState) TRACE_RET(23,DDERR_INVALIDPARAMS);
18172023 if(dwLightState < materialcount)
18182024 {
1819 - if(materials[dwLightState] == currentmaterial) return D3D_OK;
 2025+ if(materials[dwLightState] == currentmaterial) TRACE_RET(23,D3D_OK);
18202026 if(materials[dwLightState])
18212027 {
18222028 if(currentmaterial)currentmaterial->SetCurrent(false);
@@ -1823,44 +2029,51 @@
18242030 currentmaterial = materials[dwLightState];
18252031 }
18262032 }
 2033+ TRACE_EXIT(23,D3D_OK);
18272034 return D3D_OK;
18282035 case D3DLIGHTSTATE_AMBIENT:
1829 - return SetRenderState(D3DRENDERSTATE_AMBIENT,dwLightState);
 2036+ TRACE_RET(23,SetRenderState(D3DRENDERSTATE_AMBIENT,dwLightState));
18302037 case D3DLIGHTSTATE_COLORMODEL:
 2038+ TRACE_EXIT(23,D3D_OK);
18312039 return D3D_OK;
18322040 case D3DLIGHTSTATE_FOGMODE:
1833 - return SetRenderState(D3DRENDERSTATE_FOGVERTEXMODE,dwLightState);
 2041+ TRACE_RET(23,SetRenderState(D3DRENDERSTATE_FOGVERTEXMODE,dwLightState));
18342042 case D3DLIGHTSTATE_FOGSTART:
1835 - return SetRenderState(D3DRENDERSTATE_FOGSTART,dwLightState);
 2043+ TRACE_RET(23,SetRenderState(D3DRENDERSTATE_FOGSTART,dwLightState));
18362044 case D3DLIGHTSTATE_FOGEND:
1837 - return SetRenderState(D3DRENDERSTATE_FOGEND,dwLightState);
 2045+ TRACE_RET(23,SetRenderState(D3DRENDERSTATE_FOGEND,dwLightState));
18382046 case D3DLIGHTSTATE_FOGDENSITY:
1839 - return SetRenderState(D3DRENDERSTATE_FOGDENSITY,dwLightState);
 2047+ TRACE_RET(23,SetRenderState(D3DRENDERSTATE_FOGDENSITY,dwLightState));
18402048 case D3DLIGHTSTATE_COLORVERTEX:
1841 - return SetRenderState(D3DRENDERSTATE_COLORVERTEX,dwLightState);
 2049+ TRACE_RET(23,SetRenderState(D3DRENDERSTATE_COLORVERTEX,dwLightState));
18422050 }
18432051 }
18442052
18452053 HRESULT glDirect3DDevice7::GetStats(LPD3DSTATS lpD3DStats)
18462054 {
1847 - if(!this) return DDERR_INVALIDOBJECT;
1848 - if(!lpD3DStats) return DDERR_INVALIDPARAMS;
1849 - if(lpD3DStats->dwSize < sizeof(D3DSTATS)) return DDERR_INVALIDPARAMS;
 2055+ TRACE_ENTER(2,14,this,14,lpD3DStats);
 2056+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2057+ if(!lpD3DStats) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2058+ if(lpD3DStats->dwSize < sizeof(D3DSTATS)) TRACE_RET(23,DDERR_INVALIDPARAMS);
18502059 memcpy(lpD3DStats,&stats,sizeof(D3DSTATS));
 2060+ TRACE_EXIT(23,D3D_OK);
18512061 return D3D_OK;
18522062 }
18532063
18542064 HRESULT glDirect3DDevice7::SwapTextureHandles(LPDIRECT3DTEXTURE2 lpD3DTex1, LPDIRECT3DTEXTURE2 lpD3DTex2)
18552065 {
1856 - if(!this) return DDERR_INVALIDOBJECT;
1857 - if(!lpD3DTex1) return DDERR_INVALIDPARAMS;
1858 - if(!lpD3DTex2) return DDERR_INVALIDPARAMS;
 2066+ TRACE_ENTER(3,14,this,14,lpD3DTex1,14,lpD3DTex2);
 2067+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2068+ if(!lpD3DTex1) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2069+ if(!lpD3DTex2) TRACE_RET(23,DDERR_INVALIDPARAMS);
18592070 FIXME("glDirect3DDevice7::SwapTextureHandles: stub");
 2071+ TRACE_EXIT(23,DDERR_GENERIC);
18602072 return DDERR_GENERIC;
18612073 }
18622074
18632075 void glDirect3DDevice7::InitDX5()
18642076 {
 2077+ TRACE_ENTER(1,14,this);
18652078 SetRenderState(D3DRENDERSTATE_TEXTUREHANDLE,0);
18662079 SetRenderState(D3DRENDERSTATE_TEXTUREADDRESS,D3DTADDRESS_WRAP);
18672080 SetRenderState(D3DRENDERSTATE_WRAPU,FALSE);
@@ -1869,17 +2082,19 @@
18702083 SetRenderState(D3DRENDERSTATE_TEXTUREMIN,D3DFILTER_NEAREST);
18712084 SetRenderState(D3DRENDERSTATE_TEXTUREMAPBLEND,D3DTBLEND_MODULATE);
18722085 SetRenderState(D3DRENDERSTATE_SPECULARENABLE,TRUE);
 2086+ TRACE_EXIT(0,0);
18732087 }
18742088
18752089 HRESULT glDirect3DDevice7::CreateMatrix(LPD3DMATRIXHANDLE lpD3DMatHandle)
18762090 {
1877 - if(!this) return DDERR_INVALIDOBJECT;
1878 - if(!lpD3DMatHandle) return DDERR_INVALIDPARAMS;
 2091+ TRACE_ENTER(2,14,this,14,lpD3DMatHandle);
 2092+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2093+ if(!lpD3DMatHandle) TRACE_RET(23,DDERR_INVALIDPARAMS);
18792094 int foundslot = 0;
18802095 if(!matrices)
18812096 {
18822097 matrices = (D3D1MATRIX*)malloc(16*sizeof(D3D1MATRIX));
1883 - if(!matrices) return DDERR_OUTOFMEMORY;
 2098+ if(!matrices) TRACE_RET(23,DDERR_OUTOFMEMORY);
18842099 ZeroMemory(matrices,16*sizeof(D3D1MATRIX));
18852100 matrixcount = 16;
18862101 }
@@ -1898,7 +2113,7 @@
18992114 D3D1MATRIX *newmatrices;
19002115 newcount = matrixcount + 16;
19012116 newmatrices = (D3D1MATRIX*)realloc(matrices,newcount*sizeof(D3D1MATRIX));
1902 - if(!newmatrices) return DDERR_OUTOFMEMORY;
 2117+ if(!newmatrices) TRACE_RET(23,DDERR_OUTOFMEMORY);
19032118 ZeroMemory(&newmatrices[matrixcount],16*sizeof(D3D1MATRIX));
19042119 matrices = newmatrices;
19052120 foundslot = matrixcount;
@@ -1907,43 +2122,52 @@
19082123 *lpD3DMatHandle = foundslot;
19092124 __gluMakeIdentityf((GLfloat*)&matrices[foundslot].matrix);
19102125 matrices[foundslot].active = TRUE;
 2126+ TRACE_VAR("*lpD3DMatHandle",9,*lpD3DMatHandle);
 2127+ TRACE_EXIT(23,D3D_OK);
19112128 return D3D_OK;
19122129 }
19132130
19142131 HRESULT glDirect3DDevice7::DeleteMatrix(D3DMATRIXHANDLE d3dMatHandle)
19152132 {
1916 - if(!this) return DDERR_INVALIDOBJECT;
1917 - if(!d3dMatHandle) return DDERR_INVALIDPARAMS;
1918 - if(d3dMatHandle >= matrixcount) return DDERR_INVALIDPARAMS;
1919 - if(!matrices[d3dMatHandle].active) return D3DERR_MATRIX_DESTROY_FAILED;
 2133+ TRACE_ENTER(2,14,this,9,d3dMatHandle);
 2134+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2135+ if(!d3dMatHandle) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2136+ if(d3dMatHandle >= matrixcount) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2137+ if(!matrices[d3dMatHandle].active) TRACE_RET(23,D3DERR_MATRIX_DESTROY_FAILED);
19202138 matrices[d3dMatHandle].active = FALSE;
 2139+ TRACE_EXIT(23,D3D_OK);
19212140 return D3D_OK;
19222141 }
19232142
19242143 HRESULT glDirect3DDevice7::GetMatrix(D3DMATRIXHANDLE lpD3DMatHandle, LPD3DMATRIX lpD3DMatrix)
19252144 {
1926 - if(!this) return DDERR_INVALIDOBJECT;
 2145+ TRACE_ENTER(3,14,this,9,lpD3DMatHandle,14,lpD3DMatrix);
 2146+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
19272147 if(!lpD3DMatHandle)
19282148 {
19292149 __gluMakeIdentityf((GLfloat*)lpD3DMatrix);
 2150+ TRACE_EXIT(23,D3D_OK);
19302151 return D3D_OK;
19312152 }
1932 - if(lpD3DMatHandle >= matrixcount) return DDERR_INVALIDPARAMS;
1933 - if(!matrices[lpD3DMatHandle].active) return D3DERR_MATRIX_GETDATA_FAILED;
 2153+ if(lpD3DMatHandle >= matrixcount) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2154+ if(!matrices[lpD3DMatHandle].active) TRACE_RET(23,D3DERR_MATRIX_GETDATA_FAILED);
19342155 memcpy(lpD3DMatrix,&matrices[lpD3DMatHandle].matrix,sizeof(D3DMATRIX));
 2156+ TRACE_EXIT(23,D3D_OK);
19352157 return D3D_OK;
19362158 }
19372159
19382160 HRESULT glDirect3DDevice7::SetMatrix(D3DMATRIXHANDLE d3dMatHandle, LPD3DMATRIX lpD3DMatrix)
19392161 {
1940 - if(!this) return DDERR_INVALIDOBJECT;
1941 - if(!d3dMatHandle) return DDERR_INVALIDPARAMS;
1942 - if(d3dMatHandle >= matrixcount) return DDERR_INVALIDPARAMS;
1943 - if(!matrices[d3dMatHandle].active) return D3DERR_MATRIX_SETDATA_FAILED;
 2162+ TRACE_ENTER(3,14,this,9,d3dMatHandle,14,lpD3DMatrix);
 2163+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2164+ if(!d3dMatHandle) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2165+ if(d3dMatHandle >= matrixcount) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2166+ if(!matrices[d3dMatHandle].active) TRACE_RET(23,D3DERR_MATRIX_SETDATA_FAILED);
19442167 memcpy(&matrices[d3dMatHandle].matrix,lpD3DMatrix,sizeof(D3DMATRIX));
19452168 if(d3dMatHandle == mhWorld) SetTransform(D3DTRANSFORMSTATE_WORLD,lpD3DMatrix);
19462169 if(d3dMatHandle == mhView) SetTransform(D3DTRANSFORMSTATE_VIEW,lpD3DMatrix);
19472170 if(d3dMatHandle == mhProjection) SetTransform(D3DTRANSFORMSTATE_PROJECTION,lpD3DMatrix);
 2171+ TRACE_EXIT(23,D3D_OK);
19482172 return D3D_OK;
19492173 }
19502174
@@ -1950,14 +2174,17 @@
19512175 HRESULT glDirect3DDevice7::CreateExecuteBuffer(LPD3DEXECUTEBUFFERDESC lpDesc, LPDIRECT3DEXECUTEBUFFER* lplpDirect3DExecuteBuffer,
19522176 IUnknown* pUnkOuter)
19532177 {
1954 - if(!this) return DDERR_INVALIDOBJECT;
1955 - if(!lpDesc) return DDERR_INVALIDPARAMS;
1956 - if(!lplpDirect3DExecuteBuffer) return DDERR_INVALIDPARAMS;
1957 - if(pUnkOuter) return DDERR_INVALIDPARAMS;
1958 - if(lpDesc->dwSize != sizeof(D3DEXECUTEBUFFERDESC)) return DDERR_INVALIDPARAMS;
1959 - if(!(lpDesc->dwFlags & D3DDEB_BUFSIZE)) return DDERR_INVALIDPARAMS;
 2178+ TRACE_ENTER(4,14,this,14,lpDesc,14,lplpDirect3DExecuteBuffer,14,pUnkOuter);
 2179+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2180+ if(!lpDesc) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2181+ if(!lplpDirect3DExecuteBuffer) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2182+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2183+ if(lpDesc->dwSize != sizeof(D3DEXECUTEBUFFERDESC)) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2184+ if(!(lpDesc->dwFlags & D3DDEB_BUFSIZE)) TRACE_RET(23,DDERR_INVALIDPARAMS);
19602185 *lplpDirect3DExecuteBuffer = new glDirect3DExecuteBuffer(lpDesc);
1961 - if(!*lplpDirect3DExecuteBuffer) return DDERR_OUTOFMEMORY;
 2186+ if(!*lplpDirect3DExecuteBuffer) TRACE_RET(23,DDERR_OUTOFMEMORY);
 2187+ TRACE_VAR("*lplpDirect3DExecuteBuffer",14,*lplpDirect3DExecuteBuffer);
 2188+ TRACE_EXIT(23,D3D_OK);
19622189 return D3D_OK;
19632190 }
19642191
@@ -1984,10 +2211,12 @@
19852212
19862213 void glDirect3DDevice7::UpdateTransform()
19872214 {
 2215+ TRACE_ENTER(1,14,this);
19882216 GLfloat mat1[16];
19892217 __gluMultMatricesf(matWorld,matView,mat1);
19902218 __gluMultMatricesf(mat1,matProjection,matTransform);
19912219 transform_dirty = false;
 2220+ TRACE_EXIT(0,0);
19922221 }
19932222
19942223 void CalculateExtents(D3DRECT *extents, D3DTLVERTEX *vertices, DWORD count)
@@ -2087,6 +2316,7 @@
20882317
20892318 INT glDirect3DDevice7::TransformAndLight(D3DTLVERTEX **output, DWORD *outsize, D3DVERTEX *input, WORD start, WORD dest, DWORD count, D3DRECT *extents)
20902319 {
 2320+ TRACE_ENTER(8,14,this,14,output,14,outsize,14,input,5,start,5,dest,8,count,14,extents);
20912321 D3DVALUE dir[3];
20922322 D3DVALUE eye[3] = {0.0,0.0,1.0};
20932323 D3DVALUE P[4];
@@ -2109,7 +2339,7 @@
21102340 if(*outsize < (dest+count)*sizeof(D3DTLVERTEX))
21112341 {
21122342 D3DTLVERTEX *tmpptr = (D3DTLVERTEX*)realloc(*output,(dest+count)*sizeof(D3DTLVERTEX));
2113 - if(!tmpptr) return -1;
 2343+ if(!tmpptr) TRACE_RET(11,-1);
21142344 *output = tmpptr;
21152345 *outsize = (dest+count)*sizeof(D3DTLVERTEX);
21162346 }
@@ -2208,10 +2438,12 @@
22092439 }
22102440 }
22112441 if(extents) CalculateExtents(extents,*output,count);
 2442+ TRACE_EXIT(11,0);
22122443 return 0;
22132444 }
22142445 INT glDirect3DDevice7::TransformOnly(D3DTLVERTEX **output, DWORD *outsize, D3DVERTEX *input, WORD start, WORD dest, DWORD count, D3DRECT *extents)
22152446 {
 2447+ TRACE_ENTER(8,14,this,14,output,14,outsize,14,input,5,start,5,dest,8,count,14,extents);
22162448 GLfloat in[4];
22172449 in[3] = 1.0f;
22182450 if(transform_dirty) UpdateTransform();
@@ -2218,7 +2450,7 @@
22192451 if(*outsize < (dest+count)*sizeof(D3DTLVERTEX))
22202452 {
22212453 D3DTLVERTEX *tmpptr = (D3DTLVERTEX*)realloc(*output,(dest+count)*sizeof(D3DTLVERTEX));
2222 - if(!tmpptr) return -1;
 2454+ if(!tmpptr) TRACE_RET(11,-1);
22232455 *output = tmpptr;
22242456 *outsize = (dest+count)*sizeof(D3DTLVERTEX);
22252457 }
@@ -2236,10 +2468,12 @@
22372469 (*output)[i+dest].dvTV = input[i+start].dvTV;
22382470 }
22392471 if(extents) CalculateExtents(extents,*output,count);
 2472+ TRACE_EXIT(11,0);
22402473 return 0;
22412474 }
22422475 INT glDirect3DDevice7::TransformOnly(D3DTLVERTEX **output, DWORD *outsize, D3DLVERTEX *input, WORD start, WORD dest, DWORD count, D3DRECT *extents)
22432476 {
 2477+ TRACE_ENTER(8,14,this,14,output,14,outsize,14,input,5,start,5,dest,8,count,14,extents);
22442478 GLfloat in[4];
22452479 in[3] = 1.0f;
22462480 if(transform_dirty) UpdateTransform();
@@ -2246,7 +2480,7 @@
22472481 if(*outsize < (dest+count)*sizeof(D3DTLVERTEX))
22482482 {
22492483 D3DTLVERTEX *tmpptr = (D3DTLVERTEX*)realloc(*output,(dest+count)*sizeof(D3DTLVERTEX));
2250 - if(!tmpptr) return -1;
 2484+ if(!tmpptr) TRACE_RET(11,-1);
22512485 *output = tmpptr;
22522486 *outsize = (dest+count)*sizeof(D3DTLVERTEX);
22532487 }
@@ -2264,33 +2498,38 @@
22652499 (*output)[i+dest].dvTV = input[i+start].dvTV;
22662500 }
22672501 if(extents) CalculateExtents(extents,*output,count);
 2502+ TRACE_EXIT(11,0);
22682503 return 0;
22692504 }
22702505 INT glDirect3DDevice7::CopyVertices(D3DTLVERTEX **output, DWORD *outsize, D3DTLVERTEX *input, WORD start, WORD dest, DWORD count, D3DRECT *extents)
22712506 {
 2507+ TRACE_ENTER(8,14,this,14,output,14,outsize,14,input,5,start,5,dest,8,count,14,extents);
22722508 if(transform_dirty) UpdateTransform();
22732509 if(*outsize < (dest+count)*sizeof(D3DTLVERTEX))
22742510 {
22752511 D3DTLVERTEX *tmpptr = (D3DTLVERTEX*)realloc(*output,(dest+count)*sizeof(D3DTLVERTEX));
2276 - if(!tmpptr) return -1;
 2512+ if(!tmpptr) TRACE_RET(11,-1);
22772513 *output = tmpptr;
22782514 *outsize = (dest+count)*sizeof(D3DTLVERTEX);
22792515 }
22802516 memcpy(&(*output)[dest],&input[start],count*sizeof(D3DTLVERTEX));
22812517 if(extents) CalculateExtents(extents,*output,count);
 2518+ TRACE_EXIT(11,0);
22822519 return 0;
22832520 }
22842521
22852522 HRESULT glDirect3DDevice7::Execute(LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer, LPDIRECT3DVIEWPORT lpDirect3DViewport, DWORD dwFlags)
22862523 {
2287 - if(!this) return DDERR_INVALIDOBJECT;
2288 - if(!lpDirect3DExecuteBuffer) return DDERR_INVALIDPARAMS;
2289 - if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
 2524+ TRACE_ENTER(4,14,this,14,lpDirect3DExecuteBuffer,14,lpDirect3DViewport,9,dwFlags);
 2525+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2526+ if(!lpDirect3DExecuteBuffer) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2527+ if(!lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
22902528 LPDIRECT3DVIEWPORT3 vp;
22912529 lpDirect3DViewport->QueryInterface(IID_IDirect3DViewport3,(void**)&vp);
22922530 if(FAILED(SetCurrentViewport(vp)))
22932531 {
22942532 vp->Release();
 2533+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
22952534 return DDERR_INVALIDPARAMS;
22962535 }
22972536 vp->Release();
@@ -2297,7 +2536,7 @@
22982537 D3DEXECUTEBUFFERDESC desc;
22992538 D3DEXECUTEDATA data;
23002539 HRESULT err = ((glDirect3DExecuteBuffer*)lpDirect3DExecuteBuffer)->ExecuteLock(&desc,&data);
2301 - if(FAILED(err)) return err;
 2540+ if(FAILED(err)) TRACE_RET(23,err);
23022541 unsigned char *opptr = (unsigned char *)desc.lpData + data.dwInstructionOffset;
23032542 unsigned char *in_vertptr = (unsigned char *)desc.lpData + data.dwVertexOffset;
23042543 DWORD offset;
@@ -2308,7 +2547,7 @@
23092548 if(outbuffersize < desc.dwBufferSize)
23102549 {
23112550 unsigned char *tmpbuffer = (unsigned char *)realloc(outbuffer,desc.dwBufferSize);
2312 - if(!tmpbuffer) return DDERR_OUTOFMEMORY;
 2551+ if(!tmpbuffer) TRACE_RET(23,DDERR_OUTOFMEMORY);
23132552 outbuffer = tmpbuffer;
23142553 outbuffersize = desc.dwBufferSize;
23152554 }
@@ -2332,7 +2571,7 @@
23332572 {
23342573 if(!ExpandBuffer((void**)&ebBuffer,&ebBufferSize,(((D3DPOINT*)opptr)->wCount*sizeof(D3DVERTEX) > 1024) ?
23352574 ((D3DPOINT*)opptr)->wCount*sizeof(D3DVERTEX) : 1024))
2336 - return DDERR_OUTOFMEMORY;
 2575+ TRACE_RET(23,DDERR_OUTOFMEMORY);
23372576 }
23382577 memcpy(&ebBuffer+offset,&vert_ptr[((D3DPOINT*)opptr)->wFirst],((D3DPOINT*)opptr)->wCount*sizeof(D3DVERTEX));
23392578 offset+=((D3DPOINT*)opptr)->wCount;
@@ -2351,7 +2590,7 @@
23522591 {
23532592 if(ebBufferSize < (offset + sizeof(D3DLINE)))
23542593 {
2355 - if(!ExpandBuffer((void**)&ebBuffer,&ebBufferSize,1024)) return DDERR_OUTOFMEMORY;
 2594+ if(!ExpandBuffer((void**)&ebBuffer,&ebBufferSize,1024)) TRACE_RET(23,DDERR_OUTOFMEMORY);
23562595 }
23572596 memcpy(&ebBuffer+offset,opptr,sizeof(D3DLINE));
23582597 offset += sizeof(D3DLINE);
@@ -2370,7 +2609,7 @@
23712610 for(i = 0; i < instruction->wCount; i++)
23722611 {
23732612 result = AddTriangle(&ebBuffer,&ebBufferSize,&offset,(D3DTRIANGLE*)opptr);
2374 - if(result == -1) return DDERR_OUTOFMEMORY;
 2613+ if(result == -1) TRACE_RET(23,DDERR_OUTOFMEMORY);
23752614 opptr += instruction->bSize;
23762615 }
23772616 if(instruction->wCount) DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_TLVERTEX,vert_ptr,
@@ -2548,14 +2787,17 @@
25492788 if(ebExit) break;
25502789 }
25512790 ((glDirect3DExecuteBuffer*)lpDirect3DExecuteBuffer)->ExecuteUnlock(&data);
 2791+ TRACE_EXIT(23,D3D_OK);
25522792 return D3D_OK;
25532793 }
25542794
25552795 HRESULT glDirect3DDevice7::GetPickRecords(LPDWORD lpCount, LPD3DPICKRECORD lpD3DPickRec)
25562796 {
2557 - if(!this) return DDERR_INVALIDOBJECT;
2558 - if(!lpCount) return DDERR_INVALIDOBJECT;
 2797+ TRACE_ENTER(3,14,this,14,lpCount,14,lpD3DPickRec);
 2798+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2799+ if(!lpCount) TRACE_RET(23,DDERR_INVALIDOBJECT);
25592800 FIXME("glDirect3DDevice1::GetPickRecords: stub");
 2801+ TRACE_EXIT(23,DDERR_GENERIC);
25602802 ERR(DDERR_GENERIC);
25612803 }
25622804
@@ -2562,11 +2804,13 @@
25632805 HRESULT glDirect3DDevice7::Pick(LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer, LPDIRECT3DVIEWPORT lpDirect3DViewport, DWORD dwFlags,
25642806 LPD3DRECT lpRect)
25652807 {
2566 - if(!this) return DDERR_INVALIDOBJECT;
2567 - if(lpDirect3DExecuteBuffer) return DDERR_INVALIDPARAMS;
2568 - if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
2569 - if(!lpRect) return DDERR_INVALIDPARAMS;
 2808+ TRACE_ENTER(5,14,this,14,lpDirect3DExecuteBuffer,14,lpDirect3DViewport,9,dwFlags,26,lpRect);
 2809+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2810+ if(lpDirect3DExecuteBuffer) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2811+ if(!lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2812+ if(!lpRect) TRACE_RET(23,DDERR_INVALIDPARAMS);
25702813 FIXME("glDirect3DDevice1::Pick: stub");
 2814+ TRACE_EXIT(23,DDERR_GENERIC);
25712815 ERR(DDERR_GENERIC);
25722816 }
25732817
@@ -2573,356 +2817,425 @@
25742818 // IDirect3DDevice3 wrapper
25752819 glDirect3DDevice3::glDirect3DDevice3(glDirect3DDevice7 *glD3DDev7)
25762820 {
 2821+ TRACE_ENTER(2,14,this,14,glD3DDev7);
25772822 this->glD3DDev7 = glD3DDev7;
25782823 refcount = 1;
 2824+ TRACE_EXIT(-1,0);
25792825 }
25802826
25812827 glDirect3DDevice3::~glDirect3DDevice3()
25822828 {
 2829+ TRACE_ENTER(1,14,this);
25832830 glD3DDev7->glD3DDev3 = NULL;
25842831 glD3DDev7->Release();
 2832+ TRACE_EXIT(-1,0);
25852833 }
25862834
25872835 HRESULT WINAPI glDirect3DDevice3::QueryInterface(REFIID riid, void** ppvObj)
25882836 {
2589 - if(!this) return DDERR_INVALIDOBJECT;
 2837+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 2838+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
25902839 if(riid == IID_IUnknown)
25912840 {
25922841 this->AddRef();
25932842 *ppvObj = this;
 2843+ TRACE_VAR("*ppvObj",14,*ppvObj);
 2844+ TRACE_EXIT(23,DD_OK);
25942845 return DD_OK;
25952846 }
2596 - return glD3DDev7->QueryInterface(riid,ppvObj);
 2847+ TRACE_RET(23,glD3DDev7->QueryInterface(riid,ppvObj));
25972848 }
25982849
25992850 ULONG WINAPI glDirect3DDevice3::AddRef()
26002851 {
2601 - if(!this) return 0;
 2852+ TRACE_ENTER(1,14,this);
 2853+ if(!this) TRACE_RET(8,0);
26022854 refcount++;
 2855+ TRACE_EXIT(8,refcount);
26032856 return refcount;
26042857 }
26052858
26062859 ULONG WINAPI glDirect3DDevice3::Release()
26072860 {
2608 - if(!this) return 0;
 2861+ TRACE_ENTER(1,14,this);
 2862+ if(!this) TRACE_RET(8,0);
26092863 ULONG ret;
26102864 refcount--;
26112865 ret = refcount;
26122866 if(refcount == 0) delete this;
 2867+ TRACE_EXIT(8,ret);
26132868 return ret;
26142869 }
26152870
26162871 HRESULT WINAPI glDirect3DDevice3::AddViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport)
26172872 {
2618 - if(!this) return DDERR_INVALIDOBJECT;
2619 - return glD3DDev7->AddViewport(lpDirect3DViewport);
 2873+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport);
 2874+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2875+ TRACE_RET(23,glD3DDev7->AddViewport(lpDirect3DViewport));
26202876 }
26212877
26222878 HRESULT WINAPI glDirect3DDevice3::Begin(D3DPRIMITIVETYPE d3dpt, DWORD dwVertexTypeDesc, DWORD dwFlags)
26232879 {
2624 - if(!this) return DDERR_INVALIDOBJECT;
2625 - return glD3DDev7->Begin(d3dpt,dwVertexTypeDesc,dwFlags);
 2880+ TRACE_ENTER(4,14,this,8,d3dpt,9,dwVertexTypeDesc,9,dwFlags);
 2881+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2882+ TRACE_RET(23,glD3DDev7->Begin(d3dpt,dwVertexTypeDesc,dwFlags));
26262883 }
26272884
26282885 HRESULT WINAPI glDirect3DDevice3::BeginIndexed(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpvVertices, DWORD dwNumVertices, DWORD dwFlags)
26292886 {
2630 - if(!this) return DDERR_INVALIDOBJECT;
2631 - return glD3DDev7->BeginIndexed(dptPrimitiveType,dwVertexTypeDesc,lpvVertices,dwNumVertices,dwFlags);
 2887+ TRACE_ENTER(6,14,this,8,dptPrimitiveType,9,dwVertexTypeDesc,14,lpvVertices,8,dwNumVertices,9,dwFlags);
 2888+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2889+ TRACE_RET(23,glD3DDev7->BeginIndexed(dptPrimitiveType,dwVertexTypeDesc,lpvVertices,dwNumVertices,dwFlags));
26322890 }
26332891
26342892 HRESULT WINAPI glDirect3DDevice3::BeginScene()
26352893 {
2636 - if(!this) return DDERR_INVALIDOBJECT;
2637 - return glD3DDev7->BeginScene();
 2894+ TRACE_ENTER(1,14,this);
 2895+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2896+ TRACE_RET(23,glD3DDev7->BeginScene());
26382897 }
26392898
26402899 HRESULT WINAPI glDirect3DDevice3::ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues)
26412900 {
2642 - if(!this) return DDERR_INVALIDOBJECT;
2643 - return glD3DDev7->ComputeSphereVisibility3(lpCenters,lpRadii,dwNumSpheres,dwFlags,lpdwReturnValues);
 2901+ TRACE_ENTER(6,14,this,14,lpCenters,14,lpRadii,8,dwNumSpheres,9,dwFlags,14,lpdwReturnValues);
 2902+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2903+ TRACE_RET(23,glD3DDev7->ComputeSphereVisibility3(lpCenters,lpRadii,dwNumSpheres,dwFlags,lpdwReturnValues));
26442904 }
26452905
26462906 HRESULT WINAPI glDirect3DDevice3::DeleteViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport)
26472907 {
2648 - if(!this) return DDERR_INVALIDOBJECT;
2649 - return glD3DDev7->DeleteViewport(lpDirect3DViewport);
 2908+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport);
 2909+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2910+ TRACE_RET(23,glD3DDev7->DeleteViewport(lpDirect3DViewport));
26502911 }
26512912
26522913 HRESULT WINAPI glDirect3DDevice3::DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
2653 - LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
 2914+ LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
26542915 {
2655 - if(!this) return DDERR_INVALIDOBJECT;
2656 - return glD3DDev7->DrawIndexedPrimitive(d3dptPrimitiveType,dwVertexTypeDesc,lpvVertices,dwVertexCount,lpwIndices,dwIndexCount,dwFlags);
 2916+ TRACE_ENTER(8,14,this,8,d3dptPrimitiveType,9,dwVertexTypeDesc,14,lpvVertices,8,dwVertexCount,14,lpwIndices,8,dwIndexCount,9,dwFlags);
 2917+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2918+ TRACE_RET(23,glD3DDev7->DrawIndexedPrimitive(d3dptPrimitiveType,dwVertexTypeDesc,lpvVertices,dwVertexCount,lpwIndices,dwIndexCount,dwFlags));
26572919 }
26582920
26592921 HRESULT WINAPI glDirect3DDevice3::DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
26602922 LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
26612923 {
2662 - if(!this) return DDERR_INVALIDOBJECT;
2663 - return glD3DDev7->DrawIndexedPrimitiveStrided(d3dptPrimitiveType,dwVertexTypeDesc,lpVertexArray,dwVertexCount,lpwIndices,dwIndexCount,dwFlags);
 2924+ TRACE_ENTER(8,14,this,8,d3dptPrimitiveType,9,dwVertexTypeDesc,14,lpVertexArray,8,dwVertexCount,14,lpwIndices,8,dwIndexCount,9,dwFlags);
 2925+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2926+ TRACE_RET(23,glD3DDev7->DrawIndexedPrimitiveStrided(d3dptPrimitiveType,dwVertexTypeDesc,lpVertexArray,dwVertexCount,lpwIndices,dwIndexCount,dwFlags));
26642927 }
26652928
26662929 HRESULT WINAPI glDirect3DDevice3::DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER lpd3dVertexBuffer,
26672930 LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
26682931 {
2669 - if(!this) return DDERR_INVALIDOBJECT;
2670 - if(!lpd3dVertexBuffer) return DDERR_INVALIDPARAMS;
2671 - return glD3DDev7->DrawIndexedPrimitiveVB(d3dptPrimitiveType,
2672 - ((glDirect3DVertexBuffer1*)lpd3dVertexBuffer)->GetGLD3DVB7(),0,-1,lpwIndices,dwIndexCount,dwFlags);
 2932+ TRACE_ENTER(6,14,this,8,d3dptPrimitiveType,14,lpd3dVertexBuffer,14,lpwIndices,8,dwIndexCount,9,dwFlags);
 2933+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2934+ if(!lpd3dVertexBuffer) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2935+ TRACE_RET(23,glD3DDev7->DrawIndexedPrimitiveVB(d3dptPrimitiveType,
 2936+ ((glDirect3DVertexBuffer1*)lpd3dVertexBuffer)->GetGLD3DVB7(),0,-1,lpwIndices,dwIndexCount,dwFlags));
26732937 }
26742938
26752939 HRESULT WINAPI glDirect3DDevice3::DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpVertices,
26762940 DWORD dwVertexCount, DWORD dwFlags)
26772941 {
2678 - if(!this) return DDERR_INVALIDOBJECT;
2679 - return glD3DDev7->DrawPrimitive(dptPrimitiveType,dwVertexTypeDesc,lpVertices,dwVertexCount,dwFlags);
 2942+ TRACE_ENTER(6,14,this,8,dptPrimitiveType,9,dwVertexTypeDesc,14,lpVertices,8,dwVertexCount,9,dwFlags);
 2943+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2944+ TRACE_RET(23,glD3DDev7->DrawPrimitive(dptPrimitiveType,dwVertexTypeDesc,lpVertices,dwVertexCount,dwFlags));
26802945 }
26812946
26822947 HRESULT WINAPI glDirect3DDevice3::DrawPrimitiveStrided(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc,
26832948 LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, DWORD dwFlags)
26842949 {
2685 - if(!this) return DDERR_INVALIDOBJECT;
2686 - return glD3DDev7->DrawPrimitiveStrided(dptPrimitiveType,dwVertexTypeDesc,lpVertexArray,dwVertexCount,dwFlags);
 2950+ TRACE_ENTER(6,14,this,8,dptPrimitiveType,9,dwVertexTypeDesc,14,lpVertexArray,8,dwVertexCount,9,dwFlags);
 2951+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2952+ TRACE_RET(23,glD3DDev7->DrawPrimitiveStrided(dptPrimitiveType,dwVertexTypeDesc,lpVertexArray,dwVertexCount,dwFlags));
26872953 }
26882954
26892955 HRESULT WINAPI glDirect3DDevice3::DrawPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER lpd3dVertexBuffer,
26902956 DWORD dwStartVertex, DWORD dwNumVertices, DWORD dwFlags)
26912957 {
2692 - if(!this) return DDERR_INVALIDOBJECT;
2693 - if(!lpd3dVertexBuffer) return DDERR_INVALIDPARAMS;
2694 - return glD3DDev7->DrawPrimitiveVB(d3dptPrimitiveType,((glDirect3DVertexBuffer1*)lpd3dVertexBuffer)->GetGLD3DVB7(),
2695 - dwStartVertex,dwNumVertices,dwFlags);
 2958+ TRACE_ENTER(6,14,this,8,d3dptPrimitiveType,14,lpd3dVertexBuffer,8,dwStartVertex,8,dwNumVertices,9,dwFlags);
 2959+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2960+ if(!lpd3dVertexBuffer) TRACE_RET(23,DDERR_INVALIDPARAMS);
 2961+ TRACE_RET(23,glD3DDev7->DrawPrimitiveVB(d3dptPrimitiveType,((glDirect3DVertexBuffer1*)lpd3dVertexBuffer)->GetGLD3DVB7(),
 2962+ dwStartVertex,dwNumVertices,dwFlags));
26962963 }
26972964 HRESULT WINAPI glDirect3DDevice3::End(DWORD dwFlags)
26982965 {
2699 - if(!this) return DDERR_INVALIDOBJECT;
2700 - return glD3DDev7->End(dwFlags);
 2966+ TRACE_ENTER(2,14,this,9,dwFlags);
 2967+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2968+ TRACE_RET(23,glD3DDev7->End(dwFlags));
27012969 }
27022970
27032971 HRESULT WINAPI glDirect3DDevice3::EndScene()
27042972 {
2705 - if(!this) return DDERR_INVALIDOBJECT;
2706 - return glD3DDev7->EndScene();
 2973+ TRACE_ENTER(1,14,this);
 2974+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2975+ TRACE_RET(23,glD3DDev7->EndScene());
27072976 }
27082977
27092978 HRESULT WINAPI glDirect3DDevice3::EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg)
27102979 {
2711 - if(!this) return DDERR_INVALIDOBJECT;
2712 - return glD3DDev7->EnumTextureFormats(lpd3dEnumPixelProc,lpArg);
 2980+ TRACE_ENTER(3,14,this,14,lpd3dEnumPixelProc,14,lpArg);
 2981+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2982+ TRACE_RET(23,glD3DDev7->EnumTextureFormats(lpd3dEnumPixelProc,lpArg));
27132983 }
27142984
27152985 HRESULT WINAPI glDirect3DDevice3::GetCaps(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc)
27162986 {
2717 - if(!this) return DDERR_INVALIDOBJECT;
2718 - return glD3DDev7->GetCaps3(lpD3DHWDevDesc,lpD3DHELDevDesc);
 2987+ TRACE_ENTER(3,14,this,14,lpD3DHWDevDesc,14,lpD3DHELDevDesc);
 2988+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2989+ TRACE_RET(23,glD3DDev7->GetCaps3(lpD3DHWDevDesc,lpD3DHELDevDesc));
27192990 }
27202991
27212992 HRESULT WINAPI glDirect3DDevice3::GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
27222993 {
2723 - if(!this) return DDERR_INVALIDOBJECT;
2724 - return glD3DDev7->GetClipStatus(lpD3DClipStatus);
 2994+ TRACE_ENTER(2,14,this,14,lpD3DClipStatus);
 2995+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2996+ TRACE_RET(23,glD3DDev7->GetClipStatus(lpD3DClipStatus));
27252997 }
27262998
27272999 HRESULT WINAPI glDirect3DDevice3::GetCurrentViewport(LPDIRECT3DVIEWPORT3 *lplpd3dViewport)
27283000 {
2729 - if(!this) return DDERR_INVALIDOBJECT;
2730 - return glD3DDev7->GetCurrentViewport(lplpd3dViewport);
 3001+ TRACE_ENTER(2,14,this,14,lplpd3dViewport);
 3002+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3003+ TRACE_RET(23,glD3DDev7->GetCurrentViewport(lplpd3dViewport));
27313004 }
27323005
27333006 HRESULT WINAPI glDirect3DDevice3::GetDirect3D(LPDIRECT3D3 *lplpD3D)
27343007 {
2735 - if(!this) return DDERR_INVALIDOBJECT;
 3008+ TRACE_ENTER(2,14,this,14,lplpD3D);
 3009+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
27363010 LPDIRECT3D7 d3d7;
27373011 HRESULT err = glD3DDev7->GetDirect3D(&d3d7);
2738 - if(!d3d7) return err;
 3012+ if(!d3d7) TRACE_RET(23,err);
27393013 d3d7->QueryInterface(IID_IDirect3D3,(void**)lplpD3D);
27403014 d3d7->Release();
 3015+ TRACE_VAR("*lplpD3D",14,*lplpD3D);
 3016+ TRACE_EXIT(23,err);
27413017 return err;
27423018 }
27433019
27443020 HRESULT WINAPI glDirect3DDevice3::GetLightState(D3DLIGHTSTATETYPE dwLightStateType, LPDWORD lpdwLightState)
27453021 {
2746 - if(!this) return DDERR_INVALIDOBJECT;
2747 - return glD3DDev7->GetLightState(dwLightStateType,lpdwLightState);
 3022+ TRACE_ENTER(3,14,this,30,dwLightStateType,14,lpdwLightState);
 3023+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3024+ TRACE_RET(23,glD3DDev7->GetLightState(dwLightStateType,lpdwLightState));
27483025 }
27493026
27503027 HRESULT WINAPI glDirect3DDevice3::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState)
27513028 {
2752 - if(!this) return DDERR_INVALIDOBJECT;
2753 - return glD3DDev7->GetRenderState(dwRenderStateType,lpdwRenderState);
 3029+ TRACE_ENTER(3,14,this,27,dwRenderStateType,14,lpdwRenderState);
 3030+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3031+ TRACE_RET(23,glD3DDev7->GetRenderState(dwRenderStateType,lpdwRenderState));
27543032 }
27553033
27563034 HRESULT WINAPI glDirect3DDevice3::GetRenderTarget(LPDIRECTDRAWSURFACE4 *lplpRenderTarget)
27573035 {
2758 - if(!this) return DDERR_INVALIDOBJECT;
 3036+ TRACE_ENTER(2,14,this,14,lplpRenderTarget);
 3037+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
27593038 LPDIRECTDRAWSURFACE7 dds7;
27603039 HRESULT err = glD3DDev7->GetRenderTarget(&dds7);
2761 - if(!dds7) return err;
 3040+ if(!dds7) TRACE_RET(23,err);
27623041 dds7->QueryInterface(IID_IDirectDrawSurface4,(void**)lplpRenderTarget);
27633042 dds7->Release();
 3043+ TRACE_VAR("*lplpRenderTarget",14,*lplpRenderTarget);
 3044+ TRACE_EXIT(23,err);
27643045 return err;
27653046 }
27663047
27673048 HRESULT WINAPI glDirect3DDevice3::GetStats(LPD3DSTATS lpD3DStats)
27683049 {
2769 - if(!this) return DDERR_INVALIDOBJECT;
2770 - return glD3DDev7->GetStats(lpD3DStats);
 3050+ TRACE_ENTER(2,14,this,14,lpD3DStats);
 3051+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3052+ TRACE_RET(23,glD3DDev7->GetStats(lpD3DStats));
27713053 }
27723054
2773 -HRESULT WINAPI glDirect3DDevice3::GetTexture(DWORD dwStage, LPDIRECT3DTEXTURE2 * lplpTexture)
 3055+HRESULT WINAPI glDirect3DDevice3::GetTexture(DWORD dwStage, LPDIRECT3DTEXTURE2 *lplpTexture)
27743056 {
2775 - if(!this) return DDERR_INVALIDOBJECT;
 3057+ TRACE_ENTER(3,14,this,8,dwStage,14,lplpTexture);
 3058+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
27763059 LPDIRECTDRAWSURFACE7 dds7;
27773060 HRESULT err = glD3DDev7->GetTexture(dwStage,&dds7);
2778 - if(!dds7) return err;
 3061+ if(!dds7) TRACE_RET(23,err);
27793062 dds7->QueryInterface(IID_IDirect3DTexture2,(void**)lplpTexture);
27803063 dds7->Release();
 3064+ TRACE_VAR("*lplpTexture",14,*lplpTexture);
 3065+ TRACE_EXIT(23,err);
27813066 return err;
27823067 }
27833068
27843069 HRESULT WINAPI glDirect3DDevice3::GetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, LPDWORD lpdwValue)
27853070 {
2786 - if(!this) return DDERR_INVALIDOBJECT;
2787 - return glD3DDev7->GetTextureStageState(dwStage,dwState,lpdwValue);
 3071+ TRACE_ENTER(4,14,this,8,dwStage,28,dwState,14,lpdwValue);
 3072+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3073+ TRACE_RET(23,glD3DDev7->GetTextureStageState(dwStage,dwState,lpdwValue));
27883074 }
27893075
27903076 HRESULT WINAPI glDirect3DDevice3::GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
27913077 {
2792 - if(!this) return DDERR_INVALIDOBJECT;
2793 - return glD3DDev7->GetTransform(dtstTransformStateType,lpD3DMatrix);
 3078+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 3079+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3080+ TRACE_RET(23,glD3DDev7->GetTransform(dtstTransformStateType,lpD3DMatrix));
27943081 }
27953082
27963083 HRESULT WINAPI glDirect3DDevice3::Index(WORD wVertexIndex)
27973084 {
2798 - if(!this) return DDERR_INVALIDOBJECT;
2799 - return glD3DDev7->Index(wVertexIndex);
 3085+ TRACE_ENTER(2,14,this,5,wVertexIndex);
 3086+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3087+ TRACE_RET(23,glD3DDev7->Index(wVertexIndex));
28003088 }
28013089
28023090 HRESULT WINAPI glDirect3DDevice3::MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
28033091 {
2804 - if(!this) return DDERR_INVALIDOBJECT;
2805 - return glD3DDev7->MultiplyTransform(dtstTransformStateType,lpD3DMatrix);
 3092+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 3093+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3094+ TRACE_RET(23,glD3DDev7->MultiplyTransform(dtstTransformStateType,lpD3DMatrix));
28063095 }
28073096 HRESULT WINAPI glDirect3DDevice3::NextViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport, LPDIRECT3DVIEWPORT3 *lplpAnotherViewport, DWORD dwFlags)
28083097 {
2809 - if(!this) return DDERR_INVALIDOBJECT;
2810 - return glD3DDev7->NextViewport(lpDirect3DViewport,lplpAnotherViewport,dwFlags);
 3098+ TRACE_ENTER(4,14,this,14,lpDirect3DViewport,14,lplpAnotherViewport,9,dwFlags);
 3099+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3100+ TRACE_RET(23,glD3DDev7->NextViewport(lpDirect3DViewport,lplpAnotherViewport,dwFlags));
28113101 }
28123102
28133103 HRESULT WINAPI glDirect3DDevice3::SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
28143104 {
2815 - if(!this) return DDERR_INVALIDOBJECT;
2816 - return glD3DDev7->SetClipStatus(lpD3DClipStatus);
 3105+ TRACE_ENTER(2,14,this,14,lpD3DClipStatus);
 3106+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3107+ TRACE_RET(23,glD3DDev7->SetClipStatus(lpD3DClipStatus));
28173108 }
28183109
28193110 HRESULT WINAPI glDirect3DDevice3::SetCurrentViewport(LPDIRECT3DVIEWPORT3 lpd3dViewport)
28203111 {
2821 - if(!this) return DDERR_INVALIDOBJECT;
2822 - return glD3DDev7->SetCurrentViewport(lpd3dViewport);
 3112+ TRACE_ENTER(2,14,this,14,lpd3dViewport);
 3113+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3114+ TRACE_RET(23,glD3DDev7->SetCurrentViewport(lpd3dViewport));
28233115 }
28243116
28253117 HRESULT WINAPI glDirect3DDevice3::SetLightState(D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState)
28263118 {
2827 - if(!this) return DDERR_INVALIDOBJECT;
2828 - return glD3DDev7->SetLightState(dwLightStateType,dwLightState);
 3119+ TRACE_ENTER(3,14,this,30,dwLightStateType,8,dwLightState);
 3120+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3121+ TRACE_RET(23,glD3DDev7->SetLightState(dwLightStateType,dwLightState));
28293122 }
28303123
28313124 HRESULT WINAPI glDirect3DDevice3::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
28323125 {
2833 - if(!this) return DDERR_INVALIDOBJECT;
2834 - return glD3DDev7->SetRenderState(dwRendStateType,dwRenderState);
 3126+ TRACE_ENTER(3,14,this,27,dwRendStateType,9,dwRenderState);
 3127+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3128+ TRACE_RET(23,glD3DDev7->SetRenderState(dwRendStateType,dwRenderState));
28353129 }
28363130
28373131 HRESULT WINAPI glDirect3DDevice3::SetRenderTarget(LPDIRECTDRAWSURFACE4 lpNewRenderTarget, DWORD dwFlags)
28383132 {
2839 - if(!this) return DDERR_INVALIDOBJECT;
2840 - return glD3DDev7->SetRenderTarget(((glDirectDrawSurface4*)lpNewRenderTarget)->GetDDS7(),dwFlags);
 3133+ TRACE_ENTER(3,14,this,14,lpNewRenderTarget,9,dwFlags);
 3134+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3135+ TRACE_RET(23,glD3DDev7->SetRenderTarget(((glDirectDrawSurface4*)lpNewRenderTarget)->GetDDS7(),dwFlags));
28413136 }
28423137
28433138 HRESULT WINAPI glDirect3DDevice3::SetTexture(DWORD dwStage, LPDIRECT3DTEXTURE2 lpTexture)
28443139 {
2845 - if(!this) return DDERR_INVALIDOBJECT;
 3140+ TRACE_ENTER(3,14,this,8,dwStage,14,lpTexture);
 3141+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
28463142 glDirectDrawSurface7 *dds7;
28473143 if(lpTexture) dds7 = ((glDirect3DTexture2*)lpTexture)->GetDDS7();
28483144 else dds7 = NULL;
2849 - return glD3DDev7->SetTexture(dwStage,dds7);
 3145+ TRACE_RET(23,glD3DDev7->SetTexture(dwStage,dds7));
28503146 }
28513147
28523148 HRESULT WINAPI glDirect3DDevice3::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue)
28533149 {
2854 - if(!this) return DDERR_INVALIDOBJECT;
2855 - return glD3DDev7->SetTextureStageState(dwStage,dwState,dwValue);
 3150+ TRACE_ENTER(4,14,this,8,dwStage,28,dwState,9,dwValue);
 3151+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3152+ TRACE_RET(23,glD3DDev7->SetTextureStageState(dwStage,dwState,dwValue));
28563153 }
28573154
28583155 HRESULT WINAPI glDirect3DDevice3::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
28593156 {
2860 - if(!this) return DDERR_INVALIDOBJECT;
2861 - return glD3DDev7->SetTransform(dtstTransformStateType,lpD3DMatrix);
 3157+ TRACE_ENTER(3,14,this,27,dtstTransformStateType,14,lpD3DMatrix);
 3158+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3159+ TRACE_RET(23,glD3DDev7->SetTransform(dtstTransformStateType,lpD3DMatrix));
28623160 }
28633161
28643162 HRESULT WINAPI glDirect3DDevice3::ValidateDevice(LPDWORD lpdwPasses)
28653163 {
2866 - if(!this) return DDERR_INVALIDOBJECT;
2867 - return glD3DDev7->ValidateDevice(lpdwPasses);
 3164+ TRACE_ENTER(2,14,this,14,lpdwPasses);
 3165+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3166+ TRACE_RET(23,glD3DDev7->ValidateDevice(lpdwPasses));
28683167 }
28693168
28703169 HRESULT WINAPI glDirect3DDevice3::Vertex(LPVOID lpVertex)
28713170 {
2872 - if(!this) return DDERR_INVALIDOBJECT;
2873 - return glD3DDev7->Vertex(lpVertex);
 3171+ TRACE_ENTER(2,14,this,14,lpVertex);
 3172+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3173+ TRACE_RET(23,glD3DDev7->Vertex(lpVertex));
28743174 }
28753175
28763176 // IDirect3DDevice2 wrapper
28773177 glDirect3DDevice2::glDirect3DDevice2(glDirect3DDevice7 *glD3DDev7)
28783178 {
 3179+ TRACE_ENTER(2,14,this,14,glD3DDev7);
28793180 this->glD3DDev7 = glD3DDev7;
28803181 glD3DDev7->InitDX5();
28813182 refcount = 1;
 3183+ TRACE_EXIT(-1,0);
28823184 }
28833185
28843186 glDirect3DDevice2::~glDirect3DDevice2()
28853187 {
 3188+ TRACE_ENTER(1,14,this);
28863189 glD3DDev7->glD3DDev2 = NULL;
28873190 glD3DDev7->Release();
 3191+ TRACE_EXIT(-1,0);
28883192 }
28893193
28903194 HRESULT WINAPI glDirect3DDevice2::QueryInterface(REFIID riid, void** ppvObj)
28913195 {
2892 - if(!this) return DDERR_INVALIDOBJECT;
 3196+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 3197+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
28933198 if(riid == IID_IUnknown)
28943199 {
28953200 this->AddRef();
28963201 *ppvObj = this;
 3202+ TRACE_VAR("*ppvObj",14,*ppvObj);
 3203+ TRACE_EXIT(23,DD_OK);
28973204 return DD_OK;
28983205 }
2899 - return glD3DDev7->QueryInterface(riid,ppvObj);
 3206+ TRACE_RET(23,glD3DDev7->QueryInterface(riid,ppvObj));
29003207 }
29013208
29023209 ULONG WINAPI glDirect3DDevice2::AddRef()
29033210 {
2904 - if(!this) return 0;
 3211+ TRACE_ENTER(1,14,this);
 3212+ if(!this) TRACE_EXIT(8,0);;
29053213 refcount++;
 3214+ TRACE_EXIT(8,refcount);
29063215 return refcount;
29073216 }
29083217
29093218 ULONG WINAPI glDirect3DDevice2::Release()
29103219 {
2911 - if(!this) return 0;
 3220+ TRACE_ENTER(1,14,this);
 3221+ if(!this) TRACE_EXIT(8,0);
29123222 ULONG ret;
29133223 refcount--;
29143224 ret = refcount;
29153225 if(refcount == 0) delete this;
 3226+ TRACE_EXIT(8,ret);
29163227 return ret;
29173228 }
29183229
29193230 HRESULT WINAPI glDirect3DDevice2::AddViewport(LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
29203231 {
2921 - if(!this) return DDERR_INVALIDOBJECT;
2922 - if(!lpDirect3DViewport2) return DDERR_INVALIDPARAMS;
 3232+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport2);
 3233+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3234+ if(!lpDirect3DViewport2) TRACE_RET(23,DDERR_INVALIDPARAMS);
29233235 glDirect3DViewport3 *glD3DV3;
29243236 lpDirect3DViewport2->QueryInterface(IID_IDirect3DViewport3,(void**)&glD3DV3);
29253237 HRESULT ret = glD3DDev7->AddViewport(glD3DV3);
29263238 glD3DV3->Release();
 3239+ TRACE_EXIT(23,ret);
29273240 return ret;
29283241 }
29293242
@@ -2943,33 +3256,38 @@
29443257
29453258 HRESULT WINAPI glDirect3DDevice2::Begin(D3DPRIMITIVETYPE d3dpt, D3DVERTEXTYPE d3dvt, DWORD dwFlags)
29463259 {
2947 - if(!this) return DDERR_INVALIDOBJECT;
 3260+ TRACE_ENTER(4,14,this,8,d3dpt,8,d3dvt,9,dwFlags);
 3261+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
29483262 DWORD vertextype = d3dvttofvf(d3dvt);
2949 - if(!vertextype) return DDERR_INVALIDPARAMS;
2950 - return glD3DDev7->Begin(d3dpt,vertextype,dwFlags);
 3263+ if(!vertextype) TRACE_RET(23,DDERR_INVALIDPARAMS);
 3264+ TRACE_RET(23,glD3DDev7->Begin(d3dpt,vertextype,dwFlags));
29513265 }
29523266
29533267 HRESULT WINAPI glDirect3DDevice2::BeginIndexed(D3DPRIMITIVETYPE dptPrimitiveType, D3DVERTEXTYPE dvtVertexType, LPVOID lpvVertices, DWORD dwNumVertices, DWORD dwFlags)
29543268 {
2955 - if(!this) return DDERR_INVALIDOBJECT;
 3269+ TRACE_ENTER(6,14,this,8,dptPrimitiveType,8,dvtVertexType,14,lpvVertices,8,dwNumVertices,9,dwFlags);
 3270+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
29563271 DWORD vertextype = d3dvttofvf(dvtVertexType);
2957 - if(!vertextype) return DDERR_INVALIDPARAMS;
2958 - return glD3DDev7->BeginIndexed(dptPrimitiveType,vertextype,lpvVertices,dwNumVertices,dwFlags);
 3272+ if(!vertextype) TRACE_RET(23,DDERR_INVALIDPARAMS);
 3273+ TRACE_RET(23,glD3DDev7->BeginIndexed(dptPrimitiveType,vertextype,lpvVertices,dwNumVertices,dwFlags));
29593274 }
29603275
29613276 HRESULT WINAPI glDirect3DDevice2::BeginScene()
29623277 {
2963 - if(!this) return DDERR_INVALIDOBJECT;
2964 - return glD3DDev7->BeginScene();
 3278+ TRACE_ENTER(1,14,this);
 3279+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3280+ TRACE_RET(23,glD3DDev7->BeginScene());
29653281 }
29663282
29673283 HRESULT WINAPI glDirect3DDevice2::DeleteViewport(LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
29683284 {
2969 - if(!this) return DDERR_INVALIDOBJECT;
 3285+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport2);
 3286+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
29703287 glDirect3DViewport3 *glD3DV3;
29713288 lpDirect3DViewport2->QueryInterface(IID_IDirect3DViewport3,(void**)&glD3DV3);
29723289 HRESULT ret = glD3DDev7->DeleteViewport(glD3DV3);
29733290 glD3DV3->Release();
 3291+ TRACE_EXIT(23,ret);
29743292 return ret;
29753293 }
29763294
@@ -2976,31 +3294,35 @@
29773295 HRESULT WINAPI glDirect3DDevice2::DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, D3DVERTEXTYPE d3dvtVertexType,
29783296 LPVOID lpvVertices, DWORD dwVertexCount, LPWORD dwIndices, DWORD dwIndexCount, DWORD dwFlags)
29793297 {
2980 - if(!this) return DDERR_INVALIDOBJECT;
 3298+ TRACE_ENTER(8,14,this,8,d3dptPrimitiveType,8,d3dvtVertexType,14,lpvVertices,8,dwVertexCount,14,dwIndices,8,dwIndexCount,9,dwFlags);
 3299+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
29813300 DWORD vertextype = d3dvttofvf(d3dvtVertexType);
2982 - if(!vertextype) return DDERR_INVALIDPARAMS;
2983 - return glD3DDev7->DrawIndexedPrimitive(d3dptPrimitiveType,vertextype,lpvVertices,dwVertexCount,dwIndices,dwIndexCount,dwFlags);
 3301+ if(!vertextype) TRACE_RET(23,DDERR_INVALIDPARAMS);
 3302+ TRACE_RET(23,glD3DDev7->DrawIndexedPrimitive(d3dptPrimitiveType,vertextype,lpvVertices,dwVertexCount,dwIndices,dwIndexCount,dwFlags));
29843303 }
29853304
29863305 HRESULT WINAPI glDirect3DDevice2::DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, D3DVERTEXTYPE dvtVertexType, LPVOID lpvVertices,
29873306 DWORD dwVertexCount, DWORD dwFlags)
29883307 {
2989 - if(!this) return DDERR_INVALIDOBJECT;
 3308+ TRACE_ENTER(6,14,this,8,dptPrimitiveType,8,dvtVertexType,14,lpvVertices,8,dwVertexCount,9,dwFlags);
 3309+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
29903310 DWORD vertextype = d3dvttofvf(dvtVertexType);
2991 - if(!vertextype) return DDERR_INVALIDPARAMS;
2992 - return glD3DDev7->DrawPrimitive(dptPrimitiveType,vertextype,lpvVertices,dwVertexCount,dwFlags);
 3311+ if(!vertextype) TRACE_RET(23,DDERR_INVALIDPARAMS);
 3312+ TRACE_RET(23,glD3DDev7->DrawPrimitive(dptPrimitiveType,vertextype,lpvVertices,dwVertexCount,dwFlags));
29933313 }
29943314
29953315 HRESULT WINAPI glDirect3DDevice2::End(DWORD dwFlags)
29963316 {
2997 - if(!this) return DDERR_INVALIDOBJECT;
2998 - return glD3DDev7->End(dwFlags);
 3317+ TRACE_ENTER(2,14,this,9,dwFlags);
 3318+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3319+ TRACE_RET(23,glD3DDev7->End(dwFlags));
29993320 }
30003321
30013322 HRESULT WINAPI glDirect3DDevice2::EndScene()
30023323 {
3003 - if(!this) return DDERR_INVALIDOBJECT;
3004 - return glD3DDev7->EndScene();
 3324+ TRACE_ENTER(1,14,this);
 3325+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3326+ TRACE_RET(23,glD3DDev7->EndScene());
30053327 }
30063328
30073329 HRESULT WINAPI EnumTex2(LPDDPIXELFORMAT ddpf, LPVOID lpUserArg)
@@ -3021,322 +3343,386 @@
30223344
30233345 HRESULT WINAPI glDirect3DDevice2::EnumTextureFormats(LPD3DENUMTEXTUREFORMATSCALLBACK lpd3dEnumTextureProc, LPVOID lpArg)
30243346 {
3025 - if(!this) return DDERR_INVALIDOBJECT;
 3347+ TRACE_ENTER(3,14,this,14,lpd3dEnumTextureProc,14,lpArg);
 3348+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
30263349 LPVOID context[2];
30273350 context[0] = (LPVOID)lpd3dEnumTextureProc;
30283351 context[1] = lpArg;
3029 - return glD3DDev7->EnumTextureFormats(EnumTex2,&context);
 3352+ TRACE_RET(23,glD3DDev7->EnumTextureFormats(EnumTex2,&context));
30303353 }
30313354
30323355 HRESULT WINAPI glDirect3DDevice2::GetCaps(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc)
30333356 {
3034 - if(!this) return DDERR_INVALIDOBJECT;
3035 - return glD3DDev7->GetCaps3(lpD3DHWDevDesc,lpD3DHELDevDesc);
 3357+ TRACE_ENTER(3,14,this,14,lpD3DHWDevDesc,14,lpD3DHELDevDesc);
 3358+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3359+ TRACE_RET(23,glD3DDev7->GetCaps3(lpD3DHWDevDesc,lpD3DHELDevDesc));
30363360 }
30373361
30383362 HRESULT WINAPI glDirect3DDevice2::GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
30393363 {
3040 - if(!this) return DDERR_INVALIDOBJECT;
3041 - return glD3DDev7->GetClipStatus(lpD3DClipStatus);
 3364+ TRACE_ENTER(2,14,this,14,lpD3DClipStatus);
 3365+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3366+ TRACE_RET(23,glD3DDev7->GetClipStatus(lpD3DClipStatus));
30423367 }
30433368
30443369 HRESULT WINAPI glDirect3DDevice2::GetCurrentViewport(LPDIRECT3DVIEWPORT2 *lplpd3dViewport2)
30453370 {
3046 - if(!this) return DDERR_INVALIDOBJECT;
 3371+ TRACE_ENTER(2,14,this,14,lplpd3dViewport2);
 3372+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
30473373 glDirect3DViewport3 *glD3DV3;
30483374 HRESULT ret = glD3DDev7->GetCurrentViewport((LPDIRECT3DVIEWPORT3*)&glD3DV3);
3049 - if(!glD3DV3) return ret;
 3375+ if(!glD3DV3) TRACE_RET(23,ret);
30503376 glD3DV3->QueryInterface(IID_IDirect3DViewport2,(void**)lplpd3dViewport2);
30513377 glD3DV3->Release();
 3378+ TRACE_VAR("*lplpd3dViewport2",14,*lplpd3dViewport2);
 3379+ TRACE_EXIT(23,ret);
30523380 return ret;
30533381 }
30543382
30553383 HRESULT WINAPI glDirect3DDevice2::GetDirect3D(LPDIRECT3D2 *lplpD3D2)
30563384 {
3057 - if(!this) return DDERR_INVALIDOBJECT;
 3385+ TRACE_ENTER(2,14,this,14,lplpD3D2);
 3386+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
30583387 LPDIRECT3D7 d3d7;
30593388 HRESULT err = glD3DDev7->GetDirect3D(&d3d7);
3060 - if(!d3d7) return err;
 3389+ if(!d3d7) TRACE_RET(23,err);
30613390 d3d7->QueryInterface(IID_IDirect3D2,(void**)lplpD3D2);
30623391 d3d7->Release();
 3392+ TRACE_VAR("*lplpD3D2",14,*lplpD3D2);
 3393+ TRACE_EXIT(23,err);
30633394 return err;
30643395 }
30653396
30663397 HRESULT WINAPI glDirect3DDevice2::GetLightState(D3DLIGHTSTATETYPE dwLightStateType, LPDWORD lpdwLightState)
30673398 {
3068 - if(!this) return DDERR_INVALIDOBJECT;
3069 - return glD3DDev7->GetLightState(dwLightStateType,lpdwLightState);
 3399+ TRACE_ENTER(3,14,this,30,dwLightStateType,14,lpdwLightState);
 3400+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3401+ TRACE_RET(23,glD3DDev7->GetLightState(dwLightStateType,lpdwLightState));
30703402 }
30713403
30723404 HRESULT WINAPI glDirect3DDevice2::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState)
30733405 {
3074 - if(!this) return DDERR_INVALIDOBJECT;
3075 - return glD3DDev7->GetRenderState(dwRenderStateType,lpdwRenderState);
 3406+ TRACE_ENTER(3,14,this,27,dwRenderStateType,14,lpdwRenderState);
 3407+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3408+ TRACE_RET(23,glD3DDev7->GetRenderState(dwRenderStateType,lpdwRenderState));
30763409 }
30773410
30783411 HRESULT WINAPI glDirect3DDevice2::GetRenderTarget(LPDIRECTDRAWSURFACE *lplpRenderTarget)
30793412 {
3080 - if(!this) return DDERR_INVALIDOBJECT;
 3413+ TRACE_ENTER(2,14,this,14,lplpRenderTarget);
 3414+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
30813415 LPDIRECTDRAWSURFACE7 dds7;
30823416 HRESULT err = glD3DDev7->GetRenderTarget(&dds7);
3083 - if(!dds7) return err;
 3417+ if(!dds7) TRACE_RET(23,err);
30843418 dds7->QueryInterface(IID_IDirectDrawSurface,(void**)lplpRenderTarget);
30853419 dds7->Release();
 3420+ TRACE_VAR("*lplpRenderTarget",14,*lplpRenderTarget);
 3421+ TRACE_EXIT(23,err);
30863422 return err;
30873423 }
30883424
30893425 HRESULT WINAPI glDirect3DDevice2::GetStats(LPD3DSTATS lpD3DStats)
30903426 {
3091 - if(!this) return DDERR_INVALIDOBJECT;
3092 - return glD3DDev7->GetStats(lpD3DStats);
 3427+ TRACE_ENTER(2,14,this,14,lpD3DStats);
 3428+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3429+ TRACE_RET(23,glD3DDev7->GetStats(lpD3DStats));
30933430 }
30943431
30953432 HRESULT WINAPI glDirect3DDevice2::GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
30963433 {
3097 - if(!this) return DDERR_INVALIDOBJECT;
3098 - return glD3DDev7->GetTransform(dtstTransformStateType,lpD3DMatrix);
 3434+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 3435+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3436+ TRACE_RET(23,glD3DDev7->GetTransform(dtstTransformStateType,lpD3DMatrix));
30993437 }
31003438
31013439 HRESULT WINAPI glDirect3DDevice2::Index(WORD wVertexIndex)
31023440 {
3103 - if(!this) return DDERR_INVALIDOBJECT;
3104 - return glD3DDev7->Index(wVertexIndex);
 3441+ TRACE_ENTER(2,14,this,5,wVertexIndex);
 3442+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3443+ TRACE_RET(23,glD3DDev7->Index(wVertexIndex));
31053444 }
31063445
31073446 HRESULT WINAPI glDirect3DDevice2::MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
31083447 {
3109 - if(!this) return DDERR_INVALIDOBJECT;
3110 - return glD3DDev7->MultiplyTransform(dtstTransformStateType,lpD3DMatrix);
 3448+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 3449+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3450+ TRACE_RET(23,glD3DDev7->MultiplyTransform(dtstTransformStateType,lpD3DMatrix));
31113451 }
31123452
31133453 HRESULT WINAPI glDirect3DDevice2::NextViewport(LPDIRECT3DVIEWPORT2 lpDirect3DViewport2, LPDIRECT3DVIEWPORT2 *lplpDirect3DViewport2, DWORD dwFlags)
31143454 {
3115 - if(!this) return DDERR_INVALIDOBJECT;
3116 - if(!lpDirect3DViewport2) return DDERR_INVALIDPARAMS;
3117 - if(!lplpDirect3DViewport2) return DDERR_INVALIDPARAMS;
 3455+ TRACE_ENTER(4,14,this,14,lpDirect3DViewport2,14,lplpDirect3DViewport2,9,dwFlags);
 3456+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3457+ if(!lpDirect3DViewport2) TRACE_RET(23,DDERR_INVALIDPARAMS);
 3458+ if(!lplpDirect3DViewport2) TRACE_RET(23,DDERR_INVALIDPARAMS);
31183459 FIXME("glDirect3DDevice2::NextViewport: stub");
 3460+ TRACE_EXIT(23,DDERR_GENERIC);
31193461 ERR(DDERR_GENERIC);
31203462 }
31213463
31223464 HRESULT WINAPI glDirect3DDevice2::SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
31233465 {
3124 - if(!this) return DDERR_INVALIDOBJECT;
3125 - return glD3DDev7->SetClipStatus(lpD3DClipStatus);
 3466+ TRACE_ENTER(2,14,this,14,lpD3DClipStatus);
 3467+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3468+ TRACE_RET(23,glD3DDev7->SetClipStatus(lpD3DClipStatus));
31263469 }
31273470
31283471 HRESULT WINAPI glDirect3DDevice2::SetCurrentViewport(LPDIRECT3DVIEWPORT2 lpd3dViewport2)
31293472 {
3130 - if(!this) return DDERR_INVALIDOBJECT;
3131 - if(!lpd3dViewport2) return glD3DDev7->SetCurrentViewport(NULL);
 3473+ TRACE_ENTER(2,14,this,14,lpd3dViewport2);
 3474+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3475+ if(!lpd3dViewport2) TRACE_RET(23,glD3DDev7->SetCurrentViewport(NULL));
31323476 glDirect3DViewport3 *glD3DV3;
31333477 lpd3dViewport2->QueryInterface(IID_IDirect3DViewport3,(void**)&glD3DV3);
31343478 HRESULT ret = glD3DDev7->SetCurrentViewport(glD3DV3);
31353479 glD3DV3->Release();
 3480+ TRACE_EXIT(23,ret);
31363481 return ret;
31373482 }
31383483
31393484 HRESULT WINAPI glDirect3DDevice2::SetLightState(D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState)
31403485 {
3141 - if(!this) return DDERR_INVALIDOBJECT;
3142 - return glD3DDev7->SetLightState(dwLightStateType,dwLightState);
 3486+ TRACE_ENTER(3,14,this,30,dwLightStateType,9,dwLightState);
 3487+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3488+ TRACE_RET(23,glD3DDev7->SetLightState(dwLightStateType,dwLightState));
31433489 }
31443490
31453491 HRESULT WINAPI glDirect3DDevice2::SetRenderState(D3DRENDERSTATETYPE dwRenderStateType, DWORD dwRenderState)
31463492 {
3147 - if(!this) return DDERR_INVALIDOBJECT;
3148 - return glD3DDev7->SetRenderState(dwRenderStateType,dwRenderState);
 3493+ TRACE_ENTER(3,14,this,27,dwRenderStateType,9,dwRenderState);
 3494+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3495+ TRACE_RET(23,glD3DDev7->SetRenderState(dwRenderStateType,dwRenderState));
31493496 }
31503497
31513498 HRESULT WINAPI glDirect3DDevice2::SetRenderTarget(LPDIRECTDRAWSURFACE lpNewRenderTarget, DWORD dwFlags)
31523499 {
3153 - if(!this) return DDERR_INVALIDOBJECT;
3154 - return glD3DDev7->SetRenderTarget(((glDirectDrawSurface1*)lpNewRenderTarget)->GetDDS7(),dwFlags);
 3500+ TRACE_ENTER(3,14,this,14,lpNewRenderTarget,9,dwFlags);
 3501+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3502+ TRACE_RET(23,glD3DDev7->SetRenderTarget(((glDirectDrawSurface1*)lpNewRenderTarget)->GetDDS7(),dwFlags));
31553503 }
31563504
31573505 HRESULT WINAPI glDirect3DDevice2::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
31583506 {
3159 - if(!this) return DDERR_INVALIDOBJECT;
3160 - return glD3DDev7->SetTransform(dtstTransformStateType,lpD3DMatrix);
 3507+ TRACE_ENTER(3,14,this,29,dtstTransformStateType,14,lpD3DMatrix);
 3508+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3509+ TRACE_RET(23,glD3DDev7->SetTransform(dtstTransformStateType,lpD3DMatrix));
31613510 }
31623511
31633512 HRESULT WINAPI glDirect3DDevice2::SwapTextureHandles(LPDIRECT3DTEXTURE2 lpD3DTex1, LPDIRECT3DTEXTURE2 lpD3DTex2)
31643513 {
3165 - if(!this) return DDERR_INVALIDOBJECT;
3166 - return glD3DDev7->SwapTextureHandles(lpD3DTex1,lpD3DTex2);
 3514+ TRACE_ENTER(3,14,this,14,lpD3DTex1,14,lpD3DTex2);
 3515+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3516+ TRACE_RET(23,glD3DDev7->SwapTextureHandles(lpD3DTex1,lpD3DTex2));
31673517 }
31683518
31693519 HRESULT WINAPI glDirect3DDevice2::Vertex(LPVOID lpVertexType)
31703520 {
3171 - if(!this) return DDERR_INVALIDOBJECT;
3172 - return glD3DDev7->Vertex(lpVertexType);
 3521+ TRACE_ENTER(2,14,this,14,lpVertexType);
 3522+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3523+ TRACE_RET(23,glD3DDev7->Vertex(lpVertexType));
31733524 }
31743525
31753526 // IDirect3DDevice wrapper
31763527 glDirect3DDevice1::glDirect3DDevice1(glDirect3DDevice7 *glD3DDev7)
31773528 {
 3529+ TRACE_ENTER(2,14,this,14,glD3DDev7);
31783530 this->glD3DDev7 = glD3DDev7;
31793531 glD3DDev7->InitDX5();
31803532 refcount = 1;
 3533+ TRACE_EXIT(-1,0);
31813534 }
31823535
31833536 glDirect3DDevice1::~glDirect3DDevice1()
31843537 {
 3538+ TRACE_ENTER(1,14,this);
31853539 glD3DDev7->glD3DDev1 = NULL;
31863540 glD3DDev7->Release();
 3541+ TRACE_EXIT(-1,0);
31873542 }
31883543
31893544 HRESULT WINAPI glDirect3DDevice1::QueryInterface(REFIID riid, void** ppvObj)
31903545 {
3191 - if(!this) return DDERR_INVALIDOBJECT;
 3546+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 3547+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
31923548 if(riid == IID_IUnknown)
31933549 {
31943550 this->AddRef();
31953551 *ppvObj = this;
 3552+ TRACE_VAR("*ppvObj",14,*ppvObj);
 3553+ TRACE_EXIT(23,DD_OK);
31963554 return DD_OK;
31973555 }
3198 - return glD3DDev7->QueryInterface(riid,ppvObj);
 3556+ TRACE_RET(23,glD3DDev7->QueryInterface(riid,ppvObj));
31993557 }
32003558
32013559 ULONG WINAPI glDirect3DDevice1::AddRef()
32023560 {
3203 - if(!this) return 0;
 3561+ TRACE_ENTER(1,14,this);
 3562+ if(!this) TRACE_RET(8,0);
32043563 refcount++;
 3564+ TRACE_EXIT(8,refcount);
32053565 return refcount;
32063566 }
32073567
32083568 ULONG WINAPI glDirect3DDevice1::Release()
32093569 {
3210 - if(!this) return 0;
 3570+ TRACE_ENTER(1,14,this);
 3571+ if(!this) TRACE_RET(8,0);
32113572 ULONG ret;
32123573 refcount--;
32133574 ret = refcount;
32143575 if(refcount == 0) delete this;
 3576+ TRACE_EXIT(8,ret);
32153577 return ret;
32163578 }
32173579
32183580 HRESULT WINAPI glDirect3DDevice1::AddViewport(LPDIRECT3DVIEWPORT lpDirect3DViewport)
32193581 {
3220 - if(!this) return DDERR_INVALIDOBJECT;
3221 - if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
 3582+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport);
 3583+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3584+ if(!lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
32223585 glDirect3DViewport3 *glD3DV3;
32233586 lpDirect3DViewport->QueryInterface(IID_IDirect3DViewport3,(void**)&glD3DV3);
32243587 HRESULT ret = glD3DDev7->AddViewport(glD3DV3);
32253588 glD3DV3->Release();
 3589+ TRACE_EXIT(23,ret);
32263590 return ret;
32273591 }
32283592 HRESULT WINAPI glDirect3DDevice1::BeginScene()
32293593 {
3230 - if(!this) return DDERR_INVALIDOBJECT;
3231 - return glD3DDev7->BeginScene();
 3594+ TRACE_ENTER(1,14,this);
 3595+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3596+ TRACE_RET(23,glD3DDev7->BeginScene());
32323597 }
32333598 HRESULT WINAPI glDirect3DDevice1::CreateExecuteBuffer(LPD3DEXECUTEBUFFERDESC lpDesc,
32343599 LPDIRECT3DEXECUTEBUFFER* lplpDirect3DExecuteBuffer, IUnknown* pUnkOuter)
32353600 {
3236 - if(!this) return DDERR_INVALIDOBJECT;
3237 - return glD3DDev7->CreateExecuteBuffer(lpDesc,lplpDirect3DExecuteBuffer,pUnkOuter);
 3601+ TRACE_ENTER(4,14,this,14,lpDesc,14,lplpDirect3DExecuteBuffer,14,pUnkOuter);
 3602+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3603+ TRACE_RET(23,glD3DDev7->CreateExecuteBuffer(lpDesc,lplpDirect3DExecuteBuffer,pUnkOuter));
32383604 }
32393605 HRESULT WINAPI glDirect3DDevice1::CreateMatrix(LPD3DMATRIXHANDLE lpD3DMatHandle)
32403606 {
3241 - if(!this) return DDERR_INVALIDOBJECT;
3242 - return glD3DDev7->CreateMatrix(lpD3DMatHandle);
 3607+ TRACE_ENTER(2,14,this,14,lpD3DMatHandle);
 3608+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3609+ TRACE_RET(23,glD3DDev7->CreateMatrix(lpD3DMatHandle));
32433610 }
32443611 HRESULT WINAPI glDirect3DDevice1::DeleteMatrix(D3DMATRIXHANDLE d3dMatHandle)
32453612 {
3246 - if(!this) return DDERR_INVALIDOBJECT;
3247 - return glD3DDev7->DeleteMatrix(d3dMatHandle);
 3613+ TRACE_ENTER(2,14,this,9,d3dMatHandle);
 3614+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3615+ TRACE_RET(23,glD3DDev7->DeleteMatrix(d3dMatHandle));
32483616 }
32493617 HRESULT WINAPI glDirect3DDevice1::DeleteViewport(LPDIRECT3DVIEWPORT lpDirect3DViewport)
32503618 {
3251 - if(!this) return DDERR_INVALIDOBJECT;
 3619+ TRACE_ENTER(2,14,this,14,lpDirect3DViewport);
 3620+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
32523621 glDirect3DViewport3 *glD3DV3;
32533622 lpDirect3DViewport->QueryInterface(IID_IDirect3DViewport3,(void**)&glD3DV3);
32543623 HRESULT ret = glD3DDev7->DeleteViewport(glD3DV3);
32553624 glD3DV3->Release();
 3625+ TRACE_EXIT(23,ret);
32563626 return ret;
32573627 }
32583628 HRESULT WINAPI glDirect3DDevice1::EndScene()
32593629 {
3260 - if(!this) return DDERR_INVALIDOBJECT;
3261 - return glD3DDev7->EndScene();
 3630+ TRACE_ENTER(1,14,this);
 3631+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3632+ TRACE_RET(23,glD3DDev7->EndScene());
32623633 }
32633634 HRESULT WINAPI glDirect3DDevice1::EnumTextureFormats(LPD3DENUMTEXTUREFORMATSCALLBACK lpd3dEnumTextureProc, LPVOID lpArg)
32643635 {
3265 - if(!this) return DDERR_INVALIDOBJECT;
 3636+ TRACE_ENTER(3,14,this,14,lpd3dEnumTextureProc,14,lpArg);
 3637+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
32663638 LPVOID context[2];
32673639 context[0] = (LPVOID)lpd3dEnumTextureProc;
32683640 context[1] = lpArg;
3269 - return glD3DDev7->EnumTextureFormats(EnumTex2,&context);
 3641+ TRACE_RET(23,glD3DDev7->EnumTextureFormats(EnumTex2,&context));
32703642 }
32713643 HRESULT WINAPI glDirect3DDevice1::Execute(LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer, LPDIRECT3DVIEWPORT lpDirect3DViewport, DWORD dwFlags)
32723644 {
3273 - if(!this) return DDERR_INVALIDOBJECT;
3274 - return glD3DDev7->Execute(lpDirect3DExecuteBuffer,lpDirect3DViewport,dwFlags);
 3645+ TRACE_ENTER(4,14,this,14,lpDirect3DExecuteBuffer,14,lpDirect3DViewport,9,dwFlags);
 3646+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3647+ TRACE_RET(23,glD3DDev7->Execute(lpDirect3DExecuteBuffer,lpDirect3DViewport,dwFlags));
32753648 }
32763649 HRESULT WINAPI glDirect3DDevice1::GetCaps(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc)
32773650 {
3278 - if(!this) return DDERR_INVALIDOBJECT;
3279 - return glD3DDev7->GetCaps3(lpD3DHWDevDesc,lpD3DHELDevDesc);
 3651+ TRACE_ENTER(3,14,this,14,lpD3DHWDevDesc,14,lpD3DHELDevDesc);
 3652+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3653+ TRACE_RET(23,glD3DDev7->GetCaps3(lpD3DHWDevDesc,lpD3DHELDevDesc));
32803654 }
32813655 HRESULT WINAPI glDirect3DDevice1::GetDirect3D(LPDIRECT3D* lpD3D)
32823656 {
3283 - if(!this) return DDERR_INVALIDOBJECT;
 3657+ TRACE_ENTER(2,14,this,14,lpD3D);
 3658+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
32843659 LPDIRECT3D7 d3d7;
32853660 HRESULT err = glD3DDev7->GetDirect3D(&d3d7);
3286 - if(!d3d7) return err;
 3661+ if(!d3d7) TRACE_RET(23,err);
32873662 d3d7->QueryInterface(IID_IDirect3D,(void**)lpD3D);
32883663 d3d7->Release();
 3664+ TRACE_VAR("*lpD3D",14,*lpD3D);
 3665+ TRACE_EXIT(23,err);
32893666 return err;
32903667 }
32913668
32923669 HRESULT WINAPI glDirect3DDevice1::GetMatrix(D3DMATRIXHANDLE lpD3DMatHandle, LPD3DMATRIX lpD3DMatrix)
32933670 {
3294 - if(!this) return DDERR_INVALIDPARAMS;
3295 - return glD3DDev7->GetMatrix(lpD3DMatHandle,lpD3DMatrix);
 3671+ TRACE_ENTER(3,14,this,9,lpD3DMatHandle,14,lpD3DMatrix);
 3672+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3673+ TRACE_RET(23,glD3DDev7->GetMatrix(lpD3DMatHandle,lpD3DMatrix));
32963674 }
32973675
32983676 HRESULT WINAPI glDirect3DDevice1::GetPickRecords(LPDWORD lpCount, LPD3DPICKRECORD lpD3DPickRec)
32993677 {
3300 - if(!this) return DDERR_INVALIDPARAMS;
3301 - return glD3DDev7->GetPickRecords(lpCount,lpD3DPickRec);
 3678+ TRACE_ENTER(3,14,this,14,lpCount,14,lpD3DPickRec);
 3679+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3680+ TRACE_RET(23,glD3DDev7->GetPickRecords(lpCount,lpD3DPickRec));
33023681 }
33033682
33043683 HRESULT WINAPI glDirect3DDevice1::GetStats(LPD3DSTATS lpD3DStats)
33053684 {
3306 - if(!this) return DDERR_INVALIDPARAMS;
3307 - return glD3DDev7->GetStats(lpD3DStats);
 3685+ TRACE_ENTER(2,14,this,14,lpD3DStats);
 3686+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3687+ TRACE_RET(23,glD3DDev7->GetStats(lpD3DStats));
33083688 }
33093689
33103690 HRESULT WINAPI glDirect3DDevice1::Initialize(LPDIRECT3D lpd3d, LPGUID lpGUID, LPD3DDEVICEDESC lpd3ddvdesc)
33113691 {
3312 - if(!this) return DDERR_INVALIDPARAMS;
3313 - return DDERR_ALREADYINITIALIZED;
 3692+ TRACE_ENTER(4,14,this,14,lpd3d,24,lpGUID,14,lpd3ddvdesc);
 3693+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3694+ TRACE_RET(23,DDERR_ALREADYINITIALIZED);
33143695 }
33153696 HRESULT WINAPI glDirect3DDevice1::NextViewport(LPDIRECT3DVIEWPORT lpDirect3DViewport, LPDIRECT3DVIEWPORT *lplpDirect3DViewport, DWORD dwFlags)
33163697 {
3317 - if(!this) return DDERR_INVALIDOBJECT;
3318 - if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
3319 - if(!lplpDirect3DViewport) return DDERR_INVALIDPARAMS;
 3698+ TRACE_ENTER(4,14,this,14,lpDirect3DViewport,14,lplpDirect3DViewport,9,dwFlags);
 3699+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3700+ if(!lpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
 3701+ if(!lplpDirect3DViewport) TRACE_RET(23,DDERR_INVALIDPARAMS);
33203702 FIXME("glDirect3DDevice1::NextViewport: stub");
 3703+ TRACE_EXIT(23,DDERR_GENERIC);
33213704 ERR(DDERR_GENERIC);
33223705 }
33233706 HRESULT WINAPI glDirect3DDevice1::Pick(LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer, LPDIRECT3DVIEWPORT lpDirect3DViewport,
33243707 DWORD dwFlags, LPD3DRECT lpRect)
33253708 {
3326 - if(!this) return DDERR_INVALIDOBJECT;
3327 - return glD3DDev7->Pick(lpDirect3DExecuteBuffer, lpDirect3DViewport, dwFlags, lpRect);
 3709+ TRACE_ENTER(5,14,this,14,lpDirect3DExecuteBuffer,14,lpDirect3DViewport,9,dwFlags,26,lpRect);
 3710+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3711+ TRACE_RET(23,glD3DDev7->Pick(lpDirect3DExecuteBuffer, lpDirect3DViewport, dwFlags, lpRect));
33283712 }
33293713
33303714 HRESULT WINAPI glDirect3DDevice1::SetMatrix(D3DMATRIXHANDLE d3dMatHandle, LPD3DMATRIX lpD3DMatrix)
33313715 {
3332 - if(!this) return DDERR_INVALIDOBJECT;
3333 - return glD3DDev7->SetMatrix(d3dMatHandle,lpD3DMatrix);
 3716+ TRACE_ENTER(3,14,this,9,d3dMatHandle,14,lpD3DMatrix);
 3717+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3718+ TRACE_RET(23,glD3DDev7->SetMatrix(d3dMatHandle,lpD3DMatrix));
33343719 }
33353720
33363721 HRESULT WINAPI glDirect3DDevice1::SwapTextureHandles(LPDIRECT3DTEXTURE lpD3DTex1, LPDIRECT3DTEXTURE lpD3DTex2)
33373722 {
3338 - if(!this) return DDERR_INVALIDOBJECT;
3339 - if(!lpD3DTex1) return DDERR_INVALIDPARAMS;
3340 - if(!lpD3DTex2) return DDERR_INVALIDPARAMS;
 3723+ TRACE_ENTER(3,14,this,14,lpD3DTex1,14,lpD3DTex2);
 3724+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 3725+ if(!lpD3DTex1) TRACE_RET(23,DDERR_INVALIDPARAMS);
 3726+ if(!lpD3DTex2) TRACE_RET(23,DDERR_INVALIDPARAMS);
33413727 LPDIRECT3DTEXTURE2 tex1, tex2;
33423728 lpD3DTex1->QueryInterface(IID_IDirect3DTexture2,(void**)&tex1);
33433729 lpD3DTex2->QueryInterface(IID_IDirect3DTexture2,(void**)&tex2);
@@ -3343,5 +3729,6 @@
33443730 HRESULT ret = glD3DDev7->SwapTextureHandles(tex1,tex2);
33453731 tex2->Release();
33463732 tex1->Release();
 3733+ TRACE_EXIT(23,ret);
33473734 return ret;
33483735 }
\ No newline at end of file