diff --git a/reactos/dll/directx/wine/d3d8/d3d8_main.c b/reactos/dll/directx/wine/d3d8/d3d8_main.c index 43221cd2bb8..63cb47204d5 100644 --- a/reactos/dll/directx/wine/d3d8/d3d8_main.c +++ b/reactos/dll/directx/wine/d3d8/d3d8_main.c @@ -75,11 +75,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) * ValidateVertexShader (D3D8.@) * * I've seen reserved1 and reserved2 always passed as 0's - * bool seems always passed as 0 or 1, but other values work as well.... + * bool seems always passed as 0 or 1, but other values work as well.... * toto result? */ HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto) -{ +{ HRESULT ret; FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, bool, toto); @@ -91,7 +91,7 @@ HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD switch(*vertexshader) { case 0xFFFE0101: - case 0xFFFE0100: + case 0xFFFE0100: ret=S_OK; break; default: @@ -112,12 +112,12 @@ HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bo { HRESULT ret; FIXME("(%p %p %d %p): stub\n", pixelshader, reserved1, bool, toto); - + if (!pixelshader) return E_FAIL; if (reserved1) - return E_FAIL; + return E_FAIL; switch(*pixelshader) { case 0xFFFF0100: diff --git a/reactos/dll/directx/wine/d3d8/device.c b/reactos/dll/directx/wine/d3d8/device.c index 4ef39874c60..205120e46c7 100644 --- a/reactos/dll/directx/wine/d3d8/device.c +++ b/reactos/dll/directx/wine/d3d8/device.c @@ -463,7 +463,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface LeaveCriticalSection(&d3d8_cs); if (FAILED(hrc)) { - /* free up object */ + /* free up object */ FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This); HeapFree(GetProcessHeap(), 0, object); /* *ppTexture = NULL; */ @@ -477,8 +477,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface return hrc; } -static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface, - UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, +static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface, + UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture8** ppVolumeTexture) { IDirect3DVolumeTexture8Impl *object; @@ -518,7 +518,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 return hrc; } -static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength, UINT Levels, DWORD Usage, +static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture8** ppCubeTexture) { IDirect3DCubeTexture8Impl *object; @@ -634,7 +634,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface IDirect3DSurface8Impl *object; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; TRACE("(%p) Relay\n", This); - if(MultisampleQuality < 0) { + if(MultisampleQuality < 0) { FIXME("MultisampleQuality out of range %d, substituting 0\n", MultisampleQuality); /*FIXME: Find out what windows does with a MultisampleQuality < 0 */ MultisampleQuality=0; @@ -989,7 +989,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetLight(LPDIRECT3DDEVICE8 iface, DWO IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); - + /* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */ EnterCriticalSection(&d3d8_cs); hr = IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight); @@ -1413,7 +1413,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetCurrentTexturePalette(LPDIRECT3D } static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); @@ -1803,6 +1803,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, I TRACE("(%p) Relay\n", This); EnterCriticalSection(&d3d8_cs); + /* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that + * the UINT doesn't cause an overflow in the INT? It seems rather unlikely because such large + * vertex buffers can't be created to address them with an index that requires the 32nd bit + * (4 Byte minimum vertex size * 2^31-1 -> 8 gb buffer. The index sign would be the least + * problem) + */ IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, baseVertexIndex); hr = IWineD3DDevice_SetIndices(This->WineD3DDevice, pIndexData ? ((IDirect3DIndexBuffer8Impl *)pIndexData)->wineD3DIndexBuffer : NULL); @@ -1822,7 +1828,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, I } EnterCriticalSection(&d3d8_cs); - IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, pBaseVertexIndex); + /* The case from UINT to INT is safe because d3d8 will never set negative values */ + IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex); rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData); if (SUCCEEDED(rc) && retIndexData) { IWineD3DIndexBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData); diff --git a/reactos/dll/directx/wine/d3d8/directx.c b/reactos/dll/directx/wine/d3d8/directx.c index 0a16d2a17b5..54c87e68484 100644 --- a/reactos/dll/directx/wine/d3d8/directx.c +++ b/reactos/dll/directx/wine/d3d8/directx.c @@ -109,8 +109,8 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 i TRACE("(%p)->(%d,%08x, %p\n", This, Adapter, Flags, pIdentifier); EnterCriticalSection(&d3d8_cs); - /* dx8 and dx9 have different structures to be filled in, with incompatible - layouts so pass in pointers to the places to be filled via an internal + /* dx8 and dx9 have different structures to be filled in, with incompatible + layouts so pass in pointers to the places to be filled via an internal structure */ adapter_id.Driver = pIdentifier->Driver; adapter_id.Description = pIdentifier->Description; @@ -203,7 +203,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 if return hr; } -static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface, +static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) { IDirect3D8Impl *This = (IDirect3D8Impl *)iface; @@ -269,8 +269,8 @@ HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, IDirect3DSurface8Impl *d3dSurface = NULL; TRACE("(%p) call back\n", device); - res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height, - (D3DFORMAT)Format, MultiSample, Lockable, + res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height, + (D3DFORMAT)Format, MultiSample, Lockable, (IDirect3DSurface8 **)&d3dSurface); if (SUCCEEDED(res)) { @@ -365,7 +365,7 @@ HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSup IDirect3DSurface8Impl *d3dSurface = NULL; TRACE("(%p) call back\n", device); - res = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)device, Width, Height, + res = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)device, Width, Height, (D3DFORMAT)Format, MultiSample, (IDirect3DSurface8 **)&d3dSurface); if (SUCCEEDED(res)) { *ppSurface = d3dSurface->wineD3DSurface; diff --git a/reactos/dll/directx/wine/d3d8/stateblock.c b/reactos/dll/directx/wine/d3d8/stateblock.c index 4dd0a1ef333..d42fb79f889 100644 --- a/reactos/dll/directx/wine/d3d8/stateblock.c +++ b/reactos/dll/directx/wine/d3d8/stateblock.c @@ -67,19 +67,19 @@ static ULONG WINAPI IDirect3DStateBlock8Impl_Release(IDirect3DStateBlock8 *iface /* IDirect3DStateBlock8 Interface follow: */ static HRESULT WINAPI IDirect3DStateBlock8Impl_GetDevice(IDirect3DStateBlock8 *iface, IDirect3DDevice8 **ppDevice) { IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface; - TRACE("(%p) Relay\n", This); + TRACE("(%p) Relay\n", This); return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice); } static HRESULT WINAPI IDirect3DStateBlock8Impl_Capture(IDirect3DStateBlock8 *iface) { IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface; - TRACE("(%p) Relay\n", This); + TRACE("(%p) Relay\n", This); return IWineD3DStateBlock_Capture(This->wineD3DStateBlock); } static HRESULT WINAPI IDirect3DStateBlock8Impl_Apply(IDirect3DStateBlock8 *iface) { IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface; - TRACE("(%p) Relay\n", This); + TRACE("(%p) Relay\n", This); return IWineD3DStateBlock_Apply(This->wineD3DStateBlock); } diff --git a/reactos/dll/directx/wine/d3d8/vertexdeclaration.c b/reactos/dll/directx/wine/d3d8/vertexdeclaration.c index f2e5d576b0e..3a53c1179d8 100644 --- a/reactos/dll/directx/wine/d3d8/vertexdeclaration.c +++ b/reactos/dll/directx/wine/d3d8/vertexdeclaration.c @@ -284,7 +284,7 @@ size_t convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_el TRACE("d3d8_elements %p, wined3d_elements %p\n", d3d8_elements, wined3d_elements); /* 128 should be enough for anyone... */ - *wined3d_elements = HeapAlloc(GetProcessHeap(), 0, 128 * sizeof(WINED3DVERTEXELEMENT)); + *wined3d_elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 128 * sizeof(WINED3DVERTEXELEMENT)); while (D3DVSD_END() != *token) { token_type = ((*token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT); diff --git a/reactos/dll/directx/wine/d3d8/volume.c b/reactos/dll/directx/wine/d3d8/volume.c index 87fa9211740..bea2ea9f8bc 100644 --- a/reactos/dll/directx/wine/d3d8/volume.c +++ b/reactos/dll/directx/wine/d3d8/volume.c @@ -229,10 +229,10 @@ HRESULT WINAPI D3D8CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT object->lpVtbl = &Direct3DVolume8_Vtbl; object->ref = 1; - hrc = IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage, Format, + hrc = IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage, Format, Pool, &object->wineD3DVolume, pSharedHandle, (IUnknown *)object); if (hrc != D3D_OK) { - /* free up object */ + /* free up object */ FIXME("(%p) call to IWineD3DDevice_CreateVolume failed\n", This); HeapFree(GetProcessHeap(), 0, object); *ppVolume = NULL;