Commit 2121f783 authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Put all the stubs in wined3d in place, with some functionality copied

across from d3d9. Make sure all d3d9 device function call their wined3d counterpart (or perform a function).
parent 7caa1f6b
......@@ -1130,15 +1130,13 @@ extern HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWO
extern HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags);
/* Callbacks */
extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *pDevice,
UINT Width,
UINT Height,
D3DFORMAT Format,
D3DPOOL Pool,
IWineD3DSurface **ppSurface,
HANDLE * pSharedHandle);
extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, UINT Width, UINT Height,
D3DFORMAT Format, DWORD Usage, D3DPOOL Pool, UINT Level,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
extern HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height, UINT Depth,
D3DFORMAT Format, D3DPOOL Pool, DWORD Usage,
IWineD3DVolume **ppVolume,
HANDLE * pSharedHandle);
#endif /* __WINE_D3D9_PRIVATE_H */
......@@ -192,25 +192,3 @@ IDirect3DSurface9Vtbl Direct3DSurface9_Vtbl =
IDirect3DSurface9Impl_GetDC,
IDirect3DSurface9Impl_ReleaseDC
};
/* Internal function called back during the CreateTexture and CreateCubeTextures to create the surface(s) */
HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *pDevice,
UINT Width,
UINT Height,
D3DFORMAT Format,
D3DPOOL Pool,
IWineD3DSurface **ppSurface,
HANDLE * pSharedHandle) {
HRESULT res = D3D_OK;
IDirect3DSurface9Impl *d3dSurface = NULL;
res = IDirect3DDevice9_CreateOffscreenPlainSurface((IDirect3DDevice9 *)pDevice, Width, Height,
Format, Pool, (IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
if (res == D3D_OK) {
*ppSurface = d3dSurface->wineD3DSurface;
} else {
*ppSurface = NULL;
}
return res;
}
......@@ -89,6 +89,7 @@ IDirect3DVertexDeclaration9Vtbl Direct3DVertexDeclaration9_Vtbl =
/* IDirect3DDevice9 IDirect3DVertexDeclaration9 Methods follow: */
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9 iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IDirect3DVertexDeclaration9Impl *object = NULL;
HRESULT hr = D3D_OK;
......@@ -106,7 +107,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
object->lpVtbl = &Direct3DVertexDeclaration9_Vtbl;
object->ref = 1;
hr = IWineD3DDevice_CreateVertexDeclaration(This->WineD3DDevice, 9, pVertexElements, &(object->wineD3DVertexDeclaration));
hr = IWineD3DDevice_CreateVertexDeclaration(This->WineD3DDevice, pVertexElements, &object->wineD3DVertexDeclaration, (IUnknown *)object);
if (FAILED(hr)) {
/* free up object */
......
......@@ -124,7 +124,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFAC
*(pDesc->Type) = This->currentDesc.Type;
*(pDesc->Usage) = This->currentDesc.Usage;
*(pDesc->Pool) = This->currentDesc.Pool;
*(pDesc->Size) = This->currentDesc_size; /* dx8 only */
*(pDesc->Size) = This->currentDesc.Size; /* dx8 only */
*(pDesc->MultiSampleType) = This->currentDesc.MultiSampleType;
*(pDesc->MultiSampleQuality) = This->currentDesc.MultiSampleQuality;
*(pDesc->Width) = This->currentDesc.Width;
......@@ -569,7 +569,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
This->currentDesc.Width,
This->currentDesc.Height,
0,
This->currentDesc_size,
This->currentDesc.Size,
This->allocatedMemory);
ENTER_GL();
......@@ -580,7 +580,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
This->currentDesc.Width,
This->currentDesc.Height,
0,
This->currentDesc_size,
This->currentDesc.Size,
This->allocatedMemory);
checkGLcall("glCommpressedTexTexImage2D");
......
......@@ -848,3 +848,90 @@ HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantB(IDirect3DVertexShaderImpl*
}
#endif
/* *******************************************
IWineD3DVertexShader IUnknown parts follow
******************************************* */
HRESULT WINAPI IWineD3DVertexShaderImpl_QueryInterface(IWineD3DVertexShader *iface, REFIID riid, LPVOID *ppobj)
{
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
FIXME("(%p) :stub\n",This);
return E_NOINTERFACE;
}
ULONG WINAPI IWineD3DVertexShaderImpl_AddRef(IWineD3DVertexShader *iface) {
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
TRACE("(%p) : AddRef increasing from %ld\n", This, This->ref);
return InterlockedIncrement(&This->ref);
}
ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface) {
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
ULONG ref;
TRACE("(%p) : Releasing from %ld\n", This, This->ref);
ref = InterlockedDecrement(&This->ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* *******************************************
IWineD3DVertexShader IWineD3DVertexShader parts follow
******************************************* */
HRESULT WINAPI IWineD3DVertexShaderImpl_GetParent(IWineD3DVertexShader *iface, IUnknown** parent){
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
*parent= (IUnknown*) parent;
IUnknown_AddRef(*parent);
TRACE("(%p) : returning %p\n", This, *parent);
return D3D_OK;
}
HRESULT WINAPI IWineD3DVertexShaderImpl_GetDevice(IWineD3DVertexShader* iface, IWineD3DDevice **pDevice){
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
IWineD3DDevice_AddRef((IWineD3DDevice *)This->wineD3DDevice);
*pDevice = (IWineD3DDevice *)This->wineD3DDevice;
TRACE("(%p) returning %p\n", This, *pDevice);
return D3D_OK;
}
HRESULT WINAPI IWineD3DVertexShaderImpl_GetFunction(IWineD3DVertexShader* impl, VOID* pData, UINT* pSizeOfData) {
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)impl;
FIXME("(%p) : pData(%p), pSizeOfData(%p)\n", This, pData, pSizeOfData);
if (NULL == pData) {
*pSizeOfData = This->functionLength;
return D3D_OK;
}
if (*pSizeOfData < This->functionLength) {
*pSizeOfData = This->functionLength;
return D3DERR_MOREDATA;
}
if (NULL == This->function) { /* no function defined */
TRACE("(%p) : GetFunction no User Function defined using NULL to %p\n", This, pData);
(*(DWORD **) pData) = NULL;
} else {
if(This->functionLength == 0){
}
TRACE("(%p) : GetFunction copying to %p\n", This, pData);
memcpy(pData, This->function, This->functionLength);
}
return D3D_OK;
}
IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl =
{
/*** IUnknown methods ***/
IWineD3DVertexShaderImpl_QueryInterface,
IWineD3DVertexShaderImpl_AddRef,
IWineD3DVertexShaderImpl_Release,
/*** IWineD3DVertexShader methods ***/
IWineD3DVertexShaderImpl_GetParent,
IWineD3DVertexShaderImpl_GetDevice,
IWineD3DVertexShaderImpl_GetFunction
};
......@@ -356,10 +356,10 @@ typedef struct IWineD3DDeviceImpl
BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */
GLenum tracking_parm; /* Which source is tracking current colour */
LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */
#define DISABLED_TRACKING 0 /* Disabled */
#define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
#define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
#define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
#define DISABLED_TRACKING 0 /* Disabled */
#define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
#define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
#define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
UINT srcBlend;
UINT dstBlend;
UINT alphafunc;
......@@ -392,9 +392,19 @@ typedef struct IWineD3DDeviceImpl
/* For rendering to a texture using glCopyTexImage */
BOOL renderUpsideDown;
/* Cursor management */
BOOL bCursorVisible;
UINT xHotSpot;
UINT yHotSpot;
UINT xScreenSpace;
UINT yScreenSpace;
/* Textures for when no other textures are mapped */
UINT dummyTextureName[8];
/* Debug stream management */
BOOL debug;
} IWineD3DDeviceImpl;
extern IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
......@@ -571,6 +581,20 @@ typedef struct IWineD3DVolumeTextureImpl
extern IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl;
typedef struct _WINED3DSURFACET_DESC
{
D3DFORMAT Format;
D3DRESOURCETYPE Type;
DWORD Usage;
D3DPOOL Pool;
UINT Size;
UINT Level;
D3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality;
UINT Width;
UINT Height;
} WINED3DSURFACET_DESC;
/*****************************************************************************
* IWineD3DSurface implementation structure
*/
......@@ -582,18 +606,20 @@ struct IWineD3DSurfaceImpl
/* IWineD3DSurface fields */
IUnknown *container;
D3DSURFACE_DESC currentDesc;
UINT currentDesc_size;
WINED3DSURFACET_DESC currentDesc;
BYTE *allocatedMemory;
UINT textureName;
UINT bytesPerPixel;
BOOL lockable;
BOOL discard;
BOOL locked;
RECT lockedRect;
RECT dirtyRect;
BOOL Dirty;
BOOL inTexture;
BOOL inPBuffer;
};
......@@ -608,6 +634,7 @@ typedef struct IWineD3DVertexDeclarationImpl {
IWineD3DVertexDeclarationVtbl *lpVtbl;
DWORD ref; /* Note: Ref counting not required */
IUnknown *parent;
/** precomputed fvf if simple declaration */
IWineD3DDeviceImpl *wineD3DDevice;
DWORD fvf[MAX_STREAMS];
......@@ -643,6 +670,8 @@ typedef struct SAVEDSTATES {
BOOL textureState[8][HIGHEST_TEXTURE_STATE];
BOOL clipplane[MAX_CLIPPLANES];
BOOL vertexDecl;
BOOL pixelShader;
BOOL vertexShader;
} SAVEDSTATES;
struct IWineD3DStateBlockImpl
......@@ -782,41 +811,57 @@ GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
#if 0 /* Needs fixing during rework */
/*****************************************************************************
* IDirect3DVertexShader implementation structure
*/
struct IDirect3DVertexShaderImpl {
/* The device */
/*IDirect3DDeviceImpl* device;*/
DWORD* function;
UINT functionLength;
DWORD usage;
DWORD version;
/* run time datas */
VSHADERDATA* data;
VSHADERINPUTDATA input;
VSHADEROUTPUTDATA output;
};
typedef struct IWineD3DVertexShaderImpl {
/* IUnknown parts*/
IWineD3DVertexShaderVtbl *lpVtbl;
DWORD ref; /* Note: Ref counting not required */
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
/* IWineD3DVertexShaderImpl*/
CONST DWORD *function;
UINT functionLength;
#if 0 /* needs reworking */
DWORD usage;
DWORD version;
/* run time datas */
VSHADERDATA* data;
VSHADERINPUTDATA input;
VSHADEROUTPUTDATA output;
#endif
} IWineD3DVertexShaderImpl;
extern IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
/*****************************************************************************
* IDirect3DPixelShader implementation structure
*/
struct IDirect3DPixelShaderImpl {
/* The device */
/*IDirect3DDeviceImpl* device;*/
DWORD* function;
UINT functionLength;
DWORD version;
/* run time datas */
PSHADERDATA* data;
PSHADERINPUTDATA input;
PSHADEROUTPUTDATA output;
};
typedef struct IWineD3DPixelShaderImpl {
/* IUnknown parts*/
IWineD3DPixelShaderVtbl *lpVtbl;
DWORD ref; /* Note: Ref counting not required */
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
/* IWineD3DPixelShaderImpl*/
CONST DWORD *function;
UINT functionLength;
#if 0 /* needs reworking */
UINT functionLength;
DWORD version;
/* run time datas */
PSHADERDATA* data;
PSHADERINPUTDATA input;
PSHADEROUTPUTDATA output;
#endif
} IWineD3DPixelShaderImpl;
#endif /* Needs fixing during rework */
extern IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;
#endif
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