Commit 2465b4cf authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Move device functions to device.c.

parent 6c4c3517
...@@ -183,51 +183,6 @@ typedef struct IDirect3DDevice9Impl ...@@ -183,51 +183,6 @@ typedef struct IDirect3DDevice9Impl
HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type, HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type,
HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN; 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 * IDirect3DVolume9 implementation structure
*/ */
......
...@@ -150,138 +150,3 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl ...@@ -150,138 +150,3 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl
return D3D_OK; 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;
}
...@@ -273,43 +273,3 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl ...@@ -273,43 +273,3 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
return D3D_OK; 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;
}
...@@ -411,46 +411,3 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration, ...@@ -411,46 +411,3 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration,
return D3D_OK; 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;
}
...@@ -150,147 +150,3 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im ...@@ -150,147 +150,3 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im
return D3D_OK; 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment