Commit 43c3dc4d authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- Clean up all the D3D COM handling (but the underlaying code is still

as ugly as before). - Handle properly (ie as on real Windows) negative values in rectangles during blitting.
parent f2abe47d
......@@ -18,6 +18,7 @@ OPENGLFILES = \
d3dlight.c \
d3dmaterial.c \
d3dtexture.c \
d3dvertexbuffer.c \
d3dviewport.c \
direct3d/main.c \
direct3d/mesa.c \
......
......@@ -17,6 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _DDCOMIMPL_H_
#define _DDCOMIMPL_H_
#include <stddef.h>
/* Generates the name for a vtable pointer for a given interface. */
......@@ -51,3 +54,5 @@
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
#endif /* _DDCOMIMPL_H_ */
......@@ -37,6 +37,7 @@
#include "wine/debug.h"
#include "ddraw_private.h"
#include "mesa_private.h" /* To have the D3D creation function */
#include "ddraw/main.h"
#include "dclipper/main.h"
#include "dpalette/main.h"
......@@ -139,13 +140,15 @@ ULONG WINAPI Main_DirectDraw_Release(LPDIRECTDRAW7 iface) {
return ref;
}
/* TODO: need to support IDirect3D. */
HRESULT WINAPI Main_DirectDraw_QueryInterface(
LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj
) {
ICOM_THIS(IDirectDrawImpl,iface);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(refiid), obj);
/* According to COM docs, if the QueryInterface fails, obj should be set to NULL */
*obj = NULL;
if ( IsEqualGUID( &IID_IUnknown, refiid )
|| IsEqualGUID( &IID_IDirectDraw7, refiid ) )
{
......@@ -164,17 +167,53 @@ HRESULT WINAPI Main_DirectDraw_QueryInterface(
*obj = ICOM_INTERFACE(This, IDirectDraw4);
}
#ifdef HAVE_OPENGL
else if ( IsEqualGUID( &IID_IDirect3D3, refiid ) )
else if ( IsEqualGUID( &IID_IDirect3D , refiid ) )
{
return create_direct3d3(obj, This);
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D);
TRACE(" returning Direct3D interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) )
{
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D2);
TRACE(" returning Direct3D2 interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D2, refiid ) )
else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) )
{
return create_direct3d2(obj, This);
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D3);
TRACE(" returning Direct3D3 interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D, refiid ) )
else if ( IsEqualGUID( &IID_IDirect3D7 , refiid ) )
{
return create_direct3d(obj, This);
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D7);
TRACE(" returning Direct3D7 interface at %p.\n", *obj);
}
#endif
else
......
......@@ -280,8 +280,8 @@ struct IDirectDrawSurfaceImpl
void (*aux_release)(LPVOID ctx, LPVOID data);
BOOL (*aux_flip)(LPVOID ctx, LPVOID data);
void (*aux_unlock)(LPVOID ctx, LPVOID data, LPRECT lpRect);
struct IDirect3DTexture2Impl* texture;
HRESULT (WINAPI *SetColorKey_cb)(struct IDirect3DTexture2Impl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
struct IDirect3DTextureImpl *texture;
HRESULT (WINAPI *SetColorKey_cb)(struct IDirect3DTextureImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
};
/*****************************************************************************
......@@ -333,11 +333,6 @@ typedef struct {
extern Convert ModeEmulations[8];
extern int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw);
extern HRESULT create_direct3d(LPVOID *obj,IDirectDrawImpl*);
extern HRESULT create_direct3d2(LPVOID *obj,IDirectDrawImpl*);
extern HRESULT create_direct3d3(LPVOID *obj,IDirectDrawImpl*);
extern HRESULT create_direct3d7(LPVOID *obj,IDirectDrawImpl*);
/******************************************************************************
* Structure conversion (for thunks)
*/
......
/*
* Copyright 2002 Lionel Ulmer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
/* This is defined here so as to be able to put them in 'drivers' */
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface(LPDIRECT3D7 iface,
REFIID riid,
LPVOID* obp);
ULONG WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_AddRef(LPDIRECT3D7 iface);
ULONG WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_Release(LPDIRECT3D7 iface);
HRESULT WINAPI
Main_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Main_IDirect3DImpl_7_CreateDevice(LPDIRECT3D7 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE7 lpDDS,
LPDIRECT3DDEVICE7* lplpD3DDevice);
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_CreateVertexBuffer(LPDIRECT3D7 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER7* lplpD3DVertBuf,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_EnumZBufferFormats(LPDIRECT3D7 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext);
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_EvictManagedTextures(LPDIRECT3D7 iface);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateLight(LPDIRECT3D3 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateMaterial(LPDIRECT3D3 iface,
LPDIRECT3DMATERIAL3* lplpDirect3DMaterial3,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
LPDIRECT3DVIEWPORT3* lplpD3DViewport3,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);
HRESULT WINAPI
Main_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE4 lpDDS,
LPDIRECT3DDEVICE3* lplpD3DDevice3,
LPUNKNOWN lpUnk);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_CreateVertexBuffer(LPDIRECT3D3 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER* lplpD3DVertBuf,
DWORD dwFlags,
LPUNKNOWN lpUnk);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateMaterial(LPDIRECT3D2 iface,
LPDIRECT3DMATERIAL2* lplpDirect3DMaterial2,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateViewport(LPDIRECT3D2 iface,
LPDIRECT3DVIEWPORT2* lplpD3DViewport2,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_2_CreateDevice(LPDIRECT3D2 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE lpDDS,
LPDIRECT3DDEVICE2* lplpD3DDevice2);
HRESULT WINAPI
Main_IDirect3DImpl_1_Initialize(LPDIRECT3D iface,
REFIID riid);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateMaterial(LPDIRECT3D iface,
LPDIRECT3DMATERIAL* lplpDirect3DMaterial,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateViewport(LPDIRECT3D iface,
LPDIRECT3DVIEWPORT* lplpD3DViewport,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_QueryInterface(LPDIRECT3D3 iface,
REFIID riid,
LPVOID* obp);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_QueryInterface(LPDIRECT3D2 iface,
REFIID riid,
LPVOID* obp);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_QueryInterface(LPDIRECT3D iface,
REFIID riid,
LPVOID* obp);
ULONG WINAPI
Thunk_IDirect3DImpl_3_AddRef(LPDIRECT3D3 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_2_AddRef(LPDIRECT3D2 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_1_AddRef(LPDIRECT3D iface);
ULONG WINAPI
Thunk_IDirect3DImpl_3_Release(LPDIRECT3D3 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_2_Release(LPDIRECT3D2 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_1_Release(LPDIRECT3D iface);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_EnumZBufferFormats(LPDIRECT3D3 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_EvictManagedTextures(LPDIRECT3D3 iface);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_EnumDevices(LPDIRECT3D2 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_EnumDevices(LPDIRECT3D iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateLight(LPDIRECT3D2 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateLight(LPDIRECT3D iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);
......@@ -395,14 +395,31 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
}
}
if (xsrc.bottom > sdesc.dwHeight)
xsrc.bottom = sdesc.dwHeight;
if (xdst.bottom > ddesc.dwHeight)
xdst.bottom = ddesc.dwHeight;
/* First check for the validity of source / destination rectangles. This was
verified using a test application + by MSDN.
*/
if ((src != NULL) &&
((xsrc.bottom > sdesc.dwHeight) || (xsrc.bottom < 0) ||
(xsrc.top > sdesc.dwHeight) || (xsrc.top < 0) ||
(xsrc.left > sdesc.dwWidth) || (xsrc.left < 0) ||
(xsrc.right > sdesc.dwWidth) || (xsrc.right < 0) ||
(xsrc.right < xsrc.left) || (xsrc.bottom < xsrc.top))) {
WARN("Application gave us bad source rectangle for Blt.\n");
return DDERR_INVALIDRECT;
}
/* For the Destination rect, it can be out of bounds on the condition that a clipper
is set for the given surface.
*/
if ((This->clipper == NULL) &&
((xdst.bottom > ddesc.dwHeight) || (xdst.bottom < 0) ||
(xdst.top > ddesc.dwHeight) || (xdst.top < 0) ||
(xdst.left > ddesc.dwWidth) || (xdst.left < 0) ||
(xdst.right > ddesc.dwWidth) || (xdst.right < 0) ||
(xdst.right < xdst.left) || (xdst.bottom < xdst.top))) {
WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
return DDERR_INVALIDRECT;
}
if (src) assert((xsrc.bottom-xsrc.top) <= sdesc.dwHeight);
assert((xdst.bottom-xdst.top) <= ddesc.dwHeight);
/* Now handle negative values in the rectangles. Warning: only supported for now
in the 'simple' cases (ie not in any stretching / rotation cases).
......@@ -428,9 +445,9 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
IntersectRect(&temp_rect, &full_rect, &xdst);
xdst = temp_rect;
} else {
/* This is trickier as any update to one rectangle need to be propagated to the other */
int clip_horiz = (xdst.left < 0) || (xdst.right > (int) ddesc.dwWidth ) || (xsrc.left < 0) || (xsrc.right > (int) sdesc.dwWidth );
int clip_vert = (xdst.top < 0) || (xdst.bottom > (int) ddesc.dwHeight) || (xsrc.top < 0) || (xsrc.bottom > (int) sdesc.dwHeight);
/* Only handle clipping on the destination rectangle */
int clip_horiz = (xdst.left < 0) || (xdst.right > (int) ddesc.dwWidth );
int clip_vert = (xdst.top < 0) || (xdst.bottom > (int) ddesc.dwHeight);
if (clip_vert || clip_horiz) {
/* Now check if this is a special case or not... */
if ((((xdst.bottom - xdst.top ) != (xsrc.bottom - xsrc.top )) && clip_vert ) ||
......@@ -441,15 +458,11 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
}
if (clip_horiz) {
if (xsrc.left < 0) { xdst.left -= xsrc.left; xsrc.left = 0; }
if (xdst.left < 0) { xsrc.left -= xdst.left; xdst.left = 0; }
if (xsrc.right > sdesc.dwWidth) { xdst.right -= (xsrc.right - (int) sdesc.dwWidth); xsrc.right = (int) sdesc.dwWidth; }
if (xdst.right > ddesc.dwWidth) { xsrc.right -= (xdst.right - (int) ddesc.dwWidth); xdst.right = (int) ddesc.dwWidth; }
}
if (clip_vert) {
if (xsrc.top < 0) { xdst.top -= xsrc.top; xsrc.top = 0; }
if (xdst.top < 0) { xsrc.top -= xdst.top; xdst.top = 0; }
if (xsrc.bottom > sdesc.dwHeight) { xdst.bottom -= (xsrc.bottom - (int) sdesc.dwHeight); xsrc.bottom = (int) sdesc.dwHeight; }
if (xdst.bottom > ddesc.dwHeight) { xsrc.bottom -= (xdst.bottom - (int) ddesc.dwHeight); xdst.bottom = (int) ddesc.dwHeight; }
}
/* And check if after clipping something is still to be done... */
......
......@@ -169,36 +169,52 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
return S_OK;
}
#ifdef HAVE_OPENGL
else if ( IsEqualGUID( &IID_D3DDEVICE_OpenGL, riid ) )
else if ( IsEqualGUID( &IID_D3DDEVICE_OpenGL, riid ) ||
IsEqualGUID( &IID_IDirect3DHALDevice, riid) )
{
This->ref++;
return is_OpenGL_dx3(riid, This, (IDirect3DDeviceImpl**)ppObj)?S_OK:E_NOINTERFACE;
IDirect3DDeviceImpl *d3ddevimpl;
HRESULT ret_value;
ret_value = d3ddevice_create(&d3ddevimpl, NULL, This);
if (FAILED(ret_value)) return ret_value;
*ppObj = ICOM_INTERFACE(d3ddevimpl, IDirect3DDevice);
TRACE(" returning Direct3DDevice interface at %p.\n", *ppObj);
This->ref++; /* No idea if this is correct.. Need to check using real Windows */
return ret_value;
}
else if (IsEqualGUID( &IID_IDirect3DTexture, riid ))
{
LPDIRECT3DTEXTURE iface;
This->ref++;
iface = d3dtexture_create(This);
if (iface) {
*ppObj = (LPVOID)iface;
return S_OK;
} else
return E_NOINTERFACE;
IDirect3DTextureImpl *d3dteximpl;
HRESULT ret_value;
ret_value = d3dtexture_create(&d3dteximpl, NULL, This);
if (FAILED(ret_value)) return ret_value;
*ppObj = ICOM_INTERFACE(d3dteximpl, IDirect3DTexture);
TRACE(" returning Direct3DTexture interface at %p.\n", *ppObj);
This->ref++; /* No idea if this is correct.. Need to check using real Windows */
return ret_value;
}
else if (IsEqualGUID( &IID_IDirect3DTexture2, riid ))
{
LPDIRECT3DTEXTURE2 iface;
This->ref++;
iface = d3dtexture2_create(This);
if (iface) {
*ppObj = (LPVOID)iface;
return S_OK;
} else
return E_NOINTERFACE;
IDirect3DTextureImpl *d3dteximpl;
HRESULT ret_value;
ret_value = d3dtexture_create(&d3dteximpl, NULL, This);
if (FAILED(ret_value)) return ret_value;
*ppObj = ICOM_INTERFACE(d3dteximpl, IDirect3DTexture2);
TRACE(" returning Direct3DTexture2 interface at %p.\n", *ppObj);
This->ref++; /* No idea if this is correct.. Need to check using real Windows */
return ret_value;
}
#endif
else
return E_NOINTERFACE;
return E_NOINTERFACE;
}
/*** Callbacks */
......
......@@ -56,30 +56,74 @@ extern void (*wine_tsx11_unlock_ptr)(void);
#define ENTER_GL() wine_tsx11_lock_ptr()
#define LEAVE_GL() wine_tsx11_unlock_ptr()
extern const GUID IID_D3DDEVICE_OpenGL;
extern const GUID IID_D3DDEVICE2_OpenGL;
extern const GUID IID_D3DDEVICE3_OpenGL;
extern const GUID IID_D3DDEVICE7_OpenGL;
extern const GUID IID_D3DDEVICE_Default;
/*****************************************************************************
* IDirect3DLight MESA private structure
*/
typedef struct mesa_d3dl_private
typedef struct render_state {
/* This is used for the device mode */
GLenum src, dst;
/* This is used for textures */
GLenum mag, min;
} RenderState;
/* Common functions defined in d3dcommon.c */
void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState, RenderState *rs) ;
typedef struct IDirect3DGLImpl
{
GLenum light_num;
} mesa_d3dl_private;
struct IDirect3DImpl parent;
int free_lights;
void (*light_released)(IDirect3DImpl *, GLenum light_num);
} IDirect3DGLImpl;
/*****************************************************************************
* IDirect3DTexture2 MESA private structure
*/
typedef struct mesa_d3dt_private
typedef struct IDirect3DLightGLImpl
{
GLuint tex_name;
} mesa_d3dt_private;
struct IDirect3DLightImpl parent;
GLenum light_num;
} IDirect3DLightGLImpl;
/*****************************************************************************
* IDirect3DViewport2 implementation structure
*/
typedef struct mesa_d3dv_private
typedef struct IDirect3DTextureGLImpl
{
GLenum nextlight;
} mesa_d3dv_private;
struct IDirect3DTextureImpl parent;
GLuint tex_name;
} IDirect3DTextureGLImpl;
typedef struct IDirect3DDeviceGLImpl
{
struct IDirect3DDeviceImpl parent;
GLXContext gl_context;
/* The current render state */
RenderState render_state;
/* The last type of vertex drawn */
D3DVERTEXTYPE vertex_type;
D3DMATRIX *world_mat;
D3DMATRIX *view_mat;
D3DMATRIX *proj_mat;
Display *display;
Drawable drawable;
} IDirect3DDeviceGLImpl;
/* All non-static functions 'exported' by various sub-objects */
extern HRESULT direct3d_create(IDirect3DImpl **obj, IDirectDrawImpl *ddraw);
extern HRESULT d3dtexture_create(IDirect3DTextureImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf);
extern HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum light_num);
extern HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirect3DImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
extern HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirect3DImpl *d3d);
extern HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d);
extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc);
extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surface);
/* Used for Direct3D to request the device to enumerate itself */
extern HRESULT d3device_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD interface_version) ;
/* Matrix copy WITH transposition */
#define conv_mat2(mat,gl_mat) \
......@@ -116,74 +160,9 @@ typedef struct mesa_d3dv_private
memcpy(gl_mat, (mat), 16 * sizeof(float)); \
};
typedef struct render_state {
/* This is used for the device mode */
GLenum src, dst;
/* This is used for textures */
GLenum mag, min;
} RenderState;
typedef struct mesa_d3dd_private {
GLXContext ctx;
/* The current render state */
RenderState rs;
/* The last type of vertex drawn */
D3DVERTEXTYPE vt;
D3DMATRIX *world_mat;
D3DMATRIX *view_mat;
D3DMATRIX *proj_mat;
Display *gdi_display;
Drawable drawable;
} mesa_d3dd_private;
#define _dump_colorvalue(s,v) \
TRACE(" " s " : %f %f %f %f\n", \
(v).u1.r, (v).u2.g, (v).u3.b, (v).u4.a);
/* Common functions defined in d3dcommon.c */
void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState, RenderState *rs) ;
/* All non-static functions 'exported' by various sub-objects */
extern LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurfaceImpl* surf);
extern LPDIRECT3DTEXTURE d3dtexture_create(IDirectDrawSurfaceImpl* surf);
extern LPDIRECT3DLIGHT d3dlight_create_dx3(IDirect3DImpl* d3d1);
extern LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2);
extern LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
extern LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1);
extern LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2);
extern LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1);
extern LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2);
extern int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDeviceImpl** device);
extern int d3d_OpenGL_dx3(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
extern int d3d_OpenGL(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
extern int is_OpenGL(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevice2Impl** device, IDirect3D2Impl* d3d);
extern LPDIRECT3DTEXTURE2 mesa_d3dtexture2_create(IDirectDrawSurfaceImpl*);
extern LPDIRECT3DTEXTURE mesa_d3dtexture_create(IDirectDrawSurfaceImpl*);
static const GUID WINE_UNUSED IID_D3DDEVICE2_OpenGL = {
0x39a0da38,
0x7e57,
0x11d2,
{ 0x8b,0x7c,0x0e,0x4e,0xd8,0x3c,0x2b,0x3c }
};
static const GUID WINE_UNUSED IID_D3DDEVICE_OpenGL = {
0x31416d44,
0x86ae,
0x11d2,
{ 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfa }
};
#define _dump_colorvalue(s,v) \
TRACE(" " s " : %f %f %f %f\n", \
(v).u1.r, (v).u2.g, (v).u3.b, (v).u4.a);
/* This structure contains all the function pointers to OpenGL extensions
that are used by Wine */
......@@ -192,10 +171,6 @@ typedef struct {
GLsizei width, GLenum format, GLenum type, const GLvoid *table);
} Mesa_DeviceCapabilities;
extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
extern ICOM_VTABLE(IDirect3D3) mesa_d3d3vt;
#endif /* HAVE_OPENGL */
#endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */
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