DXGL r349 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r348‎ | r349 | r350 >
Date:15:26, 17 March 2013
Author:admin
Status:new
Tags:
Comment:
Trace glDirect3DExecuteBuffer.cpp
Modified paths:
  • /ddraw/glDirect3DExecuteBuffer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DExecuteBuffer.cpp
@@ -20,6 +20,7 @@
2121
2222 glDirect3DExecuteBuffer::glDirect3DExecuteBuffer(LPD3DEXECUTEBUFFERDESC lpDesc)
2323 {
 24+ TRACE_ENTER(2,14,this,14,lpDesc);
2425 locked = false;
2526 inuse = false;
2627 data = NULL;
@@ -31,48 +32,60 @@
3233 }
3334 ZeroMemory(&datadesc,sizeof(D3DEXECUTEDATA));
3435 datadesc.dwSize = sizeof(D3DEXECUTEDATA);
 36+ TRACE_EXIT(-1,0);
3537 }
3638 glDirect3DExecuteBuffer::~glDirect3DExecuteBuffer()
3739 {
 40+ TRACE_ENTER(1,14,this);
3841 if(data) free(data);
 42+ TRACE_EXIT(-1,0);
3943 }
4044
4145 HRESULT WINAPI glDirect3DExecuteBuffer::QueryInterface(REFIID riid, void** ppvObj)
4246 {
43 - if(!this) return DDERR_INVALIDOBJECT;
 47+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 48+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
4449 if((riid == IID_IUnknown) || (riid == IID_IDirect3DExecuteBuffer))
4550 {
4651 this->AddRef();
4752 *ppvObj = this;
 53+ TRACE_EXIT(23,D3D_OK);
4854 return D3D_OK;
4955 }
 56+ TRACE_EXIT(23,E_NOINTERFACE);
5057 return E_NOINTERFACE;
5158 }
5259
5360 ULONG WINAPI glDirect3DExecuteBuffer::AddRef()
5461 {
55 - if(!this) return 0;
 62+ TRACE_ENTER(1,14,this);
 63+ if(!this) TRACE_RET(8,0);
5664 refcount++;
 65+ TRACE_EXIT(8,refcount);
5766 return refcount;
5867 }
5968
6069 ULONG WINAPI glDirect3DExecuteBuffer::Release()
6170 {
62 - if(!this) return 0;
 71+ TRACE_ENTER(1,14,this);
 72+ if(!this) TRACE_RET(8,0);
6373 ULONG ret;
6474 refcount--;
6575 ret = refcount;
6676 if(refcount == 0) delete this;
 77+ TRACE_EXIT(8,ret);
6778 return ret;
6879 }
6980
7081 HRESULT WINAPI glDirect3DExecuteBuffer::GetExecuteData(LPD3DEXECUTEDATA lpData)
7182 {
72 - if(!this) return DDERR_INVALIDOBJECT;
73 - if(!lpData) return DDERR_INVALIDPARAMS;
74 - if(locked) return D3DERR_EXECUTE_LOCKED;
75 - if(lpData->dwSize < sizeof(D3DEXECUTEDATA)) return DDERR_INVALIDPARAMS;
 83+ TRACE_ENTER(2,14,this,14,lpData);
 84+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 85+ if(!lpData) TRACE_RET(23,DDERR_INVALIDPARAMS);
 86+ if(locked) TRACE_RET(23,D3DERR_EXECUTE_LOCKED);
 87+ if(lpData->dwSize < sizeof(D3DEXECUTEDATA)) TRACE_RET(23,DDERR_INVALIDPARAMS);
7688 memcpy(lpData,&datadesc,sizeof(D3DEXECUTEDATA));
 89+ TRACE_EXIT(23,D3D_OK);
7790 return D3D_OK;
7891 }
7992
@@ -79,17 +92,20 @@
8093 HRESULT WINAPI glDirect3DExecuteBuffer::Initialize(LPDIRECT3DDEVICE lpDirect3DDevice,
8194 LPD3DEXECUTEBUFFERDESC lpDesc)
8295 {
83 - if(!this) return DDERR_INVALIDOBJECT;
 96+ TRACE_ENTER(3,14,this,14,lpDirect3DDevice,14,lpDesc);
 97+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 98+ TRACE_EXIT(23,DDERR_ALREADYINITIALIZED);
8499 return DDERR_ALREADYINITIALIZED;
85100 }
86101
87102 HRESULT WINAPI glDirect3DExecuteBuffer::Lock(LPD3DEXECUTEBUFFERDESC lpDesc)
88103 {
89 - if(!this) return DDERR_INVALIDOBJECT;
90 - if(!lpDesc) return DDERR_INVALIDPARAMS;
91 - if(lpDesc->dwSize < sizeof(D3DEXECUTEBUFFERDESC)) return DDERR_INVALIDPARAMS;
92 - if(inuse) return DDERR_WASSTILLDRAWING;
93 - if(locked) return D3DERR_EXECUTE_LOCKED;
 104+ TRACE_ENTER(2,14,this,14,lpDesc);
 105+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 106+ if(!lpDesc) TRACE_RET(23,DDERR_INVALIDPARAMS);
 107+ if(lpDesc->dwSize < sizeof(D3DEXECUTEBUFFERDESC)) TRACE_RET(23,DDERR_INVALIDPARAMS);
 108+ if(inuse) TRACE_RET(23,DDERR_WASSTILLDRAWING);
 109+ if(locked) TRACE_RET(23,D3DERR_EXECUTE_LOCKED);
94110 desc.dwCaps = lpDesc->dwCaps;
95111 desc.dwFlags |= D3DDEB_LPDATA;
96112 if(!data)
@@ -100,51 +116,61 @@
101117 desc.lpData = data;
102118 memcpy(lpDesc,&desc,sizeof(D3DEXECUTEBUFFERDESC));
103119 locked = true;
 120+ TRACE_EXIT(23,D3D_OK);
104121 return D3D_OK;
105122 }
106123
107124 HRESULT WINAPI glDirect3DExecuteBuffer::Optimize(DWORD dwDummy)
108125 {
109 - if(!this) return DDERR_INVALIDOBJECT;
 126+ TRACE_ENTER(2,14,this,9,dwDummy);
 127+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 128+ TRACE_EXIT(23,DDERR_UNSUPPORTED);
110129 return DDERR_UNSUPPORTED;
111130 }
112131
113132 HRESULT WINAPI glDirect3DExecuteBuffer::SetExecuteData(LPD3DEXECUTEDATA lpData)
114133 {
115 - if(!this) return DDERR_INVALIDOBJECT;
116 - if(!lpData) return DDERR_INVALIDPARAMS;
117 - if(lpData->dwSize != sizeof(D3DEXECUTEDATA)) return DDERR_INVALIDPARAMS;
 134+ TRACE_ENTER(2,14,this,14,lpData);
 135+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 136+ if(!lpData) TRACE_RET(23,DDERR_INVALIDPARAMS);
 137+ if(lpData->dwSize != sizeof(D3DEXECUTEDATA)) TRACE_RET(23,DDERR_INVALIDPARAMS);
118138 memcpy(&datadesc,lpData,sizeof(D3DEXECUTEDATA));
 139+ TRACE_EXIT(23,D3D_OK);
119140 return D3D_OK;
120141 }
121142
122143 HRESULT WINAPI glDirect3DExecuteBuffer::Unlock()
123144 {
124 - if(!this) return DDERR_INVALIDOBJECT;
125 - if(inuse) return D3DERR_EXECUTE_NOT_LOCKED;
126 - if(!locked) return D3DERR_EXECUTE_NOT_LOCKED;
 145+ TRACE_ENTER(1,14,this);
 146+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 147+ if(inuse) TRACE_RET(23,D3DERR_EXECUTE_NOT_LOCKED);
 148+ if(!locked) TRACE_RET(23,D3DERR_EXECUTE_NOT_LOCKED);
127149 locked = false;
 150+ TRACE_RET(23,D3D_OK);
128151 return D3D_OK;
129152 }
130153
131154 HRESULT WINAPI glDirect3DExecuteBuffer::Validate(LPDWORD lpdwOffset, LPD3DVALIDATECALLBACK lpFunc, LPVOID lpUserArg, DWORD dwReserved)
132155 {
133 - if(!this) return DDERR_INVALIDOBJECT;
 156+ TRACE_ENTER(5,14,this,14,lpdwOffset,14,lpFunc,14,lpUserArg,9,dwReserved);
 157+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 158+ TRACE_EXIT(23,DDERR_UNSUPPORTED);
134159 return DDERR_UNSUPPORTED;
135160 }
136161
137162 HRESULT glDirect3DExecuteBuffer::ExecuteLock(LPD3DEXECUTEBUFFERDESC lpDesc,LPD3DEXECUTEDATA lpData)
138163 {
139 - if(!this) return DDERR_INVALIDOBJECT;
140 - if(inuse) return DDERR_WASSTILLDRAWING;
141 - if(locked) return D3DERR_EXECUTE_LOCKED;
142 - if(!lpDesc) return DDERR_INVALIDPARAMS;
143 - if(!lpData) return DDERR_INVALIDPARAMS;
 164+ TRACE_ENTER(3,14,this,14,lpDesc,14,lpData);
 165+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 166+ if(inuse) TRACE_RET(23,DDERR_WASSTILLDRAWING);
 167+ if(locked) TRACE_RET(23,D3DERR_EXECUTE_LOCKED);
 168+ if(!lpDesc) TRACE_RET(23,DDERR_INVALIDPARAMS);
 169+ if(!lpData) TRACE_RET(23,DDERR_INVALIDPARAMS);
144170 desc.dwFlags |= D3DDEB_LPDATA;
145171 if(!data)
146172 {
147173 data = (unsigned char *)malloc(desc.dwBufferSize);
148 - if(!data) return DDERR_OUTOFMEMORY;
 174+ if(!data) TRACE_RET(23,DDERR_OUTOFMEMORY);
149175 }
150176 desc.lpData = data;
151177 memcpy(lpDesc,&desc,sizeof(D3DEXECUTEBUFFERDESC));
@@ -151,16 +177,19 @@
152178 memcpy(lpData,&datadesc,sizeof(D3DEXECUTEDATA));
153179 locked = true;
154180 inuse = true;
 181+ TRACE_EXIT(23,D3D_OK);
155182 return D3D_OK;
156183 }
157184
158185 HRESULT glDirect3DExecuteBuffer::ExecuteUnlock(LPD3DEXECUTEDATA lpData)
159186 {
160 - if(!this) return DDERR_INVALIDOBJECT;
161 - if(!lpData) return DDERR_INVALIDPARAMS;
162 - if(!inuse) return D3DERR_EXECUTE_NOT_LOCKED;
 187+ TRACE_ENTER(2,14,this,14,lpData);
 188+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 189+ if(!lpData) TRACE_RET(23,DDERR_INVALIDPARAMS);
 190+ if(!inuse) TRACE_RET(23,D3DERR_EXECUTE_NOT_LOCKED);
163191 inuse = false;
164192 locked = false;
165193 memcpy(&datadesc,lpData,sizeof(D3DEXECUTEDATA));
 194+ TRACE_RET(23,D3D_OK);
166195 return D3D_OK;
167196 }
\ No newline at end of file