2002-03-10 00:29:33 +01:00
|
|
|
/*
|
2008-10-18 19:19:45 +02:00
|
|
|
* Copyright 2006 Stefan Dösinger
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*/
|
2001-01-04 23:44:55 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
#ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
|
|
|
|
#define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2010-08-18 19:26:20 +02:00
|
|
|
#include <assert.h>
|
2014-08-18 08:26:17 +02:00
|
|
|
#include <limits.h>
|
2010-08-18 19:26:20 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#include "wine/debug.h"
|
1999-12-04 05:22:04 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
1999-05-08 14:50:36 +02:00
|
|
|
#include "winuser.h"
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2010-08-18 19:26:20 +02:00
|
|
|
#include "d3d.h"
|
|
|
|
#include "ddraw.h"
|
2009-01-16 10:14:24 +01:00
|
|
|
#ifdef DDRAW_INIT_GUID
|
|
|
|
#include "initguid.h"
|
|
|
|
#endif
|
2010-08-18 19:26:20 +02:00
|
|
|
#include "wine/list.h"
|
2009-01-16 10:14:24 +01:00
|
|
|
#include "wine/wined3d.h"
|
2004-07-30 20:54:32 +02:00
|
|
|
|
2009-09-17 23:03:32 +02:00
|
|
|
extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
|
2009-09-17 12:35:28 +02:00
|
|
|
extern DWORD force_refresh_rate DECLSPEC_HIDDEN;
|
2008-03-10 17:44:38 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectDraw implementation structure
|
|
|
|
*****************************************************************************/
|
2007-04-22 17:55:30 +02:00
|
|
|
struct FvfToDecl
|
|
|
|
{
|
|
|
|
DWORD fvf;
|
2011-02-02 20:22:50 +01:00
|
|
|
struct wined3d_vertex_declaration *decl;
|
2007-04-22 17:55:30 +02:00
|
|
|
};
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2013-05-30 10:05:32 +02:00
|
|
|
#define DDRAW_INITIALIZED 0x00000001
|
|
|
|
#define DDRAW_D3D_INITIALIZED 0x00000002
|
|
|
|
#define DDRAW_RESTORE_MODE 0x00000004
|
2013-05-30 10:05:33 +02:00
|
|
|
#define DDRAW_NO3D 0x00000008
|
2013-06-05 10:55:40 +02:00
|
|
|
#define DDRAW_SCL_DDRAW1 0x00000010
|
2013-09-02 11:22:30 +02:00
|
|
|
#define DDRAW_SCL_RECURSIVE 0x00000020
|
2013-05-30 10:05:32 +02:00
|
|
|
|
2013-08-29 10:26:24 +02:00
|
|
|
#define DDRAW_STRIDE_ALIGNMENT 8
|
|
|
|
|
2015-03-30 09:17:05 +02:00
|
|
|
#define DDRAW_WINED3D_FLAGS (WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING \
|
2016-05-23 00:41:51 +02:00
|
|
|
| WINED3D_RESTORE_MODE_ON_ACTIVATE | WINED3D_FOCUS_MESSAGES | WINED3D_PIXEL_CENTER_INTEGER \
|
2017-03-08 12:07:23 +01:00
|
|
|
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART \
|
|
|
|
| WINED3D_LEGACY_CUBEMAP_FILTERING)
|
2015-03-30 09:17:05 +02:00
|
|
|
|
2014-06-30 11:17:03 +02:00
|
|
|
enum ddraw_device_state
|
|
|
|
{
|
|
|
|
DDRAW_DEVICE_STATE_OK,
|
|
|
|
DDRAW_DEVICE_STATE_LOST,
|
2015-12-04 11:30:14 +01:00
|
|
|
DDRAW_DEVICE_STATE_NOT_RESTORED,
|
2014-06-30 11:17:03 +02:00
|
|
|
};
|
|
|
|
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw
|
1999-03-27 17:53:09 +01:00
|
|
|
{
|
2011-01-19 01:42:43 +01:00
|
|
|
/* Interfaces */
|
|
|
|
IDirectDraw7 IDirectDraw7_iface;
|
2011-01-19 01:40:53 +01:00
|
|
|
IDirectDraw4 IDirectDraw4_iface;
|
2011-01-19 01:36:36 +01:00
|
|
|
IDirectDraw2 IDirectDraw2_iface;
|
2011-01-19 01:33:42 +01:00
|
|
|
IDirectDraw IDirectDraw_iface;
|
2011-01-19 01:32:36 +01:00
|
|
|
IDirect3D7 IDirect3D7_iface;
|
2011-01-19 01:30:21 +01:00
|
|
|
IDirect3D3 IDirect3D3_iface;
|
2011-01-18 12:30:17 +01:00
|
|
|
IDirect3D2 IDirect3D2_iface;
|
2011-01-18 12:28:15 +01:00
|
|
|
IDirect3D IDirect3D_iface;
|
2011-05-18 22:30:13 +02:00
|
|
|
struct wined3d_device_parent device_parent;
|
2001-01-04 23:44:55 +01:00
|
|
|
|
2006-07-10 16:06:33 +02:00
|
|
|
/* See comment in IDirectDraw::AddRef */
|
2006-12-15 17:15:28 +01:00
|
|
|
LONG ref7, ref4, ref2, ref3, ref1, numIfaces;
|
2001-01-04 23:44:55 +01:00
|
|
|
|
2011-11-28 21:30:58 +01:00
|
|
|
struct wined3d *wined3d;
|
2011-05-16 23:01:22 +02:00
|
|
|
struct wined3d_device *wined3d_device;
|
2013-05-30 10:05:32 +02:00
|
|
|
DWORD flags;
|
2014-06-30 11:17:03 +02:00
|
|
|
LONG device_state;
|
2000-07-23 15:39:52 +02:00
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
struct ddraw_surface *primary;
|
2011-10-24 21:24:37 +02:00
|
|
|
RECT primary_lock;
|
2016-01-29 18:48:54 +01:00
|
|
|
struct wined3d_texture *wined3d_frontbuffer;
|
2011-09-19 21:50:24 +02:00
|
|
|
struct wined3d_swapchain *wined3d_swapchain;
|
2011-10-24 21:24:38 +02:00
|
|
|
HWND swapchain_window;
|
2011-09-15 20:01:49 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* DirectDraw things, which are not handled by WineD3D */
|
|
|
|
DWORD cooperative_level;
|
2001-01-04 23:44:55 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* D3D things */
|
|
|
|
HWND d3d_window;
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *d3ddevice;
|
2006-06-24 16:17:10 +02:00
|
|
|
int d3dversion;
|
2000-04-09 16:30:50 +02:00
|
|
|
|
2006-06-23 18:18:02 +02:00
|
|
|
/* Various HWNDs */
|
2006-06-09 19:36:12 +02:00
|
|
|
HWND focuswindow;
|
|
|
|
HWND devicewindow;
|
2008-08-05 21:24:10 +02:00
|
|
|
HWND dest_window;
|
2000-04-09 16:30:50 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* For the dll unload cleanup code */
|
2006-10-09 14:40:30 +02:00
|
|
|
struct list ddraw_list_entry;
|
2006-10-14 21:57:09 +02:00
|
|
|
/* The surface list - can't relay this to WineD3D
|
|
|
|
* because of IParent
|
|
|
|
*/
|
|
|
|
struct list surface_list;
|
2007-04-22 17:55:30 +02:00
|
|
|
|
|
|
|
/* FVF management */
|
|
|
|
struct FvfToDecl *decls;
|
|
|
|
UINT numConvertedDecls, declArraySize;
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
|
|
|
|
2011-12-22 21:51:22 +01:00
|
|
|
#define DDRAW_WINDOW_CLASS_NAME "DirectDrawDeviceWnd"
|
2010-06-18 13:09:50 +02:00
|
|
|
|
2015-04-23 22:41:12 +02:00
|
|
|
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type) DECLSPEC_HIDDEN;
|
2013-09-06 09:57:41 +02:00
|
|
|
void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) DECLSPEC_HIDDEN;
|
2015-12-04 11:30:14 +01:00
|
|
|
void ddraw_update_lost_surfaces(struct ddraw *ddraw) DECLSPEC_HIDDEN;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2012-03-08 20:27:16 +01:00
|
|
|
static inline void ddraw_set_swapchain_window(struct ddraw *ddraw, HWND window)
|
2011-11-17 20:11:40 +01:00
|
|
|
{
|
|
|
|
if (window == GetDesktopWindow())
|
|
|
|
window = NULL;
|
|
|
|
ddraw->swapchain_window = window;
|
|
|
|
}
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Utility functions */
|
2009-09-17 12:35:28 +02:00
|
|
|
void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut) DECLSPEC_HIDDEN;
|
|
|
|
void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut) DECLSPEC_HIDDEN;
|
2012-03-08 20:27:16 +01:00
|
|
|
struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *ddraw, DWORD fvf) DECLSPEC_HIDDEN;
|
2007-04-22 17:55:30 +02:00
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
struct ddraw_surface
|
1999-03-27 17:53:09 +01:00
|
|
|
{
|
2001-01-04 23:44:55 +01:00
|
|
|
/* IUnknown fields */
|
2011-06-05 18:55:04 +02:00
|
|
|
IDirectDrawSurface7 IDirectDrawSurface7_iface;
|
2011-06-06 13:39:04 +02:00
|
|
|
IDirectDrawSurface4 IDirectDrawSurface4_iface;
|
2011-05-31 13:57:04 +02:00
|
|
|
IDirectDrawSurface3 IDirectDrawSurface3_iface;
|
2011-06-09 16:35:15 +02:00
|
|
|
IDirectDrawSurface2 IDirectDrawSurface2_iface;
|
2011-06-09 17:29:36 +02:00
|
|
|
IDirectDrawSurface IDirectDrawSurface_iface;
|
2011-06-08 17:23:17 +02:00
|
|
|
IDirectDrawGammaControl IDirectDrawGammaControl_iface;
|
2011-07-29 17:55:50 +02:00
|
|
|
IDirect3DTexture2 IDirect3DTexture2_iface;
|
2011-07-27 16:45:13 +02:00
|
|
|
IDirect3DTexture IDirect3DTexture_iface;
|
1999-07-03 13:57:29 +02:00
|
|
|
|
2011-06-28 01:53:17 +02:00
|
|
|
LONG ref7, ref4, ref3, ref2, ref1, iface_count, gamma_count;
|
2006-07-10 16:06:33 +02:00
|
|
|
IUnknown *ifaceToRelease;
|
2012-04-01 13:12:03 +02:00
|
|
|
IUnknown *texture_outer;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
int version;
|
1999-04-06 09:10:48 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Connections to other Objects */
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw;
|
2011-03-18 19:10:59 +01:00
|
|
|
struct wined3d_texture *wined3d_texture;
|
2016-01-28 18:40:25 +01:00
|
|
|
unsigned int sub_resource_idx;
|
2014-08-21 09:55:55 +02:00
|
|
|
struct wined3d_rendertarget_view *wined3d_rtv;
|
2014-03-16 20:38:58 +01:00
|
|
|
struct wined3d_private_store private_store;
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *device1;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* This implementation handles attaching surfaces to other surfaces */
|
2012-03-11 22:03:12 +01:00
|
|
|
struct ddraw_surface *next_attached;
|
|
|
|
struct ddraw_surface *first_attached;
|
2011-10-11 21:59:21 +02:00
|
|
|
IUnknown *attached_iface;
|
2007-04-27 15:31:12 +02:00
|
|
|
|
|
|
|
/* Complex surfaces are organized in a tree, although the tree is degenerated to a list in most cases.
|
|
|
|
* In mipmap and primary surfaces each level has only one attachment, which is the next surface level.
|
|
|
|
* Only the cube texture root has 6 surfaces attached, which then have a normal mipmap chain attached
|
|
|
|
* to them. So hardcode the array to 6, a dynamic array or a list would be an overkill.
|
|
|
|
*/
|
|
|
|
#define MAX_COMPLEX_ATTACHED 6
|
2012-03-11 22:03:12 +01:00
|
|
|
struct ddraw_surface *complex_array[MAX_COMPLEX_ATTACHED];
|
2016-08-02 00:10:08 +02:00
|
|
|
/* You can't traverse the tree upwards. Only a flag for Surface::Release because it's needed there,
|
2007-04-27 15:31:12 +02:00
|
|
|
* but no pointer to prevent temptations to traverse it in the wrong direction.
|
|
|
|
*/
|
|
|
|
BOOL is_complex_root;
|
2015-12-04 11:30:14 +01:00
|
|
|
BOOL is_lost;
|
1999-12-04 04:55:58 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Surface description, for GetAttachedSurface */
|
|
|
|
DDSURFACEDESC2 surface_desc;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Clipper objects */
|
2011-12-12 20:53:55 +01:00
|
|
|
struct ddraw_clipper *clipper;
|
2013-12-12 10:23:30 +01:00
|
|
|
struct ddraw_palette *palette;
|
2001-01-04 23:44:55 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* For the ddraw surface list */
|
2006-10-14 21:57:09 +02:00
|
|
|
struct list surface_list_entry;
|
2006-06-16 23:44:33 +02:00
|
|
|
|
|
|
|
DWORD Handle;
|
2016-02-08 18:32:06 +01:00
|
|
|
HDC dc;
|
2006-06-09 19:36:12 +02:00
|
|
|
};
|
2000-04-09 16:30:50 +02:00
|
|
|
|
2013-11-12 11:00:26 +01:00
|
|
|
struct ddraw_texture
|
|
|
|
{
|
|
|
|
unsigned int version;
|
|
|
|
DDSURFACEDESC2 surface_desc;
|
|
|
|
|
|
|
|
struct ddraw_surface *root;
|
2017-01-04 00:04:47 +01:00
|
|
|
struct wined3d_device *wined3d_device;
|
2013-11-12 11:00:26 +01:00
|
|
|
};
|
|
|
|
|
2013-11-28 09:55:42 +01:00
|
|
|
HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc,
|
|
|
|
struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) DECLSPEC_HIDDEN;
|
2014-08-21 09:55:55 +02:00
|
|
|
struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN;
|
2016-01-28 18:40:25 +01:00
|
|
|
void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
|
|
|
|
struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
|
2016-02-12 11:06:07 +01:00
|
|
|
const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
|
2014-06-28 10:49:32 +02:00
|
|
|
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
|
|
|
|
const RECT *rect, BOOL read) DECLSPEC_HIDDEN;
|
2007-05-04 18:31:14 +02:00
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
static inline struct ddraw_surface *impl_from_IDirect3DTexture(IDirect3DTexture *iface)
|
2009-01-22 10:33:37 +01:00
|
|
|
{
|
2012-03-11 22:03:12 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture_iface);
|
2009-01-22 10:33:37 +01:00
|
|
|
}
|
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
static inline struct ddraw_surface *impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface)
|
2009-01-22 10:33:37 +01:00
|
|
|
{
|
2012-03-11 22:03:12 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture2_iface);
|
2009-01-22 10:33:37 +01:00
|
|
|
}
|
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
static inline struct ddraw_surface *impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
|
2011-06-09 17:29:36 +02:00
|
|
|
{
|
2012-03-11 22:03:12 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface_iface);
|
2011-06-09 17:29:36 +02:00
|
|
|
}
|
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
static inline struct ddraw_surface *impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface)
|
2011-06-09 16:35:15 +02:00
|
|
|
{
|
2012-03-11 22:03:12 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface2_iface);
|
2011-06-09 16:35:15 +02:00
|
|
|
}
|
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
static inline struct ddraw_surface *impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface)
|
2009-01-22 10:33:37 +01:00
|
|
|
{
|
2012-03-11 22:03:12 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface3_iface);
|
2009-01-22 10:33:37 +01:00
|
|
|
}
|
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
static inline struct ddraw_surface *impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface)
|
2011-06-06 13:39:04 +02:00
|
|
|
{
|
2012-03-11 22:03:12 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface4_iface);
|
2011-06-06 13:39:04 +02:00
|
|
|
}
|
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
static inline struct ddraw_surface *impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
|
2011-06-06 12:57:55 +02:00
|
|
|
{
|
2012-03-11 22:03:12 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface7_iface);
|
2011-06-06 12:57:55 +02:00
|
|
|
}
|
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface) DECLSPEC_HIDDEN;
|
2011-05-31 14:49:37 +02:00
|
|
|
|
2012-03-11 22:03:12 +01:00
|
|
|
struct ddraw_surface *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct ddraw_surface *unsafe_impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface) DECLSPEC_HIDDEN;
|
2011-07-27 16:43:24 +02:00
|
|
|
|
2010-07-29 12:56:57 +02:00
|
|
|
#define DDRAW_INVALID_HANDLE ~0U
|
|
|
|
|
|
|
|
enum ddraw_handle_type
|
|
|
|
{
|
|
|
|
DDRAW_HANDLE_FREE,
|
|
|
|
DDRAW_HANDLE_MATERIAL,
|
2010-07-29 12:56:58 +02:00
|
|
|
DDRAW_HANDLE_MATRIX,
|
2010-07-30 10:15:23 +02:00
|
|
|
DDRAW_HANDLE_STATEBLOCK,
|
2010-07-30 10:15:24 +02:00
|
|
|
DDRAW_HANDLE_SURFACE,
|
2010-07-29 12:56:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ddraw_handle_entry
|
|
|
|
{
|
|
|
|
void *object;
|
|
|
|
enum ddraw_handle_type type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ddraw_handle_table
|
|
|
|
{
|
|
|
|
struct ddraw_handle_entry *entries;
|
|
|
|
struct ddraw_handle_entry *free_entries;
|
|
|
|
UINT table_size;
|
|
|
|
UINT entry_count;
|
|
|
|
};
|
|
|
|
|
|
|
|
BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size) DECLSPEC_HIDDEN;
|
|
|
|
void ddraw_handle_table_destroy(struct ddraw_handle_table *t) DECLSPEC_HIDDEN;
|
|
|
|
DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddraw_handle_type type) DECLSPEC_HIDDEN;
|
|
|
|
void *ddraw_free_handle(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type) DECLSPEC_HIDDEN;
|
|
|
|
void *ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type) DECLSPEC_HIDDEN;
|
|
|
|
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
|
|
|
/* IUnknown */
|
2011-10-17 15:58:51 +02:00
|
|
|
IDirect3DDevice7 IDirect3DDevice7_iface;
|
2011-10-17 15:58:11 +02:00
|
|
|
IDirect3DDevice3 IDirect3DDevice3_iface;
|
2011-10-17 15:57:46 +02:00
|
|
|
IDirect3DDevice2 IDirect3DDevice2_iface;
|
2011-10-17 15:57:11 +02:00
|
|
|
IDirect3DDevice IDirect3DDevice_iface;
|
2012-04-05 19:55:35 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2012-04-03 21:15:12 +02:00
|
|
|
LONG ref;
|
|
|
|
UINT version;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2012-04-05 19:55:35 +02:00
|
|
|
IUnknown *outer_unknown;
|
2011-05-16 23:01:22 +02:00
|
|
|
struct wined3d_device *wined3d_device;
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw;
|
2013-09-17 09:22:36 +02:00
|
|
|
IUnknown *rt_iface;
|
2012-12-18 10:44:59 +01:00
|
|
|
|
2012-12-18 10:44:58 +01:00
|
|
|
struct wined3d_buffer *index_buffer;
|
|
|
|
UINT index_buffer_size;
|
|
|
|
UINT index_buffer_pos;
|
2012-12-18 10:44:59 +01:00
|
|
|
|
|
|
|
struct wined3d_buffer *vertex_buffer;
|
|
|
|
UINT vertex_buffer_size;
|
|
|
|
UINT vertex_buffer_pos;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
/* Viewport management */
|
2011-04-19 20:05:52 +02:00
|
|
|
struct list viewport_list;
|
2012-03-14 22:04:32 +01:00
|
|
|
struct d3d_viewport *current_viewport;
|
2006-06-09 19:36:12 +02:00
|
|
|
D3DVIEWPORT7 active_viewport;
|
|
|
|
|
2008-05-05 19:09:40 +02:00
|
|
|
/* Required to keep track which of two available texture blending modes in d3ddevice3 is used */
|
|
|
|
BOOL legacyTextureBlending;
|
2012-01-17 21:13:32 +01:00
|
|
|
|
2011-12-21 21:34:56 +01:00
|
|
|
D3DMATRIX legacy_projection;
|
|
|
|
D3DMATRIX legacy_clipspace;
|
2008-05-05 19:09:40 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Light state */
|
|
|
|
DWORD material;
|
|
|
|
|
|
|
|
/* Rendering functions to wrap D3D(1-3) to D3D7 */
|
|
|
|
D3DPRIMITIVETYPE primitive_type;
|
|
|
|
DWORD vertex_type;
|
|
|
|
DWORD render_flags;
|
|
|
|
DWORD nb_vertices;
|
2013-09-11 08:47:52 +02:00
|
|
|
BYTE *sysmem_vertex_buffer;
|
2006-06-09 19:36:12 +02:00
|
|
|
DWORD vertex_size;
|
|
|
|
DWORD buffer_size;
|
2006-06-16 23:44:33 +02:00
|
|
|
|
|
|
|
/* Handle management */
|
2010-07-29 12:56:57 +02:00
|
|
|
struct ddraw_handle_table handle_table;
|
2007-07-01 23:28:21 +02:00
|
|
|
D3DMATRIXHANDLE world, proj, view;
|
2006-06-09 19:36:12 +02:00
|
|
|
};
|
2004-08-02 20:24:40 +02:00
|
|
|
|
2013-09-17 09:22:36 +02:00
|
|
|
HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface,
|
2012-04-09 20:43:40 +02:00
|
|
|
UINT version, struct d3d_device **device, IUnknown *outer_unknown) DECLSPEC_HIDDEN;
|
|
|
|
enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device *device) DECLSPEC_HIDDEN;
|
2004-08-02 20:24:40 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* The IID */
|
2009-09-17 12:35:28 +02:00
|
|
|
extern const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN;
|
2000-04-09 16:30:50 +02:00
|
|
|
|
2012-04-09 20:43:40 +02:00
|
|
|
static inline struct d3d_device *impl_from_IDirect3DDevice(IDirect3DDevice *iface)
|
2009-01-22 10:33:37 +01:00
|
|
|
{
|
2012-04-09 20:43:40 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice_iface);
|
2009-01-22 10:33:37 +01:00
|
|
|
}
|
|
|
|
|
2012-04-09 20:43:40 +02:00
|
|
|
static inline struct d3d_device *impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface)
|
2009-01-22 10:33:37 +01:00
|
|
|
{
|
2012-04-09 20:43:40 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice2_iface);
|
2009-01-22 10:33:37 +01:00
|
|
|
}
|
|
|
|
|
2012-04-09 20:43:40 +02:00
|
|
|
static inline struct d3d_device *impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface)
|
2009-01-22 10:33:37 +01:00
|
|
|
{
|
2012-04-09 20:43:40 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice3_iface);
|
2009-01-22 10:33:37 +01:00
|
|
|
}
|
|
|
|
|
2012-04-09 20:43:40 +02:00
|
|
|
static inline struct d3d_device *impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface)
|
2011-10-17 15:58:40 +02:00
|
|
|
{
|
2012-04-09 20:43:40 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice7_iface);
|
2011-10-17 15:58:40 +02:00
|
|
|
}
|
|
|
|
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *unsafe_impl_from_IDirect3DDevice(IDirect3DDevice *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_device *unsafe_impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_device *unsafe_impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_device *unsafe_impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface) DECLSPEC_HIDDEN;
|
2011-10-17 15:56:43 +02:00
|
|
|
|
2011-12-12 20:53:55 +01:00
|
|
|
struct ddraw_clipper
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
2011-06-20 11:20:41 +02:00
|
|
|
IDirectDrawClipper IDirectDrawClipper_iface;
|
2006-06-09 19:36:12 +02:00
|
|
|
LONG ref;
|
2011-12-12 20:53:55 +01:00
|
|
|
HWND window;
|
2012-01-06 11:20:04 +01:00
|
|
|
HRGN region;
|
2010-07-19 12:47:57 +02:00
|
|
|
BOOL initialized;
|
2006-06-09 19:36:12 +02:00
|
|
|
};
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2011-12-12 20:53:55 +01:00
|
|
|
HRESULT ddraw_clipper_init(struct ddraw_clipper *clipper) DECLSPEC_HIDDEN;
|
|
|
|
struct ddraw_clipper *unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *iface) DECLSPEC_HIDDEN;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2006-06-09 19:36:12 +02:00
|
|
|
* IDirectDrawPalette implementation structure
|
|
|
|
*****************************************************************************/
|
2012-03-12 19:56:10 +01:00
|
|
|
struct ddraw_palette
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2011-10-04 00:14:27 +02:00
|
|
|
IDirectDrawPalette IDirectDrawPalette_iface;
|
2006-06-09 19:36:12 +02:00
|
|
|
LONG ref;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2016-08-26 13:51:21 +02:00
|
|
|
struct wined3d_palette *wined3d_palette;
|
2013-12-13 09:07:45 +01:00
|
|
|
struct ddraw *ddraw;
|
2013-12-12 10:23:32 +01:00
|
|
|
IUnknown *ifaceToRelease;
|
|
|
|
DWORD flags;
|
2006-06-09 19:36:12 +02:00
|
|
|
};
|
2010-08-19 18:57:46 +02:00
|
|
|
|
2012-03-12 19:56:10 +01:00
|
|
|
static inline struct ddraw_palette *impl_from_IDirectDrawPalette(IDirectDrawPalette *iface)
|
2011-10-04 00:14:27 +02:00
|
|
|
{
|
2012-03-12 19:56:10 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct ddraw_palette, IDirectDrawPalette_iface);
|
2011-10-04 00:14:27 +02:00
|
|
|
}
|
|
|
|
|
2012-03-12 19:56:10 +01:00
|
|
|
struct ddraw_palette *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface) DECLSPEC_HIDDEN;
|
2011-10-04 00:14:08 +02:00
|
|
|
|
2012-03-12 19:56:10 +01:00
|
|
|
HRESULT ddraw_palette_init(struct ddraw_palette *palette,
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries) DECLSPEC_HIDDEN;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Helper structures */
|
|
|
|
struct object_creation_info
|
|
|
|
{
|
|
|
|
const CLSID *clsid;
|
|
|
|
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID riid,
|
|
|
|
void **ppObj);
|
|
|
|
};
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* IDirect3DLight implementation structure - Wraps to D3D7
|
|
|
|
******************************************************************************/
|
2012-03-13 20:31:37 +01:00
|
|
|
struct d3d_light
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
2011-06-09 11:53:52 +02:00
|
|
|
IDirect3DLight IDirect3DLight_iface;
|
2006-06-09 19:36:12 +02:00
|
|
|
LONG ref;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* IDirect3DLight fields */
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* If this light is active for one viewport, put the viewport here */
|
2012-03-14 22:04:32 +01:00
|
|
|
struct d3d_viewport *active_viewport;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
D3DLIGHT2 light;
|
|
|
|
D3DLIGHT7 light7;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
DWORD dwLightIndex;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2011-04-21 22:39:28 +02:00
|
|
|
struct list entry;
|
2006-06-09 19:36:12 +02:00
|
|
|
};
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Helper functions */
|
2012-03-13 20:31:37 +01:00
|
|
|
void light_activate(struct d3d_light *light) DECLSPEC_HIDDEN;
|
|
|
|
void light_deactivate(struct d3d_light *light) DECLSPEC_HIDDEN;
|
|
|
|
void d3d_light_init(struct d3d_light *light, struct ddraw *ddraw) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_light *unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface) DECLSPEC_HIDDEN;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* IDirect3DMaterial implementation structure - Wraps to D3D7
|
|
|
|
******************************************************************************/
|
2012-03-15 21:49:58 +01:00
|
|
|
struct d3d_material
|
2005-06-02 12:33:06 +02:00
|
|
|
{
|
2011-06-08 17:38:16 +02:00
|
|
|
IDirect3DMaterial3 IDirect3DMaterial3_iface;
|
2011-06-07 09:44:03 +02:00
|
|
|
IDirect3DMaterial2 IDirect3DMaterial2_iface;
|
2011-06-07 09:54:33 +02:00
|
|
|
IDirect3DMaterial IDirect3DMaterial_iface;
|
2006-06-09 19:36:12 +02:00
|
|
|
LONG ref;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* IDirect3DMaterial2 fields */
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw;
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *active_device;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
D3DMATERIAL mat;
|
2006-06-16 23:44:33 +02:00
|
|
|
DWORD Handle;
|
2006-06-09 19:36:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Helper functions */
|
2012-03-15 21:49:58 +01:00
|
|
|
void material_activate(struct d3d_material *material) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_material *d3d_material_create(struct ddraw *ddraw) DECLSPEC_HIDDEN;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2006-06-09 19:36:12 +02:00
|
|
|
* IDirect3DViewport - Wraps to D3D7
|
|
|
|
*****************************************************************************/
|
2012-03-14 22:04:32 +01:00
|
|
|
struct d3d_viewport
|
2005-06-02 12:33:06 +02:00
|
|
|
{
|
2011-10-04 00:14:51 +02:00
|
|
|
IDirect3DViewport3 IDirect3DViewport3_iface;
|
2006-06-09 19:36:12 +02:00
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
/* IDirect3DViewport fields */
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
/* If this viewport is active for one device, put the device here */
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *active_device;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
DWORD num_lights;
|
|
|
|
DWORD map_lights;
|
|
|
|
|
|
|
|
int use_vp2;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
D3DVIEWPORT vp1;
|
|
|
|
D3DVIEWPORT2 vp2;
|
|
|
|
} viewports;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2011-04-19 20:05:52 +02:00
|
|
|
struct list entry;
|
2011-04-21 22:39:28 +02:00
|
|
|
struct list light_list;
|
2012-03-15 21:49:58 +01:00
|
|
|
struct d3d_material *background;
|
2005-06-02 12:33:06 +02:00
|
|
|
};
|
|
|
|
|
2012-03-14 22:04:32 +01:00
|
|
|
struct d3d_viewport *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_viewport *unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_viewport *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface) DECLSPEC_HIDDEN;
|
2011-10-04 00:14:37 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Helper functions */
|
2012-03-14 22:04:32 +01:00
|
|
|
void viewport_activate(struct d3d_viewport *viewport, BOOL ignore_lights) DECLSPEC_HIDDEN;
|
|
|
|
void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw) DECLSPEC_HIDDEN;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2006-06-09 19:36:12 +02:00
|
|
|
* IDirect3DExecuteBuffer - Wraps to D3D7
|
|
|
|
*****************************************************************************/
|
2012-04-10 22:06:21 +02:00
|
|
|
struct d3d_execute_buffer
|
2005-06-02 12:33:06 +02:00
|
|
|
{
|
2011-07-08 12:26:57 +02:00
|
|
|
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface;
|
|
|
|
LONG ref;
|
2006-06-09 19:36:12 +02:00
|
|
|
/* IDirect3DExecuteBuffer fields */
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw;
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *d3ddev;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
D3DEXECUTEBUFFERDESC desc;
|
|
|
|
D3DEXECUTEDATA data;
|
|
|
|
|
|
|
|
/* This buffer will store the transformed vertices */
|
2016-11-13 22:12:45 +01:00
|
|
|
unsigned int index_size, index_pos;
|
2016-11-13 22:12:46 +01:00
|
|
|
unsigned int vertex_size, src_vertex_pos;
|
2016-11-13 22:12:44 +01:00
|
|
|
struct wined3d_buffer *src_vertex_buffer, *dst_vertex_buffer, *index_buffer;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
/* This flags is set to TRUE if we allocated ourselves the
|
|
|
|
* data buffer
|
|
|
|
*/
|
|
|
|
BOOL need_free;
|
2005-06-02 12:33:06 +02:00
|
|
|
};
|
|
|
|
|
2012-04-10 22:06:21 +02:00
|
|
|
HRESULT d3d_execute_buffer_init(struct d3d_execute_buffer *execute_buffer,
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc) DECLSPEC_HIDDEN;
|
2012-04-10 22:06:21 +02:00
|
|
|
struct d3d_execute_buffer *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface) DECLSPEC_HIDDEN;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
/* The execute function */
|
2012-04-10 22:06:21 +02:00
|
|
|
HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *execute_buffer,
|
2012-04-09 20:43:40 +02:00
|
|
|
struct d3d_device *device, struct d3d_viewport *viewport) DECLSPEC_HIDDEN;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2006-06-09 19:36:12 +02:00
|
|
|
* IDirect3DVertexBuffer
|
|
|
|
*****************************************************************************/
|
2012-04-11 22:52:04 +02:00
|
|
|
struct d3d_vertex_buffer
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBuffer7 IDirect3DVertexBuffer7_iface;
|
2011-06-15 12:46:31 +02:00
|
|
|
LONG ref;
|
2017-02-24 19:37:26 +01:00
|
|
|
unsigned int version;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2007-01-06 18:26:08 +01:00
|
|
|
/*** WineD3D and ddraw links ***/
|
2016-08-26 13:51:22 +02:00
|
|
|
struct wined3d_buffer *wined3d_buffer;
|
2016-08-26 13:51:23 +02:00
|
|
|
struct wined3d_vertex_declaration *wined3d_declaration;
|
2012-03-08 20:27:16 +01:00
|
|
|
struct ddraw *ddraw;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*** Storage for D3D7 specific things ***/
|
|
|
|
DWORD Caps;
|
2009-04-06 14:09:54 +02:00
|
|
|
DWORD fvf;
|
2012-12-04 09:36:16 +01:00
|
|
|
DWORD size;
|
|
|
|
BOOL dynamic;
|
2005-06-02 12:33:06 +02:00
|
|
|
};
|
|
|
|
|
2012-04-11 22:52:04 +02:00
|
|
|
HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw,
|
2011-06-15 12:36:49 +02:00
|
|
|
D3DVERTEXBUFFERDESC *desc) DECLSPEC_HIDDEN;
|
2012-04-11 22:52:04 +02:00
|
|
|
struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface) DECLSPEC_HIDDEN;
|
|
|
|
struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface) DECLSPEC_HIDDEN;
|
2005-06-02 12:33:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2006-06-09 19:36:12 +02:00
|
|
|
* Helper functions from utils.c
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#define GET_TEXCOUNT_FROM_FVF(d3dvtVertexType) \
|
|
|
|
(((d3dvtVertexType) & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT)
|
|
|
|
|
|
|
|
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
|
|
|
|
(((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
|
|
|
|
|
2013-06-07 10:17:55 +02:00
|
|
|
void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format,
|
|
|
|
enum wined3d_format_id wined3d_format) DECLSPEC_HIDDEN;
|
2013-06-07 10:17:54 +02:00
|
|
|
enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format) DECLSPEC_HIDDEN;
|
2009-09-17 12:35:28 +02:00
|
|
|
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN;
|
|
|
|
void dump_D3DMATRIX(const D3DMATRIX *mat) DECLSPEC_HIDDEN;
|
|
|
|
void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps) DECLSPEC_HIDDEN;
|
|
|
|
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN;
|
|
|
|
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in) DECLSPEC_HIDDEN;
|
|
|
|
void DDRAW_dump_cooperativelevel(DWORD cooplevel) DECLSPEC_HIDDEN;
|
2011-08-26 14:22:40 +02:00
|
|
|
void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out) DECLSPEC_HIDDEN;
|
2011-08-28 15:00:59 +02:00
|
|
|
void DDSD2_to_DDSD(const DDSURFACEDESC2 *in, DDSURFACEDESC *out) DECLSPEC_HIDDEN;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2013-01-04 12:02:57 +01:00
|
|
|
void multiply_matrix(D3DMATRIX *dst, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2014-06-12 11:52:31 +02:00
|
|
|
static inline BOOL format_is_compressed(const DDPIXELFORMAT *format)
|
|
|
|
{
|
|
|
|
return (format->dwFlags & DDPF_FOURCC) && (format->dwFourCC == WINED3DFMT_DXT1
|
|
|
|
|| format->dwFourCC == WINED3DFMT_DXT2 || format->dwFourCC == WINED3DFMT_DXT3
|
|
|
|
|| format->dwFourCC == WINED3DFMT_DXT4 || format->dwFourCC == WINED3DFMT_DXT5);
|
|
|
|
}
|
|
|
|
|
2014-05-15 16:13:31 +02:00
|
|
|
static inline BOOL format_is_paletteindexed(const DDPIXELFORMAT *fmt)
|
|
|
|
{
|
|
|
|
DWORD flags = DDPF_PALETTEINDEXED1 | DDPF_PALETTEINDEXED2 | DDPF_PALETTEINDEXED4
|
|
|
|
| DDPF_PALETTEINDEXED8 | DDPF_PALETTEINDEXEDTO8;
|
|
|
|
return !!(fmt->dwFlags & flags);
|
|
|
|
}
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Used for generic dumping */
|
2012-05-02 21:47:56 +02:00
|
|
|
struct flag_info
|
2005-06-02 12:33:06 +02:00
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
DWORD val;
|
2012-05-02 21:47:56 +02:00
|
|
|
const char *name;
|
|
|
|
};
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
#define FE(x) { x, #x }
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2012-05-03 21:49:35 +02:00
|
|
|
struct member_info
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
|
|
|
DWORD val;
|
2012-05-03 21:49:35 +02:00
|
|
|
const char *name;
|
2006-06-09 19:36:12 +02:00
|
|
|
void (*func)(const void *);
|
|
|
|
ptrdiff_t offset;
|
2012-05-03 21:49:35 +02:00
|
|
|
};
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Structure copy */
|
|
|
|
#define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }
|
2005-06-02 12:33:06 +02:00
|
|
|
|
2017-01-17 12:26:37 +01:00
|
|
|
#define DD_STRUCT_COPY_BYSIZE_(to,from,to_size,from_size) \
|
2011-05-23 23:58:36 +02:00
|
|
|
do { \
|
|
|
|
DWORD __size = (to)->dwSize; \
|
2017-01-17 12:26:37 +01:00
|
|
|
DWORD __resetsize = min(to_size, sizeof(*to)); \
|
2011-06-28 18:41:21 +02:00
|
|
|
DWORD __copysize = min(__resetsize, from_size); \
|
2011-05-23 23:58:36 +02:00
|
|
|
assert(to != from); \
|
|
|
|
memcpy(to, from, __copysize); \
|
2011-06-28 18:41:21 +02:00
|
|
|
memset((char*)(to) + __copysize, 0, __resetsize - __copysize); \
|
2011-05-23 23:58:36 +02:00
|
|
|
(to)->dwSize = __size; /* restore size */ \
|
|
|
|
} while (0)
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2017-01-17 12:26:37 +01:00
|
|
|
#define DD_STRUCT_COPY_BYSIZE(to,from) DD_STRUCT_COPY_BYSIZE_(to,from,(to)->dwSize,(from)->dwSize)
|
2011-05-23 23:58:46 +02:00
|
|
|
|
2011-05-23 23:58:53 +02:00
|
|
|
HRESULT hr_ddraw_from_wined3d(HRESULT hr) DECLSPEC_HIDDEN;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
#endif
|