From 2465b4cf01a19af9dfda4b417a8608f6bcc834b9 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 31 Aug 2010 18:41:41 +0200 Subject: [PATCH] d3d9: Move device functions to device.c. --- dlls/d3d9/d3d9_private.h | 45 ----- dlls/d3d9/device.c | 364 ++++++++++++++++++++++++++++++++++ dlls/d3d9/pixelshader.c | 135 ------------- dlls/d3d9/swapchain.c | 40 ---- dlls/d3d9/vertexdeclaration.c | 43 ---- dlls/d3d9/vertexshader.c | 144 -------------- 6 files changed, 364 insertions(+), 407 deletions(-) diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index a17ab3738a1..f1bc1a0e23d 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -183,51 +183,6 @@ typedef struct IDirect3DDevice9Impl HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN; -/* IDirect3DDevice9: */ -extern HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface, - UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain) DECLSPEC_HIDDEN; -extern UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(IDirect3DDevice9Ex *iface) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(IDirect3DDevice9Ex *iface, - IDirect3DVertexDeclaration9 *pDecl) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface, - IDirect3DVertexDeclaration9 **ppDecl) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(IDirect3DDevice9Ex *iface, - IDirect3DVertexShader9 *pShader) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(IDirect3DDevice9Ex *iface, - IDirect3DVertexShader9 **ppShader) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDevice9Ex *iface, - UINT StartRegister, const float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(IDirect3DDevice9Ex *iface, - UINT StartRegister, float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(IDirect3DDevice9Ex *iface, - UINT StartRegister, const int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(IDirect3DDevice9Ex *iface, - UINT StartRegister, int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(IDirect3DDevice9Ex *iface, - UINT StartRegister, const BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(IDirect3DDevice9Ex *iface, - UINT StartRegister, BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(IDirect3DDevice9Ex *iface, - IDirect3DPixelShader9 *pShader) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, - IDirect3DPixelShader9 **ppShader) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevice9Ex *iface, - UINT StartRegister, const float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(IDirect3DDevice9Ex *iface, - UINT StartRegister, float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(IDirect3DDevice9Ex *iface, - UINT StartRegister, const int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(IDirect3DDevice9Ex *iface, - UINT StartRegister, int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(IDirect3DDevice9Ex *iface, - UINT StartRegister, const BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(IDirect3DDevice9Ex *iface, - UINT StartRegister, BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; - -/* ---------------- */ -/* IDirect3DVolume9 */ -/* ---------------- */ - /***************************************************************************** * IDirect3DVolume9 implementation structure */ diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 016243914e0..7c10c434cb0 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -486,6 +486,45 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwa return D3D_OK; } +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface, + UINT swapchain_idx, IDirect3DSwapChain9 **swapchain) +{ + IWineD3DSwapChain *wined3d_swapchain = NULL; + HRESULT hr; + + TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", iface, swapchain_idx, swapchain); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetSwapChain(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, + swapchain_idx, &wined3d_swapchain); + if (SUCCEEDED(hr) && swapchain) + { + *swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain); + IDirect3DSwapChain9_AddRef(*swapchain); + IWineD3DSwapChain_Release(wined3d_swapchain); + } + else + { + *swapchain = NULL; + } + wined3d_mutex_unlock(); + + return hr; +} + +static UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(IDirect3DDevice9Ex *iface) +{ + UINT count; + + TRACE("iface %p.\n", iface); + + wined3d_mutex_lock(); + count = IWineD3DDevice_GetNumberOfSwapChains(((IDirect3DDevice9Impl *)iface)->WineD3DDevice); + wined3d_mutex_unlock(); + + return count; +} + static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data) { BOOL *resources_ok = data; D3DRESOURCETYPE type; @@ -1971,6 +2010,49 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(IDirect3DDevi return D3D_OK; } +static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(IDirect3DDevice9Ex *iface, + IDirect3DVertexDeclaration9 *declaration) +{ + HRESULT hr; + + TRACE("iface %p, declaration %p.\n", iface, declaration); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetVertexDeclaration(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, + declaration ? ((IDirect3DVertexDeclaration9Impl *)declaration)->wineD3DVertexDeclaration : NULL); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface, + IDirect3DVertexDeclaration9 **declaration) +{ + IWineD3DVertexDeclaration *wined3d_declaration = NULL; + HRESULT hr; + + TRACE("iface %p, declaration %p.\n", iface, declaration); + + if (!declaration) return D3DERR_INVALIDCALL; + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetVertexDeclaration(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, &wined3d_declaration); + if (SUCCEEDED(hr) && wined3d_declaration) + { + *declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration); + IDirect3DVertexDeclaration9_AddRef(*declaration); + IWineD3DVertexDeclaration_Release(wined3d_declaration); + } + else + { + *declaration = NULL; + } + wined3d_mutex_unlock(); + + TRACE("Returning %p.\n", *declaration); + return hr; +} + static IDirect3DVertexDeclaration9 *getConvertedDecl(IDirect3DDevice9Impl *This, DWORD fvf) { HRESULT hr; D3DVERTEXELEMENT9* elements = NULL; @@ -2118,6 +2200,153 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(IDirect3DDevice9Ex return D3D_OK; } +static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(IDirect3DDevice9Ex *iface, + IDirect3DVertexShader9 *shader) +{ + HRESULT hr; + + TRACE("iface %p, shader %p.\n", iface, shader); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetVertexShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, + shader ? ((IDirect3DVertexShader9Impl *)shader)->wineD3DVertexShader : NULL); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(IDirect3DDevice9Ex *iface, + IDirect3DVertexShader9 **shader) +{ + IWineD3DVertexShader *wined3d_shader; + HRESULT hr; + + TRACE("iface %p, shader %p.\n", iface, shader); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetVertexShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, &wined3d_shader); + if (SUCCEEDED(hr)) + { + if (wined3d_shader) + { + *shader = IWineD3DVertexShader_GetParent(wined3d_shader); + IDirect3DVertexShader9_AddRef(*shader); + IWineD3DVertexShader_Release(wined3d_shader); + } + else + { + *shader = NULL; + } + } + else + { + WARN("Failed to get vertex shader, hr %#x.\n", hr); + } + wined3d_mutex_unlock(); + + TRACE("Returning %p.\n", *shader); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDevice9Ex *iface, + UINT reg_idx, const float *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + if (reg_idx + count > D3D9_MAX_VERTEX_SHADER_CONSTANTF) + { + WARN("Trying to access %u constants, but d3d9 only supports %u\n", + reg_idx + count, D3D9_MAX_VERTEX_SHADER_CONSTANTF); + return D3DERR_INVALIDCALL; + } + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetVertexShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(IDirect3DDevice9Ex *iface, + UINT reg_idx, float *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + if (reg_idx + count > D3D9_MAX_VERTEX_SHADER_CONSTANTF) + { + WARN("Trying to access %u constants, but d3d9 only supports %u\n", + reg_idx + count, D3D9_MAX_VERTEX_SHADER_CONSTANTF); + return D3DERR_INVALIDCALL; + } + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetVertexShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(IDirect3DDevice9Ex *iface, + UINT reg_idx, const int *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetVertexShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(IDirect3DDevice9Ex *iface, + UINT reg_idx, int *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetVertexShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(IDirect3DDevice9Ex *iface, + UINT reg_idx, const BOOL *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetVertexShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(IDirect3DDevice9Ex *iface, + UINT reg_idx, BOOL *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetVertexShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; @@ -2273,6 +2502,141 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(IDirect3DDevice9Ex return D3D_OK; } +static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(IDirect3DDevice9Ex *iface, + IDirect3DPixelShader9 *shader) +{ + HRESULT hr; + + TRACE("iface %p, shader %p.\n", iface, shader); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, + shader ? ((IDirect3DPixelShader9Impl *)shader)->wineD3DPixelShader : NULL); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, + IDirect3DPixelShader9 **shader) +{ + IWineD3DPixelShader *wined3d_shader; + HRESULT hr; + + TRACE("iface %p, shader %p.\n", iface, shader); + + if (!shader) return D3DERR_INVALIDCALL; + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, &wined3d_shader); + if (SUCCEEDED(hr)) + { + if (wined3d_shader) + { + *shader = IWineD3DPixelShader_GetParent(wined3d_shader); + IDirect3DPixelShader9_AddRef(*shader); + IWineD3DPixelShader_Release(wined3d_shader); + } + else + { + *shader = NULL; + } + } + else + { + WARN("Failed to get pixel shader, hr %#x.\n", hr); + } + wined3d_mutex_unlock(); + + TRACE("Returning %p.\n", *shader); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevice9Ex *iface, + UINT reg_idx, const float *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetPixelShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(IDirect3DDevice9Ex *iface, + UINT reg_idx, float *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetPixelShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(IDirect3DDevice9Ex *iface, + UINT reg_idx, const int *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetPixelShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(IDirect3DDevice9Ex *iface, + UINT reg_idx, int *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetPixelShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(IDirect3DDevice9Ex *iface, + UINT reg_idx, const BOOL *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_SetPixelShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(IDirect3DDevice9Ex *iface, + UINT reg_idx, BOOL *data, UINT count) +{ + HRESULT hr; + + TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_GetPixelShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + wined3d_mutex_unlock(); + + return hr; +} + static HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9EX iface, UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; diff --git a/dlls/d3d9/pixelshader.c b/dlls/d3d9/pixelshader.c index 840322bef28..1d4fd95d482 100644 --- a/dlls/d3d9/pixelshader.c +++ b/dlls/d3d9/pixelshader.c @@ -150,138 +150,3 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl return D3D_OK; } - -HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9* pShader) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IDirect3DPixelShader9Impl *shader = (IDirect3DPixelShader9Impl *)pShader; - - TRACE("iface %p, shader %p.\n", iface, shader); - - wined3d_mutex_lock(); - IWineD3DDevice_SetPixelShader(This->WineD3DDevice, shader == NULL ? NULL :shader->wineD3DPixelShader); - wined3d_mutex_unlock(); - - return D3D_OK; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, IDirect3DPixelShader9 **ppShader) -{ - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DPixelShader *object; - HRESULT hr; - - TRACE("iface %p, shader %p.\n", iface, ppShader); - - if (ppShader == NULL) { - TRACE("(%p) Invalid call\n", This); - return D3DERR_INVALIDCALL; - } - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object); - if (SUCCEEDED(hr)) - { - if (object) - { - *ppShader = IWineD3DPixelShader_GetParent(object); - IDirect3DPixelShader9_AddRef(*ppShader); - IWineD3DPixelShader_Release(object); - } - else - { - *ppShader = NULL; - } - } - else - { - WARN("Failed to get pixel shader, hr %#x.\n", hr); - } - wined3d_mutex_unlock(); - - TRACE("Returning %p.\n", *ppShader); - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4fCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4fCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4iCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4iCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, BoolCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, BoolCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); - wined3d_mutex_unlock(); - - return hr; -} diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index 18c7dcddf3c..0d523914f92 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c @@ -273,43 +273,3 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl return D3D_OK; } - -HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface, - UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain) -{ - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DSwapChain *swapchain = NULL; - HRESULT hr; - - TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", - iface, iSwapChain, pSwapChain); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain); - if (SUCCEEDED(hr) && swapchain) - { - *pSwapChain = IWineD3DSwapChain_GetParent(swapchain); - IDirect3DSwapChain9_AddRef(*pSwapChain); - IWineD3DSwapChain_Release(swapchain); - } - else - { - *pSwapChain = NULL; - } - wined3d_mutex_unlock(); - - return hr; -} - -UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - UINT ret; - - TRACE("iface %p.\n", iface); - - wined3d_mutex_lock(); - ret = IWineD3DDevice_GetNumberOfSwapChains(This->WineD3DDevice); - wined3d_mutex_unlock(); - - return ret; -} diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index 3e91389c250..88f912f1dba 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c @@ -411,46 +411,3 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration, return D3D_OK; } - -HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9* pDecl) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IDirect3DVertexDeclaration9Impl *pDeclImpl = (IDirect3DVertexDeclaration9Impl *)pDecl; - HRESULT hr = D3D_OK; - - TRACE("iface %p, vertex declaration %p.\n", iface, pDecl); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, pDeclImpl == NULL ? NULL : pDeclImpl->wineD3DVertexDeclaration); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface, - IDirect3DVertexDeclaration9 **declaration) -{ - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DVertexDeclaration *wined3d_declaration = NULL; - HRESULT hr; - - TRACE("iface %p, declaration %p.\n", iface, declaration); - - if (!declaration) return D3DERR_INVALIDCALL; - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration); - if (SUCCEEDED(hr) && wined3d_declaration) - { - *declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration); - IDirect3DVertexDeclaration9_AddRef(*declaration); - IWineD3DVertexDeclaration_Release(wined3d_declaration); - } - else - { - *declaration = NULL; - } - wined3d_mutex_unlock(); - - TRACE("Returning %p.\n", *declaration); - return hr; -} diff --git a/dlls/d3d9/vertexshader.c b/dlls/d3d9/vertexshader.c index 9faef7229a2..1ff168b9dc5 100644 --- a/dlls/d3d9/vertexshader.c +++ b/dlls/d3d9/vertexshader.c @@ -150,147 +150,3 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im return D3D_OK; } - -HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9* pShader) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hrc = D3D_OK; - - TRACE("iface %p, shader %p.\n", iface, pShader); - - wined3d_mutex_lock(); - hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, pShader==NULL?NULL:((IDirect3DVertexShader9Impl *)pShader)->wineD3DVertexShader); - wined3d_mutex_unlock(); - - TRACE("(%p) : returning hr(%u)\n", This, hrc); - return hrc; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9 **ppShader) -{ - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DVertexShader *pShader; - HRESULT hr; - - TRACE("iface %p, shader %p.\n", iface, ppShader); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader); - if (SUCCEEDED(hr)) - { - if (pShader) - { - *ppShader = IWineD3DVertexShader_GetParent(pShader); - IDirect3DVertexShader9_AddRef(*ppShader); - IWineD3DVertexShader_Release(pShader); - } - else - { - *ppShader = NULL; - } - } - else - { - WARN("Failed to get vertex shader, hr %#x.\n", hr); - } - wined3d_mutex_unlock(); - - TRACE("Returning %p.\n", *ppShader); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4fCount); - - if(Register + Vector4fCount > D3D9_MAX_VERTEX_SHADER_CONSTANTF) { - WARN("Trying to access %u constants, but d3d9 only supports %u\n", - Register + Vector4fCount, D3D9_MAX_VERTEX_SHADER_CONSTANTF); - return D3DERR_INVALIDCALL; - } - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4fCount); - - if(Register + Vector4fCount > D3D9_MAX_VERTEX_SHADER_CONSTANTF) { - WARN("Trying to access %u constants, but d3d9 only supports %u\n", - Register + Vector4fCount, D3D9_MAX_VERTEX_SHADER_CONSTANTF); - return D3DERR_INVALIDCALL; - } - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4iCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, Vector4iCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, BoolCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); - wined3d_mutex_unlock(); - - return hr; -} - -HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, register %u, data %p, count %u.\n", - iface, Register, pConstantData, BoolCount); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); - wined3d_mutex_unlock(); - - return hr; -}