Beginning of support for D3D7 / D3DDevice7.
This commit is contained in:
parent
e0c6370c75
commit
f4b941e859
|
@ -207,6 +207,49 @@ static void fill_opengl_caps(D3DDEVICEDESC *d1)
|
|||
d1->wMaxSimultaneousTextures = 1; /* TODO add proper caps according to OpenGL multi-texture stuff */
|
||||
}
|
||||
|
||||
static void fill_opengl_caps_7(D3DDEVICEDESC7 *d)
|
||||
{
|
||||
D3DDEVICEDESC d1;
|
||||
|
||||
/* Copy first D3D1/2/3 capabilities */
|
||||
fill_opengl_caps(&d1);
|
||||
|
||||
/* And fill the D3D7 one with it */
|
||||
d->dwDevCaps = d1.dwDevCaps;
|
||||
d->dpcLineCaps = d1.dpcLineCaps;
|
||||
d->dpcTriCaps = d1.dpcTriCaps;
|
||||
d->dwDeviceRenderBitDepth = d1.dwDeviceRenderBitDepth;
|
||||
d->dwDeviceZBufferBitDepth = d1.dwDeviceZBufferBitDepth;
|
||||
d->dwMinTextureWidth = d1.dwMinTextureWidth;
|
||||
d->dwMinTextureHeight = d1.dwMinTextureHeight;
|
||||
d->dwMaxTextureWidth = d1.dwMaxTextureWidth;
|
||||
d->dwMaxTextureHeight = d1.dwMaxTextureHeight;
|
||||
d->dwMaxTextureRepeat = d1.dwMaxTextureRepeat;
|
||||
d->dwMaxTextureAspectRatio = d1.dwMaxTextureAspectRatio;
|
||||
d->dwMaxAnisotropy = d1.dwMaxAnisotropy;
|
||||
d->dvGuardBandLeft = d1.dvGuardBandLeft;
|
||||
d->dvGuardBandTop = d1.dvGuardBandTop;
|
||||
d->dvGuardBandRight = d1.dvGuardBandRight;
|
||||
d->dvGuardBandBottom = d1.dvGuardBandBottom;
|
||||
d->dvExtentsAdjust = d1.dvExtentsAdjust;
|
||||
d->dwStencilCaps = d1.dwStencilCaps;
|
||||
d->dwFVFCaps = d1.dwFVFCaps;
|
||||
d->dwTextureOpCaps = d1.dwTextureOpCaps;
|
||||
d->wMaxTextureBlendStages = d1.wMaxTextureBlendStages;
|
||||
d->wMaxSimultaneousTextures = d1.wMaxSimultaneousTextures;
|
||||
d->dwMaxActiveLights = d1.dlcLightingCaps.dwNumLights;
|
||||
d->dvMaxVertexW = 100000000.0; /* No idea exactly what to put here... */
|
||||
d->deviceGUID = IID_IDirect3DTnLHalDevice;
|
||||
d->wMaxUserClipPlanes = 1;
|
||||
d->wMaxVertexBlendMatrices = 1;
|
||||
d->dwVertexProcessingCaps = D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 | D3DVTXPCAPS_VERTEXFOG | D3DVTXPCAPS_DIRECTIONALLIGHTS |
|
||||
D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER;
|
||||
d->dwReserved1 = 0;
|
||||
d->dwReserved2 = 0;
|
||||
d->dwReserved3 = 0;
|
||||
d->dwReserved4 = 0;
|
||||
}
|
||||
|
||||
#if 0 /* TODO : fix this and add multitexturing and other needed stuff */
|
||||
static void fill_device_capabilities(IDirectDrawImpl* ddraw)
|
||||
{
|
||||
|
@ -254,6 +297,17 @@ HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD i
|
|||
return cb((LPGUID) iid, buf, "direct3d", &d1, &d2, context);
|
||||
}
|
||||
|
||||
HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context)
|
||||
{
|
||||
D3DDEVICEDESC7 ddesc;
|
||||
|
||||
fill_opengl_caps_7(&ddesc);
|
||||
|
||||
TRACE(" enumerating OpenGL D3DDevice7 interface.\n");
|
||||
|
||||
return cb("WINE Direct3D7 using OpenGL", "Wine D3D7 device", &ddesc, context);
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
|
||||
{
|
||||
|
|
|
@ -181,7 +181,8 @@ create_device_helper(IDirect3DImpl *This,
|
|||
return D3D_OK;
|
||||
}
|
||||
if ((iid == NULL) ||
|
||||
(IsEqualGUID(&IID_IDirect3DHALDevice, iid))) {
|
||||
(IsEqualGUID(&IID_IDirect3DHALDevice, iid)) ||
|
||||
(IsEqualGUID(&IID_IDirect3DTnLHalDevice, iid))) {
|
||||
switch (interface) {
|
||||
case 1:
|
||||
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice);
|
||||
|
@ -293,6 +294,32 @@ GL_IDirect3DImpl_7_3T_EnumZBufferFormats(LPDIRECT3D7 iface,
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
GL_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
|
||||
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
|
||||
LPVOID lpUserArg)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
|
||||
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
|
||||
|
||||
if (d3ddevice_enumerate7(lpEnumDevicesCallback, lpUserArg) != D3DENUMRET_OK)
|
||||
return D3D_OK;
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
GL_IDirect3DImpl_7_CreateDevice(LPDIRECT3D7 iface,
|
||||
REFCLSID rclsid,
|
||||
LPDIRECTDRAWSURFACE7 lpDDS,
|
||||
LPDIRECT3DDEVICE7* lplpD3DDevice)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
|
||||
IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpDDS);
|
||||
TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice);
|
||||
return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice, 7);
|
||||
}
|
||||
|
||||
static void light_released(IDirect3DImpl *This, GLenum light_num)
|
||||
{
|
||||
IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
|
||||
|
@ -311,8 +338,8 @@ ICOM_VTABLE(IDirect3D7) VTABLE_IDirect3D7 =
|
|||
XCAST(QueryInterface) Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface,
|
||||
XCAST(AddRef) Main_IDirect3DImpl_7_3T_2T_1T_AddRef,
|
||||
XCAST(Release) Main_IDirect3DImpl_7_3T_2T_1T_Release,
|
||||
XCAST(EnumDevices) Main_IDirect3DImpl_7_EnumDevices,
|
||||
XCAST(CreateDevice) Main_IDirect3DImpl_7_CreateDevice,
|
||||
XCAST(EnumDevices) GL_IDirect3DImpl_7_EnumDevices,
|
||||
XCAST(CreateDevice) GL_IDirect3DImpl_7_CreateDevice,
|
||||
XCAST(CreateVertexBuffer) Main_IDirect3DImpl_7_3T_CreateVertexBuffer,
|
||||
XCAST(EnumZBufferFormats) GL_IDirect3DImpl_7_3T_EnumZBufferFormats,
|
||||
XCAST(EvictManagedTextures) Main_IDirect3DImpl_7_3T_EvictManagedTextures,
|
||||
|
|
|
@ -124,6 +124,7 @@ extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, I
|
|||
|
||||
/* Used for Direct3D to request the device to enumerate itself */
|
||||
extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD interface_version) ;
|
||||
extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ;
|
||||
extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice, DWORD interface_version);
|
||||
|
||||
/* Matrix copy WITH transposition */
|
||||
|
|
Loading…
Reference in New Issue