Re: [WINED3D] Use shorter lines in drawprim.c (whitespace)
Hi,
+void primitiveDeclarationConvertToStridedData( + IWineD3DDevice *iface, + BOOL useVertexShaderFunction, + Direct3DVertexStridedData *strided, + LONG BaseVertexIndex, + DWORD *fvf, + BOOL storeOrder, + INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE]) { I personally dislike that. In my opinion it's better this way:
void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVertexShaderFunction, ... ) { code; } Well, primitiveDeclarationConvertToStridedData is a bit of a bad example, because the function name isn't that short and INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE] is long too. However, it makes much more sense for the usual COM functions IMO: /*************************************************************** * IWineD3DDevice::SetTexture * * Some comments don't hurt. That's the usual style I have * found in other places, I think we should consistently * write what each function does for WineD3D, as is is a Wine- * specific dll and doesn't have MSDN documentation * * Params: * stage: What's this? * Texture: What's this? * * Returns: * What should the return value be? * ***************************************************************/ HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD stage, IWineD3DBaseTexture *Texture) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DBaseTextureImpl *TexImpl = (IWineD3DBaseTextureImpl *) Texture; HRESULT hr; foo(); bar(); /* Do a function call: */ hr = IWineD3DDevice_FunkyCall(iface, Param1, Param2); if(hr != D3D_OK) { /* What went wrong? */ return WINED3DERR_VERYBADERROR; } return WINED3D_OK; } Just my 2 cent. I know this is all a matter of taste. I plan making up the WineD3D code this way when AJ is back and patches go in again. Stefan
On 24/04/06, Stefan Dösinger <stefandoesinger(a)gmx.at> wrote:
/* Do a function call: */
That's a bit excessive, don't you think? :-) The main problem I have with the wined3d code style isn't so much the formatting or the comments, but rather the fact that functions are too long / do too much. At some points the code is nested several levels deep with if/else blocks spanning multiple pages, even though I run on 1600x1200 with relatively small fonts.
Am Montag, den 24.04.2006, 23:31 +0200 schrieb Stefan Dösinger:
I personally dislike that. In my opinion it's better this way:
HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD stage, IWineD3DBaseTexture *Texture)
When you want to use ctags or etags and you put all in one line, you will get Tooltips for the Function in many Tools (Editor/IDE). If tags are not supported in your preferred Tool, then fill a BUG-Report / Enhancement-Request for them or think about changing your Tool. I tested tags with "Nedit" (http://www.nedit.org) and "SciTE" (http://scintilla.sourceforge.net/SciTE.html) SciTE has a lot of API-Files, including C, WinAPI and OpenGL. This might be another Reason to simplify Functions. BTW: With my latest Patches for "kernel/heap.c", I changed the Style for touched Functions to "all in one line". -- By By ... ... Detlef
participants (3)
-
Detlef Riekenberg -
H. Verbeet -
Stefan Dösinger