diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 4983f13101d..b6ef7cf90cb 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -3,7 +3,7 @@ * * Copyright 2002-2003 Jason Edmeades * Copyright 2002-2003 Raphael Junqueira - * Copyright 2005 Oliver Stieber + * Copyright 2005 Oliver Stieber * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -368,7 +368,6 @@ typedef struct IDirect3DBaseTexture9Impl /* IDirect3DResource9 fields */ IWineD3DBaseTexture *wineD3DBaseTexture; - } IDirect3DBaseTexture9Impl; /* --------------------- */ diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 61bfc586260..5a87a8f1ef3 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -622,8 +622,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9EX return hr; } -static void WINAPI IDirect3DDevice9Impl_SetGammaRamp(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { - +static void WINAPI IDirect3DDevice9Impl_SetGammaRamp(IDirect3DDevice9Ex *iface, UINT iSwapChain, + DWORD Flags, const D3DGAMMARAMP *pRamp) +{ IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; TRACE("(%p) Relay\n", This); @@ -652,15 +653,11 @@ static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UIN IDirect3DSurface9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; TRACE("(%p) Relay\n", This); - - if(MultisampleQuality > 0){ + + if (MultisampleQuality > 0) + { FIXME("MultisampleQuality set to %d, bstituting 0\n", MultisampleQuality); - /* - MultisampleQuality - [in] Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by IDirect3D9::CheckDeviceMultiSampleType. Passing a larger value returns the error D3DERR_INVALIDCALL. The MultisampleQuality values of paired render targets, depth stencil surfaces, and the MultiSample type must all match. - */ - - MultisampleQuality=0; + MultisampleQuality = 0; } /*FIXME: Check MAX bounds of MultisampleQuality*/ @@ -696,12 +693,10 @@ static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UIN return hrc; } - - -static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, - D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, - DWORD MultisampleQuality, BOOL Lockable, - IDirect3DSurface9 **ppSurface, HANDLE* pSharedHandle) { +static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(IDirect3DDevice9Ex *iface, UINT Width, UINT Height, + D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, + IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle) +{ HRESULT hr; TRACE("Relay\n"); @@ -832,13 +827,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIREC if(Pool == D3DPOOL_MANAGED ){ FIXME("Attempting to create a managed offscreen plain surface\n"); return D3DERR_INVALIDCALL; - } + } /* 'Off-screen plain surfaces are always lockable, regardless of their pool types.' but then... D3DPOOL_DEFAULT is the appropriate pool for use with the IDirect3DDevice9::StretchRect and IDirect3DDevice9::ColorFill. Why, their always lockable? - should I change the usage to dynamic? + should I change the usage to dynamic? */ hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE /* Discard */, 0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */, (WINED3DPOOL)Pool, D3DMULTISAMPLE_NONE, @@ -1287,8 +1282,10 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVI return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9EX iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(IDirect3DDevice9Ex *iface, DWORD Sampler, + D3DSAMPLERSTATETYPE Type, DWORD *pValue) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); @@ -1323,8 +1320,10 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ValidateDevice(LPDIRECT3DDEVICE9EX return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(LPDIRECT3DDEVICE9EX iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(IDirect3DDevice9Ex *iface, UINT PaletteNumber, + const PALETTEENTRY *pEntries) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); @@ -1443,8 +1442,10 @@ static float WINAPI IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9EX i return ret; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9EX iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE PrimitiveType, + UINT StartVertex, UINT PrimitiveCount) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); @@ -1474,8 +1475,10 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVI return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9EX iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE PrimitiveType, + UINT PrimitiveCount, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); @@ -1643,8 +1646,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX i wined3d_mutex_lock(); hr = IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber, - pStreamData==NULL ? NULL:((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer, - OffsetInBytes, Stride); + pStreamData ? ((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer : NULL, + OffsetInBytes, Stride); wined3d_mutex_unlock(); return hr; @@ -1677,8 +1680,10 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX i return rc; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, UINT Divider) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9Ex *iface, UINT StreamNumber, + UINT Divider) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); diff --git a/dlls/d3d9/indexbuffer.c b/dlls/d3d9/indexbuffer.c index 83821353449..49f6fc8013a 100644 --- a/dlls/d3d9/indexbuffer.c +++ b/dlls/d3d9/indexbuffer.c @@ -232,14 +232,13 @@ static const IDirect3DIndexBuffer9Vtbl Direct3DIndexBuffer9_Vtbl = /* IDirect3DDevice9 IDirect3DIndexBuffer9 Methods follow: */ -HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface, - UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, - IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) { - +HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(IDirect3DDevice9Ex *iface, UINT Length, DWORD Usage, + D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9 **ppIndexBuffer, HANDLE *pSharedHandle) +{ IDirect3DIndexBuffer9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hrc = D3D_OK; - + TRACE("(%p) Relay\n", This); /* Allocate the storage for the device */ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); diff --git a/dlls/d3d9/pixelshader.c b/dlls/d3d9/pixelshader.c index 0cec5899a15..37950454521 100644 --- a/dlls/d3d9/pixelshader.c +++ b/dlls/d3d9/pixelshader.c @@ -202,7 +202,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; - TRACE("(%p) Relay\n", This); + TRACE("(%p) Relay\n", This); wined3d_mutex_lock(); hr = IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c index e91eec3da78..29ff5b34d19 100644 --- a/dlls/d3d9/stateblock.c +++ b/dlls/d3d9/stateblock.c @@ -89,7 +89,7 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(LPDIRECT3DSTATEBLOCK9 i static HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(LPDIRECT3DSTATEBLOCK9 iface) { IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; HRESULT hr; - TRACE("(%p) Relay\n", This); + TRACE("(%p) Relay\n", This); wined3d_mutex_lock(); hr = IWineD3DStateBlock_Capture(This->wineD3DStateBlock); @@ -129,7 +129,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9EX iface, IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DStateBlock9Impl* object; HRESULT hrc = D3D_OK; - + TRACE("(%p) Relay\n", This); if(Type != D3DSBT_ALL && Type != D3DSBT_PIXELSTATE && @@ -137,12 +137,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9EX iface, WARN("Unexpected stateblock type, returning D3DERR_INVALIDCALL\n"); return D3DERR_INVALIDCALL; } - + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock9Impl)); if (NULL == object) return E_OUTOFMEMORY; object->lpVtbl = &Direct3DStateBlock9_Vtbl; object->ref = 1; - + wined3d_mutex_lock(); hrc = IWineD3DDevice_CreateStateBlock(This->WineD3DDevice, (WINED3DSTATEBLOCKTYPE)Type, &object->wineD3DStateBlock, (IUnknown*)object); wined3d_mutex_unlock(); @@ -160,8 +160,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9EX iface, return hrc; } -HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n", This); @@ -172,14 +173,15 @@ HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9EX iface) return hr; } -HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, IDirect3DStateBlock9** ppSB) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *iface, IDirect3DStateBlock9 **ppSB) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IWineD3DStateBlock *wineD3DStateBlock; + IDirect3DStateBlock9Impl *object; HRESULT hr; - IWineD3DStateBlock* wineD3DStateBlock; - IDirect3DStateBlock9Impl* object; - TRACE("(%p) Relay\n", This); - + TRACE("(%p) Relay\n", This); + /* Tell wineD3D to endstateblock before anything else (in case we run out * of memory later and cause locking problems) */ wined3d_mutex_lock(); @@ -190,9 +192,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, I { WARN("IWineD3DDevice_EndStateBlock returned an error\n"); return hr; - } + } /* allocate a new IDirectD3DStateBlock */ - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY ,sizeof(IDirect3DStateBlock9Impl)); + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock9Impl)); if (!object) return E_OUTOFMEMORY; object->ref = 1; object->lpVtbl = &Direct3DStateBlock9_Vtbl; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 8b578fda56d..d54ff2423e4 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -82,13 +82,13 @@ static int get_refcount(IUnknown *object) static void check_mipmap_levels(IDirect3DDevice9 *device, UINT width, UINT height, UINT count) { IDirect3DBaseTexture9* texture = NULL; - HRESULT hr = IDirect3DDevice9_CreateTexture( device, width, height, 0, 0, - D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, (IDirect3DTexture9**) &texture, NULL ); - + HRESULT hr = IDirect3DDevice9_CreateTexture( device, width, height, 0, 0, + D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, (IDirect3DTexture9**) &texture, NULL ); + if (SUCCEEDED(hr)) { DWORD levels = IDirect3DBaseTexture9_GetLevelCount(texture); ok(levels == count, "Invalid level count. Expected %d got %u\n", count, levels); - } else + } else trace("CreateTexture failed: %08x\n", hr); if (texture) IUnknown_Release( texture ); @@ -104,7 +104,7 @@ static void test_mipmap_levels(void) IDirect3DDevice9 *pDevice = NULL; D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm; - + pD3d = pDirect3DCreate9( D3D_SDK_VERSION ); ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); hwnd = CreateWindow( "static", "d3d9_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL ); diff --git a/dlls/d3d9/tests/shader.c b/dlls/d3d9/tests/shader.c index e1ad9bb9666..37959430436 100644 --- a/dlls/d3d9/tests/shader.c +++ b/dlls/d3d9/tests/shader.c @@ -44,7 +44,7 @@ static IDirect3DDevice9 *init_d3d9(void) d3d9_create = (void *)GetProcAddress(d3d9_handle, "Direct3DCreate9"); ok(d3d9_create != NULL, "Failed to get address of Direct3DCreate9\n"); if (!d3d9_create) return NULL; - + d3d9_ptr = d3d9_create(D3D_SDK_VERSION); if (!d3d9_ptr) { @@ -107,7 +107,7 @@ static void test_get_set_vertex_shader(IDirect3DDevice9 *device_ptr) i = shader_refcount+1; hret = IDirect3DDevice9_GetVertexShader(device_ptr, ¤t_shader_ptr); shader_refcount = get_refcount((IUnknown *)shader_ptr); - ok(hret == D3D_OK && shader_refcount == i && current_shader_ptr == shader_ptr, + ok(hret == D3D_OK && shader_refcount == i && current_shader_ptr == shader_ptr, "GetVertexShader returned: hret 0x%x, current_shader_ptr %p refcount %d. " "Expected hret 0x%x, current_shader_ptr %p, refcount %d.\n", hret, current_shader_ptr, shader_refcount, D3D_OK, shader_ptr, i); IDirect3DVertexShader9_Release(current_shader_ptr); @@ -174,7 +174,7 @@ static void test_get_set_pixel_shader(IDirect3DDevice9 *device_ptr) i = shader_refcount+1; hret = IDirect3DDevice9_GetPixelShader(device_ptr, ¤t_shader_ptr); shader_refcount = get_refcount((IUnknown *)shader_ptr); - ok(hret == D3D_OK && shader_refcount == i && current_shader_ptr == shader_ptr, + ok(hret == D3D_OK && shader_refcount == i && current_shader_ptr == shader_ptr, "GetPixelShader returned: hret 0x%x, current_shader_ptr %p refcount %d. " "Expected hret 0x%x, current_shader_ptr %p, refcount %d.\n", hret, current_shader_ptr, shader_refcount, D3D_OK, shader_ptr, i); IDirect3DPixelShader9_Release(current_shader_ptr); diff --git a/dlls/d3d9/tests/stateblock.c b/dlls/d3d9/tests/stateblock.c index d85c2925c3a..19bb94851b4 100644 --- a/dlls/d3d9/tests/stateblock.c +++ b/dlls/d3d9/tests/stateblock.c @@ -48,7 +48,7 @@ static HRESULT init_d3d9( d3d9_create = (void *)GetProcAddress(d3d9_handle, "Direct3DCreate9"); ok(d3d9_create != NULL, "Failed to get address of Direct3DCreate9\n"); if (!d3d9_create) return E_FAIL; - + d3d9_ptr = d3d9_create(D3D_SDK_VERSION); if (!d3d9_ptr) { @@ -88,7 +88,7 @@ static void test_begin_end_state_block(IDirect3DDevice9 *device_ptr) /* Should succeed */ state_block_ptr = (IDirect3DStateBlock9 *)0xdeadbeef; hret = IDirect3DDevice9_EndStateBlock(device_ptr, &state_block_ptr); - ok(hret == D3D_OK && state_block_ptr != 0 && state_block_ptr != (IDirect3DStateBlock9 *)0xdeadbeef, + ok(hret == D3D_OK && state_block_ptr != 0 && state_block_ptr != (IDirect3DStateBlock9 *)0xdeadbeef, "EndStateBlock returned: hret 0x%x, state_block_ptr %p. " "Expected hret 0x%x, state_block_ptr != %p, state_block_ptr != 0xdeadbeef.\n", hret, state_block_ptr, D3D_OK, NULL); IDirect3DStateBlock9_Release(state_block_ptr); @@ -96,7 +96,7 @@ static void test_begin_end_state_block(IDirect3DDevice9 *device_ptr) /* Calling EndStateBlock while not recording should return D3DERR_INVALIDCALL. state_block_ptr should not be touched. */ state_block_ptr = (IDirect3DStateBlock9 *)0xdeadbeef; hret = IDirect3DDevice9_EndStateBlock(device_ptr, &state_block_ptr); - ok(hret == D3DERR_INVALIDCALL && state_block_ptr == (IDirect3DStateBlock9 *)0xdeadbeef, + ok(hret == D3DERR_INVALIDCALL && state_block_ptr == (IDirect3DStateBlock9 *)0xdeadbeef, "EndStateBlock returned: hret 0x%x, state_block_ptr %p. " "Expected hret 0x%x, state_block_ptr 0xdeadbeef.\n", hret, state_block_ptr, D3DERR_INVALIDCALL); } @@ -124,7 +124,7 @@ typedef struct state_test { /* The poison data is the data to preinitialize the return buffer to */ const void* poison_data; - + /* Return buffer */ void* return_data; @@ -150,7 +150,7 @@ typedef struct state_test { /* See below for explanation of the flags */ #define EVENT_OK 0x00 -#define EVENT_CHECK_DEFAULT 0x01 +#define EVENT_CHECK_DEFAULT 0x01 #define EVENT_CHECK_INITIAL 0x02 #define EVENT_CHECK_TEST 0x04 #define EVENT_ERROR 0x08 @@ -216,8 +216,8 @@ static void execute_test_chain( } } - else if (outcome & EVENT_CHECK_DEFAULT) { - + else if (outcome & EVENT_CHECK_DEFAULT) + { BOOL test_failed = memcmp(test[i].default_data, test[i].return_data, test[i].data_size); ok (!test_failed, "Test %s, Stage %u: returned data does not match default data [csize=%u]\n", test[i].test_name, j, test[i].data_size); @@ -230,8 +230,8 @@ static void execute_test_chain( } } - else if (outcome & EVENT_CHECK_INITIAL) { - + else if (outcome & EVENT_CHECK_INITIAL) + { BOOL test_failed = memcmp(test[i].initial_data, test[i].return_data, test[i].data_size); ok (!test_failed, "Test %s, Stage %u: returned data does not match initial data [csize=%u]\n", test[i].test_name, j, test[i].data_size); @@ -263,10 +263,8 @@ typedef struct event_data { IDirect3DSwapChain9* new_swap_chain; } event_data; -static int switch_render_target( - IDirect3DDevice9* device, - void* data) { - +static int switch_render_target(IDirect3DDevice9 *device, void *data) +{ HRESULT hret; D3DPRESENT_PARAMETERS present_parameters; event_data* edata = data; @@ -289,7 +287,7 @@ static int switch_render_target( if (hret != D3D_OK) goto error; /* Save the current render target */ - hret = IDirect3DDevice9_GetRenderTarget(device, 0, &edata->original_render_target); + hret = IDirect3DDevice9_GetRenderTarget(device, 0, &edata->original_render_target); ok (hret == D3D_OK, "GetRenderTarget returned %#x.\n", hret); if (hret != D3D_OK) goto error; @@ -308,10 +306,8 @@ static int switch_render_target( return EVENT_ERROR; } -static int revert_render_target( - IDirect3DDevice9* device, - void* data) { - +static int revert_render_target(IDirect3DDevice9 *device, void *data) +{ HRESULT hret; event_data* edata = data; @@ -437,7 +433,7 @@ static void execute_test_chain_all( event rendertarget_switch_events[] = { { NULL, EVENT_APPLY_DATA }, { switch_render_target, EVENT_CHECK_TEST }, - { revert_render_target, EVENT_OK } + { revert_render_target, EVENT_OK } }; event rendertarget_stateblock_events[] = { @@ -470,7 +466,7 @@ static void execute_test_chain_all( trace("Running stateblock capture/reapply state tests\n"); execute_test_chain(device, test, ntests, capture_reapply_stateblock_events, 4, &arg); - + trace("Running rendertarget switch state tests\n"); execute_test_chain(device, test, ntests, rendertarget_switch_events, 3, &arg); @@ -592,7 +588,7 @@ static HRESULT shader_constant_setup_handler( shader_constant_context *ctx = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(shader_constant_context)); if (ctx == NULL) return E_FAIL; test->test_context = ctx; - + test->return_data = &ctx->return_data_buffer; test->test_data_in = &shader_constant_test_data; test->test_data_out = &shader_constant_test_data; @@ -601,13 +597,12 @@ static HRESULT shader_constant_setup_handler( test->poison_data = &shader_constant_poison_data; test->data_size = sizeof(shader_constant_data); - + return D3D_OK; } -static void shader_constant_teardown_handler( - state_test* test) { - +static void shader_constant_teardown_handler(state_test *test) +{ HeapFree(GetProcessHeap(), 0, test->test_context); } @@ -704,7 +699,7 @@ static void light_get_handler( ldata->get_light_result = hret; } -static const light_data light_poison_data = +static const light_data light_poison_data = { { 0x1337c0de, { 7.0, 4.0, 2.0, 1.0 }, { 7.0, 4.0, 2.0, 1.0 }, { 7.0, 4.0, 2.0, 1.0 }, { 3.3f, 4.4f, 5.5f },{ 6.6f, 7.7f, 8.8f }, @@ -733,19 +728,18 @@ static const light_data light_test_data_in = 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0 }, 1, D3D_OK, D3D_OK}; /* SetLight will use 128 as the "enabled" value */ -static const light_data light_test_data_out = +static const light_data light_test_data_out = { { 1, { 2.0, 2.0, 2.0, 2.0 }, { 3.0, 3.0, 3.0, 3.0 }, { 4.0, 4.0, 4.0, 4.0 }, { 5.0, 5.0, 5.0 }, { 6.0, 6.0, 6.0 }, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0 }, 128, D3D_OK, D3D_OK}; -static HRESULT light_setup_handler( - state_test* test) { - +static HRESULT light_setup_handler(state_test *test) +{ light_context *ctx = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(light_context)); if (ctx == NULL) return E_FAIL; test->test_context = ctx; - + test->return_data = &ctx->return_data_buffer; test->test_data_in = &light_test_data_in; test->test_data_out = &light_test_data_out; @@ -754,13 +748,12 @@ static HRESULT light_setup_handler( test->poison_data = &light_poison_data; test->data_size = sizeof(light_data); - + return D3D_OK; } -static void light_teardown_handler( - state_test* test) { - +static void light_teardown_handler(state_test *test) +{ HeapFree(GetProcessHeap(), 0, test->test_context); } @@ -937,9 +930,8 @@ static HRESULT transform_setup_handler( return D3D_OK; } -static void transform_teardown_handler( - state_test* test) { - +static void transform_teardown_handler(state_test *test) +{ HeapFree(GetProcessHeap(), 0, test->test_context); } @@ -1192,7 +1184,7 @@ static void render_state_default_data_init(const struct render_state_arg *rsarg, data->states[idx++] = to_dword(0.0f); /* POINTSCALE_C */ data->states[idx++] = TRUE; /* MULTISAMPLEANTIALIAS */ data->states[idx++] = 0xFFFFFFFF; /* MULTISAMPLEMASK */ - data->states[idx++] = D3DPATCHEDGE_DISCRETE; /* PATCHEDGESTYLE */ + data->states[idx++] = D3DPATCHEDGE_DISCRETE; /* PATCHEDGESTYLE */ data->states[idx++] = 0xbaadcafe; /* DEBUGMONITORTOKEN */ data->states[idx++] = to_dword(rsarg->pointsize_max); /* POINTSIZE_MAX */ data->states[idx++] = FALSE; /* INDEXEDVERTEXBLENDENABLE */ @@ -1243,7 +1235,7 @@ static void render_state_poison_data_init( for (i = 0; i < D3D9_RENDER_STATES; i++) data->states[i] = 0x1337c0de; } - + static void render_state_test_data_init( render_state_data* data) { @@ -1408,7 +1400,7 @@ static void test_state_management( HRESULT hret; D3DCAPS9 caps; - /* Test count: 2 for shader constants + /* Test count: 2 for shader constants 1 for lights 1 for transforms 1 for render states diff --git a/dlls/d3d9/tests/vertexdeclaration.c b/dlls/d3d9/tests/vertexdeclaration.c index bf10459cc66..82538ab7e1b 100644 --- a/dlls/d3d9/tests/vertexdeclaration.c +++ b/dlls/d3d9/tests/vertexdeclaration.c @@ -49,7 +49,7 @@ static IDirect3DDevice9 *init_d3d9(void) d3d9_create = (void *)GetProcAddress(d3d9_handle, "Direct3DCreate9"); ok(d3d9_create != NULL, "Failed to get address of Direct3DCreate9\n"); if (!d3d9_create) return NULL; - + d3d9_ptr = d3d9_create(D3D_SDK_VERSION); if (!d3d9_ptr) { @@ -168,19 +168,19 @@ static void test_get_set_vertex_declaration(IDirect3DDevice9 *device_ptr, IDirec HRESULT hret = 0; int decl_refcount = 0; int i = 0; - + /* SetVertexDeclaration should not touch the declaration's refcount. */ i = get_refcount((IUnknown *)decl_ptr); hret = IDirect3DDevice9_SetVertexDeclaration(device_ptr, decl_ptr); decl_refcount = get_refcount((IUnknown *)decl_ptr); ok(hret == D3D_OK && decl_refcount == i, "SetVertexDeclaration returned: hret 0x%x, refcount %d. " "Expected hret 0x%x, refcount %d.\n", hret, decl_refcount, D3D_OK, i); - + /* GetVertexDeclaration should increase the declaration's refcount by one. */ i = decl_refcount+1; hret = IDirect3DDevice9_GetVertexDeclaration(device_ptr, ¤t_decl_ptr); decl_refcount = get_refcount((IUnknown *)decl_ptr); - ok(hret == D3D_OK && decl_refcount == i && current_decl_ptr == decl_ptr, + ok(hret == D3D_OK && decl_refcount == i && current_decl_ptr == decl_ptr, "GetVertexDeclaration returned: hret 0x%x, current_decl_ptr %p refcount %d. " "Expected hret 0x%x, current_decl_ptr %p, refcount %d.\n", hret, current_decl_ptr, decl_refcount, D3D_OK, decl_ptr, i); IDirect3DVertexDeclaration9_Release(current_decl_ptr); @@ -231,13 +231,8 @@ static void test_get_declaration(IDirect3DVertexDeclaration9 *decl_ptr, D3DVERTE /* FIXME: also write a test, which shows that attempting to set * an invalid vertex declaration returns E_FAIL */ - -static HRESULT test_fvf_to_decl( - IDirect3DDevice9* device, - IDirect3DVertexDeclaration9* default_decl, - DWORD test_fvf, - const D3DVERTEXELEMENT9 expected_elements[], - char object_should_change) +static HRESULT test_fvf_to_decl(IDirect3DDevice9 *device, IDirect3DVertexDeclaration9 *default_decl, + DWORD test_fvf, const D3DVERTEXELEMENT9 expected_elements[], char object_should_change) { HRESULT hr; @@ -267,13 +262,13 @@ static HRESULT test_fvf_to_decl( /* Declaration content/size test */ ok(result_decl != NULL, "result declaration was null\n"); - if (result_decl == NULL) + if (result_decl == NULL) goto fail; else if (compare_elements(result_decl, expected_elements) != S_OK) goto fail; if (result_decl) IUnknown_Release( result_decl ); - return S_OK; + return S_OK; fail: if (result_decl) IUnknown_Release( result_decl ); @@ -358,7 +353,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice) VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { - CONST D3DVERTEXELEMENT9 test_buffer[] = + CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_UBYTE4, 0, D3DDECLUSAGE_BLENDINDICES, 0}, D3DDECL_END() }; VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } @@ -445,7 +440,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice) VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } - /* Test conversions from FVF to a vertex declaration + /* Test conversions from FVF to a vertex declaration * These seem to always occur internally. A new declaration object is created if necessary */ { diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 2749975bb66..7db70373833 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -357,7 +357,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, U IDirect3DTexture9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hrc = D3D_OK; - + TRACE("(%p) : W(%d) H(%d), Lvl(%d) d(%d), Fmt(%#x), Pool(%d)\n", This, Width, Height, Levels, Usage, Format, Pool); /* Allocate the storage for the device */ diff --git a/dlls/d3d9/vertexbuffer.c b/dlls/d3d9/vertexbuffer.c index 26264b84c04..226e1139b81 100644 --- a/dlls/d3d9/vertexbuffer.c +++ b/dlls/d3d9/vertexbuffer.c @@ -235,10 +235,9 @@ static const IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl = /* IDirect3DDevice9 IDirect3DVertexBuffer9 Methods follow: */ -HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9EX iface, - UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool, - IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) { - +HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(IDirect3DDevice9Ex *iface, UINT Size, DWORD Usage, + DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) +{ IDirect3DVertexBuffer9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hrc = D3D_OK; diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index 58f61b73579..4ae475194de 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c @@ -87,8 +87,7 @@ HRESULT vdecl_convert_fvf( /* convert the declaration */ elements = HeapAlloc(GetProcessHeap(), 0, size * sizeof(D3DVERTEXELEMENT9)); - if (!elements) - return D3DERR_OUTOFVIDEOMEMORY; + if (!elements) return D3DERR_OUTOFVIDEOMEMORY; elements[size-1] = end_element; idx = 0; @@ -351,8 +350,9 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elem } /* IDirect3DDevice9 IDirect3DVertexDeclaration9 Methods follow: */ -HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9EX iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) { - +HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(IDirect3DDevice9Ex *iface, + const D3DVERTEXELEMENT9 *pVertexElements, IDirect3DVertexDeclaration9 **ppDecl) +{ IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DVertexDeclaration9Impl *object = NULL; WINED3DVERTEXELEMENT* wined3d_elements; diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c index aefab626b81..31b90bce62e 100644 --- a/dlls/d3d9/volumetexture.c +++ b/dlls/d3d9/volumetexture.c @@ -405,11 +405,10 @@ static const IDirect3DVolumeTexture9Vtbl Direct3DVolumeTexture9_Vtbl = /* IDirect3DDevice9 IDirect3DVolumeTexture9 Methods follow: */ -HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX iface, - UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, - D3DFORMAT Format, D3DPOOL Pool, - IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) { - +HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(IDirect3DDevice9Ex *iface, + UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, + D3DPOOL Pool, IDirect3DVolumeTexture9 **ppVolumeTexture, HANDLE *pSharedHandle) +{ IDirect3DVolumeTexture9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hrc = D3D_OK;