ReactOS 0.4.16-dev-87-g3dfbe52
ddraw_private.h File Reference
#include <assert.h>
#include <limits.h>
#include "wine/debug.h"
#include "wine/heap.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "d3d.h"
#include "ddraw.h"
#include "wine/list.h"
#include "wine/wined3d.h"
Include dependency graph for ddraw_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FvfToDecl
 
struct  ddraw
 
struct  ddraw_surface
 
struct  ddraw_texture
 
struct  ddraw_handle_entry
 
struct  ddraw_handle_table
 
struct  d3d_device
 
struct  ddraw_clipper
 
struct  ddraw_palette
 
struct  object_creation_info
 
struct  d3d_light
 
struct  d3d_material
 
struct  d3d_viewport
 
struct  d3d_execute_buffer
 
struct  d3d_vertex_buffer
 
struct  flag_info
 
struct  member_info
 

Macros

#define COBJMACROS
 
#define NONAMELESSSTRUCT
 
#define NONAMELESSUNION
 
#define DDRAW_INITIALIZED   0x00000001
 
#define DDRAW_D3D_INITIALIZED   0x00000002
 
#define DDRAW_RESTORE_MODE   0x00000004
 
#define DDRAW_NO3D   0x00000008
 
#define DDRAW_SCL_DDRAW1   0x00000010
 
#define DDRAW_SCL_RECURSIVE   0x00000020
 
#define DDRAW_GDI_FLIP   0x00000040
 
#define DDRAW_STRIDE_ALIGNMENT   8
 
#define DDRAW_WINED3D_FLAGS
 
#define DDRAW_WINDOW_CLASS_NAME   "DirectDrawDeviceWnd"
 
#define MAX_COMPLEX_ATTACHED   6
 
#define DDRAW_INVALID_HANDLE   ~0U
 
#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)
 
#define FE(x)   { x, #x }
 
#define ME(x, f, e)   { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }
 
#define DD_STRUCT_COPY_BYSIZE_(to, from, to_size, from_size)
 
#define DD_STRUCT_COPY_BYSIZE(to, from)   DD_STRUCT_COPY_BYSIZE_(to,from,(to)->dwSize,(from)->dwSize)
 

Enumerations

enum  ddraw_device_state { DDRAW_DEVICE_STATE_OK , DDRAW_DEVICE_STATE_LOST , DDRAW_DEVICE_STATE_NOT_RESTORED }
 
enum  ddraw_handle_type {
  DDRAW_HANDLE_FREE , DDRAW_HANDLE_MATERIAL , DDRAW_HANDLE_MATRIX , DDRAW_HANDLE_STATEBLOCK ,
  DDRAW_HANDLE_SURFACE
}
 

Functions

HRESULT ddraw_init (struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type) DECLSPEC_HIDDEN
 
void ddraw_d3dcaps1_from_7 (D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7) DECLSPEC_HIDDEN
 
HRESULT ddraw_get_d3dcaps (const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) DECLSPEC_HIDDEN
 
void ddraw_update_lost_surfaces (struct ddraw *ddraw) DECLSPEC_HIDDEN
 
static void ddraw_set_swapchain_window (struct ddraw *ddraw, HWND window)
 
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
 
struct wined3d_vertex_declarationddraw_find_decl (struct ddraw *ddraw, DWORD fvf) DECLSPEC_HIDDEN
 
HRESULT ddraw_surface_create (struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) DECLSPEC_HIDDEN
 
struct wined3d_rendertarget_viewddraw_surface_get_rendertarget_view (struct ddraw_surface *surface) DECLSPEC_HIDDEN
 
void ddraw_surface_init (struct ddraw_surface *surface, struct ddraw *ddraw, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN
 
HRESULT ddraw_surface_update_frontbuffer (struct ddraw_surface *surface, const RECT *rect, BOOL read) DECLSPEC_HIDDEN
 
static struct ddraw_surfaceimpl_from_IDirect3DTexture (IDirect3DTexture *iface)
 
static struct ddraw_surfaceimpl_from_IDirect3DTexture2 (IDirect3DTexture2 *iface)
 
static struct ddraw_surfaceimpl_from_IDirectDrawSurface (IDirectDrawSurface *iface)
 
static struct ddraw_surfaceimpl_from_IDirectDrawSurface2 (IDirectDrawSurface2 *iface)
 
static struct ddraw_surfaceimpl_from_IDirectDrawSurface3 (IDirectDrawSurface3 *iface)
 
static struct ddraw_surfaceimpl_from_IDirectDrawSurface4 (IDirectDrawSurface4 *iface)
 
static struct ddraw_surfaceimpl_from_IDirectDrawSurface7 (IDirectDrawSurface7 *iface)
 
struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface (IDirectDrawSurface *iface) DECLSPEC_HIDDEN
 
struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface4 (IDirectDrawSurface4 *iface) DECLSPEC_HIDDEN
 
struct ddraw_surfaceunsafe_impl_from_IDirectDrawSurface7 (IDirectDrawSurface7 *iface) DECLSPEC_HIDDEN
 
struct ddraw_surfaceunsafe_impl_from_IDirect3DTexture (IDirect3DTexture *iface) DECLSPEC_HIDDEN
 
struct ddraw_surfaceunsafe_impl_from_IDirect3DTexture2 (IDirect3DTexture2 *iface) DECLSPEC_HIDDEN
 
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
 
voidddraw_free_handle (struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type) DECLSPEC_HIDDEN
 
voidddraw_get_object (struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type) DECLSPEC_HIDDEN
 
HRESULT d3d_device_create (struct ddraw *ddraw, const GUID *guid, struct ddraw_surface *target, IUnknown *rt_iface, 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
 
static struct d3d_deviceimpl_from_IDirect3DDevice (IDirect3DDevice *iface)
 
static struct d3d_deviceimpl_from_IDirect3DDevice2 (IDirect3DDevice2 *iface)
 
static struct d3d_deviceimpl_from_IDirect3DDevice3 (IDirect3DDevice3 *iface)
 
static struct d3d_deviceimpl_from_IDirect3DDevice7 (IDirect3DDevice7 *iface)
 
struct d3d_deviceunsafe_impl_from_IDirect3DDevice (IDirect3DDevice *iface) DECLSPEC_HIDDEN
 
struct d3d_deviceunsafe_impl_from_IDirect3DDevice2 (IDirect3DDevice2 *iface) DECLSPEC_HIDDEN
 
struct d3d_deviceunsafe_impl_from_IDirect3DDevice3 (IDirect3DDevice3 *iface) DECLSPEC_HIDDEN
 
struct d3d_deviceunsafe_impl_from_IDirect3DDevice7 (IDirect3DDevice7 *iface) DECLSPEC_HIDDEN
 
HRESULT ddraw_clipper_init (struct ddraw_clipper *clipper) DECLSPEC_HIDDEN
 
struct ddraw_clipperunsafe_impl_from_IDirectDrawClipper (IDirectDrawClipper *iface) DECLSPEC_HIDDEN
 
static struct ddraw_paletteimpl_from_IDirectDrawPalette (IDirectDrawPalette *iface)
 
struct ddraw_paletteunsafe_impl_from_IDirectDrawPalette (IDirectDrawPalette *iface) DECLSPEC_HIDDEN
 
HRESULT ddraw_palette_init (struct ddraw_palette *palette, struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries) DECLSPEC_HIDDEN
 
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_lightunsafe_impl_from_IDirect3DLight (IDirect3DLight *iface) DECLSPEC_HIDDEN
 
void material_activate (struct d3d_material *material) DECLSPEC_HIDDEN
 
struct d3d_materiald3d_material_create (struct ddraw *ddraw) DECLSPEC_HIDDEN
 
struct d3d_viewportunsafe_impl_from_IDirect3DViewport3 (IDirect3DViewport3 *iface) DECLSPEC_HIDDEN
 
struct d3d_viewportunsafe_impl_from_IDirect3DViewport2 (IDirect3DViewport2 *iface) DECLSPEC_HIDDEN
 
struct d3d_viewportunsafe_impl_from_IDirect3DViewport (IDirect3DViewport *iface) DECLSPEC_HIDDEN
 
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
 
HRESULT d3d_execute_buffer_init (struct d3d_execute_buffer *execute_buffer, struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc) DECLSPEC_HIDDEN
 
struct d3d_execute_bufferunsafe_impl_from_IDirect3DExecuteBuffer (IDirect3DExecuteBuffer *iface) DECLSPEC_HIDDEN
 
HRESULT d3d_execute_buffer_execute (struct d3d_execute_buffer *execute_buffer, struct d3d_device *device, struct d3d_viewport *viewport) DECLSPEC_HIDDEN
 
HRESULT d3d_vertex_buffer_create (struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc) DECLSPEC_HIDDEN
 
struct d3d_vertex_bufferunsafe_impl_from_IDirect3DVertexBuffer (IDirect3DVertexBuffer *iface) DECLSPEC_HIDDEN
 
struct d3d_vertex_bufferunsafe_impl_from_IDirect3DVertexBuffer7 (IDirect3DVertexBuffer7 *iface) DECLSPEC_HIDDEN
 
void ddrawformat_from_wined3dformat (DDPIXELFORMAT *ddraw_format, enum wined3d_format_id wined3d_format) DECLSPEC_HIDDEN
 
BOOL wined3d_colour_from_ddraw_colour (const DDPIXELFORMAT *pf, const struct ddraw_palette *palette, DWORD colour, struct wined3d_color *wined3d_colour) DECLSPEC_HIDDEN
 
enum wined3d_format_id wined3dformat_from_ddrawformat (const DDPIXELFORMAT *format) DECLSPEC_HIDDEN
 
unsigned int wined3dmapflags_from_ddrawmapflags (unsigned int flags) DECLSPEC_HIDDEN
 
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
 
void DDSD_to_DDSD2 (const DDSURFACEDESC *in, DDSURFACEDESC2 *out) DECLSPEC_HIDDEN
 
void DDSD2_to_DDSD (const DDSURFACEDESC2 *in, DDSURFACEDESC *out) DECLSPEC_HIDDEN
 
void multiply_matrix (D3DMATRIX *dst, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN
 
static BOOL format_is_compressed (const DDPIXELFORMAT *format)
 
static BOOL format_is_paletteindexed (const DDPIXELFORMAT *fmt)
 
HRESULT hr_ddraw_from_wined3d (HRESULT hr) DECLSPEC_HIDDEN
 

Variables

const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file ddraw_private.h.

◆ DD_STRUCT_COPY_BYSIZE

#define DD_STRUCT_COPY_BYSIZE (   to,
  from 
)    DD_STRUCT_COPY_BYSIZE_(to,from,(to)->dwSize,(from)->dwSize)

Definition at line 647 of file ddraw_private.h.

◆ DD_STRUCT_COPY_BYSIZE_

#define DD_STRUCT_COPY_BYSIZE_ (   to,
  from,
  to_size,
  from_size 
)
Value:
do { \
DWORD __size = (to)->dwSize; \
DWORD __resetsize = min(to_size, sizeof(*to)); \
DWORD __copysize = min(__resetsize, from_size); \
assert(to != from); \
memcpy(to, from, __copysize); \
memset((char*)(to) + __copysize, 0, __resetsize - __copysize); \
(to)->dwSize = __size; /* restore size */ \
} while (0)
unsigned long DWORD
Definition: ntddk_ex.h:95
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define min(a, b)
Definition: monoChain.cc:55
CardRegion * from
Definition: spigame.cpp:19

Definition at line 636 of file ddraw_private.h.

◆ DDRAW_D3D_INITIALIZED

#define DDRAW_D3D_INITIALIZED   0x00000002

Definition at line 55 of file ddraw_private.h.

◆ DDRAW_GDI_FLIP

#define DDRAW_GDI_FLIP   0x00000040

Definition at line 60 of file ddraw_private.h.

◆ DDRAW_INITIALIZED

#define DDRAW_INITIALIZED   0x00000001

Definition at line 54 of file ddraw_private.h.

◆ DDRAW_INVALID_HANDLE

#define DDRAW_INVALID_HANDLE   ~0U

Definition at line 265 of file ddraw_private.h.

◆ DDRAW_NO3D

#define DDRAW_NO3D   0x00000008

Definition at line 57 of file ddraw_private.h.

◆ DDRAW_RESTORE_MODE

#define DDRAW_RESTORE_MODE   0x00000004

Definition at line 56 of file ddraw_private.h.

◆ DDRAW_SCL_DDRAW1

#define DDRAW_SCL_DDRAW1   0x00000010

Definition at line 58 of file ddraw_private.h.

◆ DDRAW_SCL_RECURSIVE

#define DDRAW_SCL_RECURSIVE   0x00000020

Definition at line 59 of file ddraw_private.h.

◆ DDRAW_STRIDE_ALIGNMENT

#define DDRAW_STRIDE_ALIGNMENT   8

Definition at line 62 of file ddraw_private.h.

◆ DDRAW_WINDOW_CLASS_NAME

#define DDRAW_WINDOW_CLASS_NAME   "DirectDrawDeviceWnd"

Definition at line 128 of file ddraw_private.h.

◆ DDRAW_WINED3D_FLAGS

#define DDRAW_WINED3D_FLAGS
Value:
#define WINED3D_RESTORE_MODE_ON_ACTIVATE
Definition: wined3d.h:1319
#define WINED3D_LIMIT_VIEWPORT
Definition: wined3d.h:1330
#define WINED3D_VIDMEM_ACCOUNTING
Definition: wined3d.h:1317
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1325
#define WINED3D_NO_PRIMITIVE_RESTART
Definition: wined3d.h:1326
#define WINED3D_LEGACY_DEPTH_BIAS
Definition: wined3d.h:1315
#define WINED3D_FOCUS_MESSAGES
Definition: wined3d.h:1320
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1322
#define WINED3D_LEGACY_CUBEMAP_FILTERING
Definition: wined3d.h:1327

Definition at line 64 of file ddraw_private.h.

◆ FE

#define FE (   x)    { x, #x }

Definition at line 623 of file ddraw_private.h.

◆ GET_TEXCOORD_SIZE_FROM_FVF

#define GET_TEXCOORD_SIZE_FROM_FVF (   d3dvtVertexType,
  tex_num 
)     (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)

Definition at line 582 of file ddraw_private.h.

◆ GET_TEXCOUNT_FROM_FVF

#define GET_TEXCOUNT_FROM_FVF (   d3dvtVertexType)     (((d3dvtVertexType) & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT)

Definition at line 579 of file ddraw_private.h.

◆ MAX_COMPLEX_ATTACHED

#define MAX_COMPLEX_ATTACHED   6

Definition at line 183 of file ddraw_private.h.

◆ ME

#define ME (   x,
  f,
  e 
)    { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }

Definition at line 634 of file ddraw_private.h.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 25 of file ddraw_private.h.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 26 of file ddraw_private.h.

Enumeration Type Documentation

◆ ddraw_device_state

Enumerator
DDRAW_DEVICE_STATE_OK 
DDRAW_DEVICE_STATE_LOST 
DDRAW_DEVICE_STATE_NOT_RESTORED 

Definition at line 69 of file ddraw_private.h.

70{
74};
@ DDRAW_DEVICE_STATE_LOST
Definition: ddraw_private.h:72
@ DDRAW_DEVICE_STATE_NOT_RESTORED
Definition: ddraw_private.h:73
@ DDRAW_DEVICE_STATE_OK
Definition: ddraw_private.h:71

◆ ddraw_handle_type

Enumerator
DDRAW_HANDLE_FREE 
DDRAW_HANDLE_MATERIAL 
DDRAW_HANDLE_MATRIX 
DDRAW_HANDLE_STATEBLOCK 
DDRAW_HANDLE_SURFACE 

Definition at line 267 of file ddraw_private.h.

268{
274};
@ DDRAW_HANDLE_STATEBLOCK
@ DDRAW_HANDLE_SURFACE
@ DDRAW_HANDLE_MATRIX
@ DDRAW_HANDLE_MATERIAL
@ DDRAW_HANDLE_FREE

Function Documentation

◆ d3d_device_create()

HRESULT d3d_device_create ( struct ddraw ddraw,
const GUID guid,
struct ddraw_surface target,
IUnknown rt_iface,
UINT  version,
struct d3d_device **  device,
IUnknown outer_unknown 
)

Definition at line 6980 of file device.c.

6982{
6983 struct d3d_device *object;
6984 BOOL hw = TRUE;
6985 HRESULT hr;
6986
6987 TRACE("ddraw %p, guid %s, target %p, version %u, device %p, outer_unknown %p.\n",
6989
6990 if (IsEqualGUID(guid, &IID_IDirect3DRGBDevice))
6991 hw = FALSE;
6992
6993 if (!(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
6994 || (target->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
6995 {
6996 WARN("Surface %p is not a render target.\n", target);
6997 return DDERR_INVALIDCAPS;
6998 }
6999
7001 {
7002 WARN("Surface %p has an indexed pixel format, but no palette.\n", target);
7004 }
7005
7006 if (hw && !(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
7007 {
7008 WARN("Surface %p is not in video memory.\n", target);
7010 }
7011
7012 if (ddraw->flags & DDRAW_NO3D)
7013 {
7014 ERR_(winediag)("The application wants to create a Direct3D device, "
7015 "but the current DirectDrawRenderer does not support this.\n");
7016
7017 return DDERR_NO3D;
7018 }
7019
7020 if (ddraw->d3ddevice)
7021 {
7022 FIXME("Only one Direct3D device per DirectDraw object supported.\n");
7023 return DDERR_INVALIDPARAMS;
7024 }
7025
7026 if (!(object = heap_alloc_zero(sizeof(*object))))
7027 {
7028 ERR("Failed to allocate device memory.\n");
7029 return DDERR_OUTOFMEMORY;
7030 }
7031
7033 {
7034 WARN("Failed to initialize device, hr %#x.\n", hr);
7035 heap_free(object);
7036 return hr;
7037 }
7038
7039 TRACE("Created device %p.\n", object);
7040 *device = object;
7041
7042 return D3D_OK;
7043}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define D3DERR_SURFACENOTINVIDMEM
Definition: d3d.h:147
#define D3D_OK
Definition: d3d.h:106
#define DDRAW_NO3D
Definition: ddraw_private.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, BOOL hw, struct ddraw_surface *target, IUnknown *rt_iface, UINT version, IUnknown *outer_unknown)
Definition: device.c:6906
static BOOL validate_surface_palette(struct ddraw_surface *surface)
Definition: device.c:1798
static const WCHAR version[]
Definition: asmname.c:66
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum target
Definition: glext.h:7315
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
const GUID * guid
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
#define DDERR_INVALIDCAPS
Definition: ddraw.h:75
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111
#define DDERR_NOPALETTEATTACHED
Definition: ddraw.h:146
#define DDERR_NO3D
Definition: ddraw.h:83
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:263
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:264
#define ERR_(ch,...)
Definition: debug.h:156
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
IUnknown * outer_unknown
IUnknown * rt_iface
DWORD flags
Definition: ddraw_private.h:94
struct d3d_device * d3ddevice
Definition: devices.h:37

Referenced by d3d2_CreateDevice(), d3d3_CreateDevice(), d3d7_CreateDevice(), and ddraw_surface7_QueryInterface().

◆ d3d_device_update_depth_stencil()

enum wined3d_depth_buffer_type d3d_device_update_depth_stencil ( struct d3d_device device)

Definition at line 6878 of file device.c.

6879{
6880 IDirectDrawSurface7 *depthStencil = NULL;
6881 IDirectDrawSurface7 *render_target;
6882 static DDSCAPS2 depthcaps = { DDSCAPS_ZBUFFER, 0, 0, {0} };
6883 struct ddraw_surface *dsi;
6884
6885 if (device->rt_iface && SUCCEEDED(IUnknown_QueryInterface(device->rt_iface,
6886 &IID_IDirectDrawSurface7, (void **)&render_target)))
6887 {
6888 IDirectDrawSurface7_GetAttachedSurface(render_target, &depthcaps, &depthStencil);
6889 IDirectDrawSurface7_Release(render_target);
6890 }
6891 if (!depthStencil)
6892 {
6893 TRACE("Setting wined3d depth stencil to NULL\n");
6895 return WINED3D_ZB_FALSE;
6896 }
6897
6898 dsi = impl_from_IDirectDrawSurface7(depthStencil);
6901
6902 IDirectDrawSurface7_Release(depthStencil);
6903 return WINED3D_ZB_TRUE;
6904}
struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN
Definition: surface.c:6520
static struct ddraw_surface * impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
#define NULL
Definition: types.h:112
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
Definition: device.c:4524
#define SUCCEEDED(hr)
Definition: intsafe.h:50
DWORD IDirectDrawSurface7
Definition: vmrender.idl:20
@ WINED3D_ZB_TRUE
Definition: wined3d.h:465
@ WINED3D_ZB_FALSE
Definition: wined3d.h:464

Referenced by d3d_device_init(), d3d_device_set_render_target(), and ddraw_surface_attach_surface().

◆ d3d_execute_buffer_execute()

HRESULT d3d_execute_buffer_execute ( struct d3d_execute_buffer execute_buffer,
struct d3d_device device,
struct d3d_viewport viewport 
)

Definition at line 51 of file executebuffer.c.

53{
54 DWORD is = buffer->data.dwInstructionOffset;
55 char *instr = (char *)buffer->desc.lpData + is;
56 unsigned int i, primitive_size;
57 struct wined3d_map_desc map_desc;
58 struct wined3d_box box = {0};
59 HRESULT hr;
60
61 if (viewport->active_device != device)
62 {
63 WARN("Viewport %p active device is %p.\n",
64 viewport, viewport->active_device);
66 }
67
68 /* Activate the viewport */
69 viewport_activate(viewport, FALSE);
70
71 TRACE("ExecuteData :\n");
72 if (TRACE_ON(ddraw))
73 _dump_executedata(&(buffer->data));
74
75 for (;;)
76 {
78 BYTE size;
79 WORD count;
80
81 count = current->wCount;
82 size = current->bSize;
83 instr += sizeof(*current);
84 primitive_size = 0;
85
86 switch (current->bOpcode)
87 {
88 case D3DOP_POINT:
89 {
90 const D3DPOINT *p = (D3DPOINT *)instr;
93 buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
96
97 for (i = 0; i < count; ++i)
98 wined3d_device_draw_primitive(device->wined3d_device, p[i].wFirst, p[i].wCount);
99
100 instr += sizeof(*p) * count;
101 break;
102 }
103
104 case D3DOP_LINE:
105 primitive_size = 2;
107 /* Drop through. */
108 case D3DOP_TRIANGLE:
109 {
110 WORD *indices;
111 unsigned int index_pos = buffer->index_pos, index_count;
112 TRACE("TRIANGLE (%d)\n", count);
113
114 if (!count)
115 break;
116
117 if (!primitive_size)
118 {
120 primitive_size = 3;
121 }
122
123 index_count = count * primitive_size;
124
125 if (buffer->index_size < index_count)
126 {
127 unsigned int new_size = max(buffer->index_size * 2, index_count);
128 struct wined3d_buffer *new_buffer;
130
131 desc.byte_width = new_size * sizeof(*indices);
133 desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
136 desc.misc_flags = 0;
137 desc.structure_byte_stride = 0;
138
139 if (FAILED(hr = wined3d_buffer_create(device->wined3d_device, &desc,
140 NULL, NULL, &ddraw_null_wined3d_parent_ops, &new_buffer)))
141 return hr;
142
143 buffer->index_size = new_size;
144 if (buffer->index_buffer)
145 wined3d_buffer_decref(buffer->index_buffer);
146 buffer->index_buffer = new_buffer;
147 index_pos = 0;
148 }
149 else if (buffer->index_size - index_count < index_pos)
150 {
151 index_pos = 0;
152 }
153
154 box.left = index_pos * sizeof(*indices);
155 box.right = (index_pos + index_count) * sizeof(*indices);
156 if (FAILED(hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->index_buffer), 0, &map_desc,
158 return hr;
159 indices = map_desc.data;
160
161 for (i = 0; i < count; ++i)
162 {
163 D3DTRIANGLE *ci = (D3DTRIANGLE *)instr;
164 TRACE(" v1: %d v2: %d v3: %d\n",ci->u1.v1, ci->u2.v2, ci->u3.v3);
165 TRACE(" Flags : ");
166 if (TRACE_ON(ddraw))
167 {
168 /* Wireframe */
170 TRACE("EDGEENABLE1 ");
172 TRACE("EDGEENABLE2 ");
174 TRACE("EDGEENABLE3 ");
175 /* Strips / Fans */
176 if (ci->wFlags == D3DTRIFLAG_EVEN)
177 TRACE("EVEN ");
178 if (ci->wFlags == D3DTRIFLAG_ODD)
179 TRACE("ODD ");
180 if (ci->wFlags == D3DTRIFLAG_START)
181 TRACE("START ");
182 if ((ci->wFlags > 0) && (ci->wFlags < 30))
183 TRACE("STARTFLAT(%u) ", ci->wFlags);
184 TRACE("\n");
185 }
186
187 switch (primitive_size)
188 {
189 case 3:
190 indices[(i * primitive_size) + 2] = ci->u3.v3;
191 /* Drop through. */
192 case 2:
193 indices[(i * primitive_size) + 1] = ci->u2.v2;
194 indices[(i * primitive_size) ] = ci->u1.v1;
195 }
196 instr += size;
197 }
198
200
201 wined3d_device_set_stream_source(device->wined3d_device, 0,
202 buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
205 wined3d_device_set_index_buffer(device->wined3d_device, buffer->index_buffer, WINED3DFMT_R16_UINT, 0);
206 wined3d_device_draw_indexed_primitive(device->wined3d_device, index_pos, index_count);
207
208 buffer->index_pos = index_pos + index_count;
209 break;
210 }
211
212 case D3DOP_MATRIXLOAD:
213 WARN("MATRIXLOAD-s (%u)\n", count);
214 instr += count * size;
215 break;
216
218 TRACE("MATRIXMULTIPLY (%d)\n", count);
219 for (i = 0; i < count; ++i)
220 {
222 D3DMATRIX *a, *b, *c;
223
224 a = ddraw_get_object(&device->handle_table, ci->hDestMatrix - 1, DDRAW_HANDLE_MATRIX);
225 b = ddraw_get_object(&device->handle_table, ci->hSrcMatrix1 - 1, DDRAW_HANDLE_MATRIX);
226 c = ddraw_get_object(&device->handle_table, ci->hSrcMatrix2 - 1, DDRAW_HANDLE_MATRIX);
227
228 if (!a || !b || !c)
229 {
230 ERR("Invalid matrix handle (a %#x -> %p, b %#x -> %p, c %#x -> %p).\n",
231 ci->hDestMatrix, a, ci->hSrcMatrix1, b, ci->hSrcMatrix2, c);
232 }
233 else
234 {
235 TRACE("dst %p, src1 %p, src2 %p.\n", a, b, c);
236 multiply_matrix(a, c, b);
237 }
238
239 instr += size;
240 }
241 break;
242
244 TRACE("STATETRANSFORM (%d)\n", count);
245 for (i = 0; i < count; ++i)
246 {
247 D3DSTATE *ci = (D3DSTATE *)instr;
248 D3DMATRIX *m;
249
250 m = ddraw_get_object(&device->handle_table, ci->u2.dwArg[0] - 1, DDRAW_HANDLE_MATRIX);
251 if (!m)
252 {
253 ERR("Invalid matrix handle %#x.\n", ci->u2.dwArg[0]);
254 }
255 else
256 {
258 device->world = ci->u2.dwArg[0];
260 device->view = ci->u2.dwArg[0];
262 device->proj = ci->u2.dwArg[0];
263 IDirect3DDevice3_SetTransform(&device->IDirect3DDevice3_iface,
264 ci->u1.dtstTransformStateType, m);
265 }
266
267 instr += size;
268 }
269 break;
270
271 case D3DOP_STATELIGHT:
272 TRACE("STATELIGHT (%d)\n", count);
273 for (i = 0; i < count; ++i)
274 {
275 D3DSTATE *ci = (D3DSTATE *)instr;
276
277 if (FAILED(IDirect3DDevice3_SetLightState(&device->IDirect3DDevice3_iface,
278 ci->u1.dlstLightStateType, ci->u2.dwArg[0])))
279 WARN("Failed to set light state.\n");
280
281 instr += size;
282 }
283 break;
284
286 TRACE("STATERENDER (%d)\n", count);
287 for (i = 0; i < count; ++i)
288 {
289 D3DSTATE *ci = (D3DSTATE *)instr;
290
291 if (FAILED(IDirect3DDevice3_SetRenderState(&device->IDirect3DDevice3_iface,
292 ci->u1.drstRenderStateType, ci->u2.dwArg[0])))
293 WARN("Failed to set render state.\n");
294
295 instr += size;
296 }
297 break;
298
300 TRACE("PROCESSVERTICES (%d)\n", count);
301
302 for (i = 0; i < count; ++i)
303 {
306
307 TRACE(" start %u, dest %u, count %u, flags %#x.\n",
308 ci->wStart, ci->wDest, ci->dwCount, ci->dwFlags);
309
311 {
312 static int once;
313 if (!once++) FIXME("D3DPROCESSVERTICES_UPDATEEXTENTS not implemented.\n");
314 }
316 FIXME("D3DPROCESSVERTICES_NOCOLOR not implemented.\n");
317
318 switch (op)
319 {
322 wined3d_device_set_stream_source(device->wined3d_device, 0,
323 buffer->src_vertex_buffer, buffer->src_vertex_pos, sizeof(D3DVERTEX));
325 {
330 }
331 else
332 {
337 }
338
339 wined3d_device_process_vertices(device->wined3d_device, ci->wStart, ci->wDest,
340 ci->dwCount, buffer->dst_vertex_buffer, NULL, 0, D3DFVF_TLVERTEX);
341 break;
342
344 box.left = (buffer->src_vertex_pos + ci->wStart) * sizeof(D3DTLVERTEX);
345 box.right = box.left + ci->dwCount * sizeof(D3DTLVERTEX);
346 box.top = box.front = 0;
347 box.bottom = box.back = 1;
349 wined3d_buffer_get_resource(buffer->dst_vertex_buffer), 0,
350 ci->wDest * sizeof(D3DTLVERTEX), 0, 0,
351 wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0, &box);
352 break;
353
354 default:
355 FIXME("Unhandled vertex processing op %#x.\n", op);
356 break;
357 }
358
359 instr += size;
360 }
361 break;
362
364 TRACE("TEXTURELOAD (%u)\n", count);
365
366 for (i = 0; i < count; ++i)
367 {
368 D3DTEXTURELOAD *ci = (D3DTEXTURELOAD *)instr;
369 struct ddraw_surface *dst, *src;
370
371 instr += size;
372
373 if (!(dst = ddraw_get_object(&device->handle_table,
375 {
376 WARN("Invalid destination texture handle %#x.\n", ci->hDestTexture);
377 continue;
378 }
379 if (!(src = ddraw_get_object(&device->handle_table,
381 {
382 WARN("Invalid source texture handle %#x.\n", ci->hSrcTexture);
383 continue;
384 }
385
386 IDirect3DTexture2_Load(&dst->IDirect3DTexture2_iface, &src->IDirect3DTexture2_iface);
387 }
388 break;
389
390 case D3DOP_EXIT:
391 TRACE("EXIT (%u)\n", count);
392 instr += size;
393 goto end_of_buffer;
394
396 TRACE("BRANCHFORWARD (%d)\n", count);
397 for (i = 0; i < count; ++i)
398 {
399 D3DBRANCH *ci = (D3DBRANCH *)instr;
400
401 if ((buffer->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue)
402 {
403 if (!ci->bNegate)
404 {
405 TRACE(" Branch to %d\n", ci->dwOffset);
406 if (ci->dwOffset) {
407 instr = (char*)current + ci->dwOffset;
408 break;
409 }
410 }
411 }
412 else
413 {
414 if (ci->bNegate)
415 {
416 TRACE(" Branch to %d\n", ci->dwOffset);
417 if (ci->dwOffset) {
418 instr = (char*)current + ci->dwOffset;
419 break;
420 }
421 }
422 }
423
424 instr += size;
425 }
426 break;
427
428 case D3DOP_SPAN:
429 WARN("SPAN-s (%u)\n", count);
430 instr += count * size;
431 break;
432
433 case D3DOP_SETSTATUS:
434 TRACE("SETSTATUS (%d)\n", count);
435 for (i = 0; i < count; ++i)
436 {
437 buffer->data.dsStatus = *(D3DSTATUS *)instr;
438 instr += size;
439 }
440 break;
441
442 default:
443 ERR("Unhandled OpCode %#x.\n",current->bOpcode);
444 instr += count * size;
445 break;
446 }
447 }
448
449end_of_buffer:
450 return D3D_OK;
451}
#define IDirect3DDevice3_SetRenderState(p, a, b)
Definition: d3d.h:1213
#define IDirect3DDevice3_SetLightState(p, a, b)
Definition: d3d.h:1215
#define IDirect3DTexture2_Load(p, a)
Definition: d3d.h:632
#define IDirect3DDevice3_SetTransform(p, a, b)
Definition: d3d.h:1216
@ D3DOP_STATELIGHT
Definition: d3dtypes.h:650
@ D3DOP_TEXTURELOAD
Definition: d3dtypes.h:653
@ D3DOP_MATRIXMULTIPLY
Definition: d3dtypes.h:648
@ D3DOP_PROCESSVERTICES
Definition: d3dtypes.h:652
@ D3DOP_MATRIXLOAD
Definition: d3dtypes.h:647
@ D3DOP_STATETRANSFORM
Definition: d3dtypes.h:649
@ D3DOP_TRIANGLE
Definition: d3dtypes.h:646
@ D3DOP_SPAN
Definition: d3dtypes.h:656
@ D3DOP_LINE
Definition: d3dtypes.h:645
@ D3DOP_STATERENDER
Definition: d3dtypes.h:651
@ D3DOP_SETSTATUS
Definition: d3dtypes.h:657
@ D3DOP_POINT
Definition: d3dtypes.h:644
@ D3DOP_EXIT
Definition: d3dtypes.h:654
@ D3DOP_BRANCHFORWARD
Definition: d3dtypes.h:655
#define D3DTRIFLAG_ODD
Definition: d3dtypes.h:1172
#define D3DTRIFLAG_START
Definition: d3dtypes.h:1170
#define D3DTRIFLAG_EDGEENABLE1
Definition: d3dtypes.h:1175
#define D3DFVF_VERTEX
Definition: d3dtypes.h:1328
#define D3DPROCESSVERTICES_COPY
Definition: d3dtypes.h:1056
#define D3DTRIFLAG_EVEN
Definition: d3dtypes.h:1173
#define D3DPROCESSVERTICES_OPMASK
Definition: d3dtypes.h:1057
#define D3DPROCESSVERTICES_NOCOLOR
Definition: d3dtypes.h:1060
#define D3DFVF_LVERTEX
Definition: d3dtypes.h:1329
#define D3DFVF_TLVERTEX
Definition: d3dtypes.h:1331
struct _D3DTLVERTEX D3DTLVERTEX
#define D3DPROCESSVERTICES_UPDATEEXTENTS
Definition: d3dtypes.h:1059
#define D3DPROCESSVERTICES_TRANSFORMLIGHT
Definition: d3dtypes.h:1054
#define D3DPROCESSVERTICES_TRANSFORM
Definition: d3dtypes.h:1055
#define D3DTRIFLAG_EDGEENABLE2
Definition: d3dtypes.h:1176
void multiply_matrix(D3DMATRIX *dst, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN
Definition: utils.c:1173
void viewport_activate(struct d3d_viewport *viewport, BOOL ignore_lights) DECLSPEC_HIDDEN
Definition: viewport.c:55
void * ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type) DECLSPEC_HIDDEN
Definition: main.c:182
UINT op
Definition: effect.c:236
struct wined3d_vertex_declaration * ddraw_find_decl(struct ddraw *This, DWORD fvf)
Definition: ddraw.c:4797
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
Definition: ddraw.c:83
HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
Definition: buffer.c:1436
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, struct wined3d_vertex_declaration *declaration)
Definition: device.c:2157
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
Definition: device.c:3769
HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box)
Definition: device.c:4121
HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf)
Definition: device.c:3340
void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
Definition: device.c:1874
HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count)
Definition: device.c:3740
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2027
void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count)
Definition: device.c:3717
HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: device.c:1378
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:382
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
Definition: resource.c:344
#define TRACE_ON(x)
Definition: compat.h:75
#define D3DTRANSFORMSTATE_WORLD
Definition: dx7todx8.h:22
#define D3DTRANSFORMSTATE_VIEW
Definition: dx7todx8.h:21
#define D3DTRANSFORMSTATE_PROJECTION
Definition: dx7todx8.h:12
static void _dump_executedata(const D3DEXECUTEDATA *lpData)
Definition: executebuffer.c:36
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLenum dst
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define a
Definition: ke_i.h:78
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79
struct task_struct * current
Definition: linux.c:32
static const WCHAR desc[]
Definition: protectdata.c:36
BOOL bNegate
Definition: d3dtypes.h:1221
DWORD dwOffset
Definition: d3dtypes.h:1222
DWORD dwValue
Definition: d3dtypes.h:1220
DWORD dwMask
Definition: d3dtypes.h:1219
D3DMATRIXHANDLE hDestMatrix
Definition: d3dtypes.h:1041
D3DMATRIXHANDLE hSrcMatrix1
Definition: d3dtypes.h:1042
D3DMATRIXHANDLE hSrcMatrix2
Definition: d3dtypes.h:1043
DWORD dwArg[1]
Definition: d3dtypes.h:1030
D3DLIGHTSTATETYPE dlstLightStateType
Definition: d3dtypes.h:1026
D3DTRANSFORMSTATETYPE dtstTransformStateType
Definition: d3dtypes.h:1025
D3DRENDERSTATETYPE drstRenderStateType
Definition: d3dtypes.h:1027
D3DTEXTUREHANDLE hSrcTexture
Definition: d3dtypes.h:670
D3DTEXTUREHANDLE hDestTexture
Definition: d3dtypes.h:669
Definition: palette.c:468
struct d3d_device * active_device
#define max(a, b)
Definition: svc.c:63
#define WINED3DUSAGE_WRITEONLY
Definition: wined3d.h:901
@ WINED3D_RS_LIGHTING
Definition: wined3d.h:324
@ WINED3D_PT_LINELIST
Definition: wined3d.h:73
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:72
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:75
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:193
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3D_MAP_DISCARD
Definition: wined3d.h:935
#define WINED3D_MAP_WRITE
Definition: wined3d.h:938
#define WINED3D_MAP_NOOVERWRITE
Definition: wined3d.h:934
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:891
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
unsigned char BYTE
Definition: xxhash.c:193

Referenced by d3d_device1_Execute().

◆ d3d_execute_buffer_init()

HRESULT d3d_execute_buffer_init ( struct d3d_execute_buffer execute_buffer,
struct d3d_device device,
D3DEXECUTEBUFFERDESC desc 
)

Definition at line 775 of file executebuffer.c.

777{
779 execute_buffer->ref = 1;
780 execute_buffer->d3ddev = device;
781
782 /* Initializes memory */
783 memcpy(&execute_buffer->desc, desc, desc->dwSize);
784
785 /* No buffer given */
786 if (!(execute_buffer->desc.dwFlags & D3DDEB_LPDATA))
787 execute_buffer->desc.lpData = NULL;
788
789 /* No buffer size given */
790 if (!(execute_buffer->desc.dwFlags & D3DDEB_BUFSIZE))
791 execute_buffer->desc.dwBufferSize = 0;
792
793 /* Create buffer if asked */
794 if (!execute_buffer->desc.lpData && execute_buffer->desc.dwBufferSize)
795 {
796 execute_buffer->need_free = TRUE;
797 if (!(execute_buffer->desc.lpData = heap_alloc_zero(execute_buffer->desc.dwBufferSize)))
798 {
799 ERR("Failed to allocate execute buffer data.\n");
800 return DDERR_OUTOFMEMORY;
801 }
802 }
803
804 execute_buffer->desc.dwFlags |= D3DDEB_LPDATA;
805
806 return D3D_OK;
807}
#define D3DDEB_BUFSIZE
Definition: d3dcaps.h:142
#define D3DDEB_LPDATA
Definition: d3dcaps.h:144
static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface
D3DEXECUTEBUFFERDESC desc
struct d3d_device * d3ddev

Referenced by d3d_device1_CreateExecuteBuffer().

◆ d3d_light_init()

void d3d_light_init ( struct d3d_light light,
struct ddraw ddraw 
)

Definition at line 247 of file light.c.

248{
249 light->IDirect3DLight_iface.lpVtbl = &d3d_light_vtbl;
250 light->ref = 1;
251 light->ddraw = ddraw;
252}
static const struct IDirect3DLightVtbl d3d_light_vtbl
Definition: light.c:235
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
Definition: glfuncs.h:170

Referenced by d3d3_CreateLight().

◆ d3d_material_create()

struct d3d_material * d3d_material_create ( struct ddraw ddraw)

Definition at line 501 of file material.c.

502{
503 struct d3d_material *material;
504
505 if (!(material = heap_alloc_zero(sizeof(*material))))
506 return NULL;
507
511 material->ref = 1;
512 material->ddraw = ddraw;
513
514 return material;
515}
static const struct IDirect3DMaterial3Vtbl d3d_material3_vtbl
Definition: material.c:462
static const struct IDirect3DMaterialVtbl d3d_material1_vtbl
Definition: material.c:486
static const struct IDirect3DMaterial2Vtbl d3d_material2_vtbl
Definition: material.c:474
IDirect3DMaterial IDirect3DMaterial_iface
struct ddraw * ddraw
IDirect3DMaterial2 IDirect3DMaterial2_iface
IDirect3DMaterial3 IDirect3DMaterial3_iface

Referenced by d3d1_CreateMaterial(), d3d2_CreateMaterial(), and d3d3_CreateMaterial().

◆ d3d_vertex_buffer_create()

HRESULT d3d_vertex_buffer_create ( struct d3d_vertex_buffer **  buffer,
struct ddraw ddraw,
D3DVERTEXBUFFERDESC desc 
)

Definition at line 432 of file vertexbuffer.c.

434{
436 HRESULT hr = D3D_OK;
437
438 TRACE("Vertex buffer description:\n");
439 TRACE(" dwSize %u\n", desc->dwSize);
440 TRACE(" dwCaps %#x\n", desc->dwCaps);
441 TRACE(" FVF %#x\n", desc->dwFVF);
442 TRACE(" dwNumVertices %u\n", desc->dwNumVertices);
443
444 if (!(buffer = heap_alloc_zero(sizeof(*buffer))))
445 return DDERR_OUTOFMEMORY;
446
447 buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
448 buffer->ref = 1;
449 buffer->version = ddraw->d3dversion;
450 if (buffer->version == 7)
451 IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface);
452 buffer->ddraw = ddraw;
453 buffer->Caps = desc->dwCaps;
454 buffer->fvf = desc->dwFVF;
455 buffer->size = get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices;
456
458
460 {
461 WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr);
464 goto end;
465 }
466
467 if (!(buffer->wined3d_declaration = ddraw_find_decl(ddraw, desc->dwFVF)))
468 {
469 ERR("Failed to find vertex declaration for fvf %#x.\n", desc->dwFVF);
470 wined3d_buffer_decref(buffer->wined3d_buffer);
472 goto end;
473 }
474 wined3d_vertex_declaration_incref(buffer->wined3d_declaration);
475
476end:
478 if (hr == D3D_OK)
479 *vertex_buf = buffer;
480 else
482
483 return hr;
484}
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN
Definition: utils.c:923
GLuint GLuint end
Definition: gl.h:1545
struct ddraw * ddraw
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:79
int d3dversion
static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer *buffer, BOOL dynamic, struct wined3d_buffer **wined3d_buffer)
Definition: vertexbuffer.c:115
static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl
Definition: vertexbuffer.c:419
ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration)
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368

Referenced by d3d3_CreateVertexBuffer(), and d3d7_CreateVertexBuffer().

◆ d3d_viewport_init()

void d3d_viewport_init ( struct d3d_viewport viewport,
struct ddraw ddraw 
)

Definition at line 1146 of file viewport.c.

1147{
1148 viewport->IDirect3DViewport3_iface.lpVtbl = &d3d_viewport_vtbl;
1149 viewport->ref = 1;
1150 viewport->ddraw = ddraw;
1151 viewport->use_vp2 = 0xff;
1152 list_init(&viewport->light_list);
1153}
static void list_init(struct list_entry *head)
Definition: list.h:51
static const struct IDirect3DViewport3Vtbl d3d_viewport_vtbl
Definition: viewport.c:1094
struct list light_list
struct ddraw * ddraw
IDirect3DViewport3 IDirect3DViewport3_iface

Referenced by d3d3_CreateViewport().

◆ ddraw_allocate_handle()

DWORD ddraw_allocate_handle ( struct ddraw_handle_table t,
void object,
enum ddraw_handle_type  type 
)

Definition at line 113 of file main.c.

114{
116
117 if (t->free_entries)
118 {
119 DWORD idx = t->free_entries - t->entries;
120 /* Use a free handle */
121 entry = t->free_entries;
122 if (entry->type != DDRAW_HANDLE_FREE)
123 {
124 ERR("Handle %#x (%p) is in the free list, but has type %#x.\n", idx, entry->object, entry->type);
126 }
127 t->free_entries = entry->object;
128 entry->object = object;
129 entry->type = type;
130
131 return idx;
132 }
133
134 if (!(t->entry_count < t->table_size))
135 {
136 /* Grow the table */
137 UINT new_size = t->table_size + (t->table_size >> 1);
138 struct ddraw_handle_entry *new_entries;
139
140 if (!(new_entries = heap_realloc(t->entries, new_size * sizeof(*t->entries))))
141 {
142 ERR("Failed to grow the handle table.\n");
144 }
145 t->entries = new_entries;
146 t->table_size = new_size;
147 }
148
149 entry = &t->entries[t->entry_count];
150 entry->object = object;
151 entry->type = type;
152
153 return t->entry_count++;
154}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define DDRAW_INVALID_HANDLE
unsigned int idx
Definition: utils.c:41
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble t
Definition: gl.h:2047
uint32_t entry
Definition: isohybrid.c:63
unsigned int UINT
Definition: ndis.h:50
void * object

Referenced by d3d_device1_CreateMatrix(), d3d_device7_CreateStateBlock(), d3d_device7_EndStateBlock(), d3d_material3_GetHandle(), and d3d_texture2_GetHandle().

◆ ddraw_clipper_init()

HRESULT ddraw_clipper_init ( struct ddraw_clipper clipper)

Definition at line 321 of file clipper.c.

322{
324 clipper->ref = 1;
325
326 return DD_OK;
327}
static const struct IDirectDrawClipperVtbl ddraw_clipper_vtbl
Definition: clipper.c:308
#define DD_OK
Definition: ddraw.h:186
IDirectDrawClipper IDirectDrawClipper_iface

Referenced by DirectDrawCreateClipper().

◆ DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1()

void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1 ( const DDDEVICEIDENTIFIER2 pIn,
DDDEVICEIDENTIFIER pOut 
)

Definition at line 961 of file utils.c.

962{
963 /* 2 adds a dwWHQLLevel field to the end. Both structures are
964 * unversioned. */
965 memcpy(pOut, pIn, sizeof(*pOut));
966}

Referenced by ddraw4_GetDeviceIdentifier().

◆ DDRAW_Convert_DDSCAPS_1_To_2()

void DDRAW_Convert_DDSCAPS_1_To_2 ( const DDSCAPS pIn,
DDSCAPS2 pOut 
)

Definition at line 951 of file utils.c.

952{
953 /* 2 adds three additional caps fields to the end. Both versions
954 * are unversioned. */
955 pOut->dwCaps = pIn->dwCaps;
956 pOut->dwCaps2 = 0;
957 pOut->dwCaps3 = 0;
958 pOut->u1.dwCaps4 = 0;
959}
DWORD dwCaps4
Definition: ddraw.h:737
DWORD dwCaps3
Definition: ddraw.h:734
DWORD dwCaps2
Definition: ddraw.h:733
DWORD dwCaps
Definition: ddraw.h:732
DWORD dwCaps
Definition: ddraw.h:727

Referenced by ddraw2_GetAvailableVidMem().

◆ ddraw_d3dcaps1_from_7()

void ddraw_d3dcaps1_from_7 ( D3DDEVICEDESC caps1,
D3DDEVICEDESC7 caps7 
)

Definition at line 1192 of file ddraw.c.

1193{
1194 memset(caps1, 0, sizeof(*caps1));
1195 caps1->dwSize = sizeof(*caps1);
1196 caps1->dwFlags = D3DDD_COLORMODEL
1207 caps1->dcmColorModel = D3DCOLOR_RGB;
1208 caps1->dwDevCaps = caps7->dwDevCaps;
1209 caps1->dtcTransformCaps.dwSize = sizeof(caps1->dtcTransformCaps);
1211 caps1->bClipping = TRUE;
1212 caps1->dlcLightingCaps.dwSize = sizeof(caps1->dlcLightingCaps);
1219 caps1->dpcLineCaps = caps7->dpcLineCaps;
1220 caps1->dpcTriCaps = caps7->dpcTriCaps;
1223 caps1->dwMaxBufferSize = 0;
1224 caps1->dwMaxVertexCount = 65536;
1225 caps1->dwMinTextureWidth = caps7->dwMinTextureWidth;
1226 caps1->dwMinTextureHeight = caps7->dwMinTextureHeight;
1227 caps1->dwMaxTextureWidth = caps7->dwMaxTextureWidth;
1228 caps1->dwMaxTextureHeight = caps7->dwMaxTextureHeight;
1229 caps1->dwMinStippleWidth = 1;
1230 caps1->dwMinStippleHeight = 1;
1231 caps1->dwMaxStippleWidth = 32;
1232 caps1->dwMaxStippleHeight = 32;
1233 caps1->dwMaxTextureRepeat = caps7->dwMaxTextureRepeat;
1235 caps1->dwMaxAnisotropy = caps7->dwMaxAnisotropy;
1236 caps1->dvGuardBandLeft = caps7->dvGuardBandLeft;
1237 caps1->dvGuardBandTop = caps7->dvGuardBandTop;
1238 caps1->dvGuardBandRight = caps7->dvGuardBandRight;
1239 caps1->dvGuardBandBottom = caps7->dvGuardBandBottom;
1240 caps1->dvExtentsAdjust = caps7->dvExtentsAdjust;
1241 caps1->dwStencilCaps = caps7->dwStencilCaps;
1242 caps1->dwFVFCaps = caps7->dwFVFCaps;
1243 caps1->dwTextureOpCaps = caps7->dwTextureOpCaps;
1246}
#define D3DDD_LIGHTINGCAPS
Definition: d3dcaps.h:108
#define D3DDD_MAXBUFFERSIZE
Definition: d3dcaps.h:114
#define D3DDD_LINECAPS
Definition: d3dcaps.h:110
#define D3DDD_DEVICEZBUFFERBITDEPTH
Definition: d3dcaps.h:113
#define D3DLIGHTCAPS_DIRECTIONAL
Definition: d3dcaps.h:20
#define D3DDD_COLORMODEL
Definition: d3dcaps.h:105
#define D3DLIGHTCAPS_POINT
Definition: d3dcaps.h:18
#define D3DDD_DEVICERENDERBITDEPTH
Definition: d3dcaps.h:112
#define D3DLIGHTCAPS_SPOT
Definition: d3dcaps.h:19
#define D3DDD_TRANSFORMCAPS
Definition: d3dcaps.h:107
#define D3DDD_TRICAPS
Definition: d3dcaps.h:111
#define D3DDD_DEVCAPS
Definition: d3dcaps.h:106
#define D3DDD_BCLIPPING
Definition: d3dcaps.h:109
#define D3DTRANSFORMCAPS_CLIP
Definition: d3dcaps.h:15
#define D3DDD_MAXVERTEXCOUNT
Definition: d3dcaps.h:115
#define D3DLIGHTINGMODEL_RGB
Definition: d3dcaps.h:16
#define D3DCOLOR_RGB
Definition: d3dtypes.h:627
#define D3DLIGHTCAPS_PARALLELPOINT
Definition: dump.c:16
#define memset(x, y, z)
Definition: compat.h:39
D3DPRIMCAPS dpcTriCaps
Definition: d3dcaps.h:360
WORD wMaxSimultaneousTextures
Definition: d3dcaps.h:379
DWORD dwMaxTextureAspectRatio
Definition: d3dcaps.h:368
DWORD dwMaxTextureHeight
Definition: d3dcaps.h:366
DWORD dwFVFCaps
Definition: d3dcaps.h:376
D3DPRIMCAPS dpcLineCaps
Definition: d3dcaps.h:359
DWORD dwMinTextureHeight
Definition: d3dcaps.h:364
DWORD dwMaxAnisotropy
Definition: d3dcaps.h:369
DWORD dwDeviceRenderBitDepth
Definition: d3dcaps.h:361
DWORD dwStencilCaps
Definition: d3dcaps.h:375
DWORD dwMaxActiveLights
Definition: d3dcaps.h:380
DWORD dwMaxTextureRepeat
Definition: d3dcaps.h:367
DWORD dwDeviceZBufferBitDepth
Definition: d3dcaps.h:362
DWORD dwTextureOpCaps
Definition: d3dcaps.h:377
D3DVALUE dvGuardBandRight
Definition: d3dcaps.h:372
D3DVALUE dvGuardBandBottom
Definition: d3dcaps.h:373
WORD wMaxTextureBlendStages
Definition: d3dcaps.h:378
DWORD dwDevCaps
Definition: d3dcaps.h:358
D3DVALUE dvGuardBandTop
Definition: d3dcaps.h:371
DWORD dwMinTextureWidth
Definition: d3dcaps.h:363
D3DVALUE dvExtentsAdjust
Definition: d3dcaps.h:374
DWORD dwMaxTextureWidth
Definition: d3dcaps.h:365
D3DVALUE dvGuardBandLeft
Definition: d3dcaps.h:370
DWORD dwMaxStippleWidth
Definition: d3dcaps.h:334
D3DVALUE dvGuardBandTop
Definition: d3dcaps.h:343
D3DPRIMCAPS dpcTriCaps
Definition: d3dcaps.h:326
DWORD dwDeviceZBufferBitDepth
Definition: d3dcaps.h:328
DWORD dwSize
Definition: d3dcaps.h:318
DWORD dwMaxTextureWidth
Definition: d3dcaps.h:333
D3DTRANSFORMCAPS dtcTransformCaps
Definition: d3dcaps.h:322
DWORD dwStencilCaps
Definition: d3dcaps.h:347
BOOL bClipping
Definition: d3dcaps.h:323
D3DVALUE dvGuardBandRight
Definition: d3dcaps.h:344
DWORD dwFlags
Definition: d3dcaps.h:319
DWORD dwMaxTextureAspectRatio
Definition: d3dcaps.h:340
DWORD dwMaxTextureRepeat
Definition: d3dcaps.h:339
DWORD dwDeviceRenderBitDepth
Definition: d3dcaps.h:327
DWORD dwMaxBufferSize
Definition: d3dcaps.h:329
DWORD dwMaxVertexCount
Definition: d3dcaps.h:330
DWORD dwMaxStippleHeight
Definition: d3dcaps.h:335
DWORD dwDevCaps
Definition: d3dcaps.h:321
D3DPRIMCAPS dpcLineCaps
Definition: d3dcaps.h:325
DWORD dwMaxTextureHeight
Definition: d3dcaps.h:333
WORD wMaxTextureBlendStages
Definition: d3dcaps.h:350
D3DVALUE dvExtentsAdjust
Definition: d3dcaps.h:346
D3DCOLORMODEL dcmColorModel
Definition: d3dcaps.h:320
DWORD dwMaxAnisotropy
Definition: d3dcaps.h:341
DWORD dwMinStippleWidth
Definition: d3dcaps.h:334
DWORD dwMinStippleHeight
Definition: d3dcaps.h:335
DWORD dwTextureOpCaps
Definition: d3dcaps.h:349
DWORD dwMinTextureWidth
Definition: d3dcaps.h:332
D3DVALUE dvGuardBandBottom
Definition: d3dcaps.h:345
D3DVALUE dvGuardBandLeft
Definition: d3dcaps.h:342
DWORD dwMinTextureHeight
Definition: d3dcaps.h:332
WORD wMaxSimultaneousTextures
Definition: d3dcaps.h:351
DWORD dwFVFCaps
Definition: d3dcaps.h:348
D3DLIGHTINGCAPS dlcLightingCaps
Definition: d3dcaps.h:324
DWORD dwNumLights
Definition: d3dcaps.h:259
DWORD dwLightingModel
Definition: d3dcaps.h:258

Referenced by d3d3_EnumDevices(), d3d3_FindDevice(), and d3d_device3_GetCaps().

◆ DDRAW_dump_cooperativelevel()

void DDRAW_dump_cooperativelevel ( DWORD  cooplevel)

Definition at line 968 of file utils.c.

969{
970 static const struct flag_info flags[] =
971 {
981 };
982
983 if (TRACE_ON(ddraw))
984 {
985 TRACE(" - ");
987 }
988}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FE(x)
static void DDRAW_dump_flags(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:707
GLbitfield flags
Definition: glext.h:7161
#define DDSCL_SETDEVICEWINDOW
Definition: ddraw.h:539
#define DDSCL_SETFOCUSWINDOW
Definition: ddraw.h:538
#define DDSCL_NORMAL
Definition: ddraw.h:535
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:536
#define DDSCL_ALLOWREBOOT
Definition: ddraw.h:533
#define DDSCL_CREATEDEVICEWINDOW
Definition: ddraw.h:540
#define DDSCL_NOWINDOWCHANGES
Definition: ddraw.h:534
#define DDSCL_ALLOWMODEX
Definition: ddraw.h:537
#define DDSCL_FULLSCREEN
Definition: ddraw.h:532

Referenced by ddraw_set_cooperative_level().

◆ DDRAW_dump_DDCAPS()

void DDRAW_dump_DDCAPS ( const DDCAPS lpcaps)

Definition at line 990 of file utils.c.

991{
992 static const struct flag_info flags1[] =
993 {
994 FE(DDCAPS_3D),
1000 FE(DDCAPS_BLT),
1004 FE(DDCAPS_GDI),
1013 FE(DDCAPS_VBI),
1026 };
1027 static const struct flag_info flags2[] =
1028 {
1054 };
1055 static const struct flag_info flags3[] =
1056 {
1076 };
1077 static const struct flag_info flags4[] =
1078 {
1107 };
1108 static const struct flag_info flags5[] =
1109 {
1120 };
1121 static const struct flag_info flags6[] =
1122 {
1134 };
1135 static const struct flag_info flags7[] =
1136 {
1142 };
1143
1144 TRACE(" - dwSize : %d\n", lpcaps->dwSize);
1145 TRACE(" - dwCaps : "); DDRAW_dump_flags(lpcaps->dwCaps, flags1, ARRAY_SIZE(flags1));
1146 TRACE(" - dwCaps2 : "); DDRAW_dump_flags(lpcaps->dwCaps2, flags2, ARRAY_SIZE(flags2));
1147 TRACE(" - dwCKeyCaps : "); DDRAW_dump_flags(lpcaps->dwCKeyCaps, flags3, ARRAY_SIZE(flags3));
1148 TRACE(" - dwFXCaps : "); DDRAW_dump_flags(lpcaps->dwFXCaps, flags4, ARRAY_SIZE(flags4));
1149 TRACE(" - dwFXAlphaCaps : "); DDRAW_dump_flags(lpcaps->dwFXAlphaCaps, flags5, ARRAY_SIZE(flags5));
1150 TRACE(" - dwPalCaps : "); DDRAW_dump_flags(lpcaps->dwPalCaps, flags6, ARRAY_SIZE(flags6));
1151 TRACE(" - dwSVCaps : "); DDRAW_dump_flags(lpcaps->dwSVCaps, flags7, ARRAY_SIZE(flags7));
1152 TRACE("...\n");
1153 TRACE(" - dwNumFourCCCodes : %d\n", lpcaps->dwNumFourCCCodes);
1154 TRACE(" - dwCurrVisibleOverlays : %d\n", lpcaps->dwCurrVisibleOverlays);
1155 TRACE(" - dwMinOverlayStretch : %d\n", lpcaps->dwMinOverlayStretch);
1156 TRACE(" - dwMaxOverlayStretch : %d\n", lpcaps->dwMaxOverlayStretch);
1157 TRACE("...\n");
1158 TRACE(" - ddsCaps : "); DDRAW_dump_DDSCAPS2(&lpcaps->ddsCaps);
1159}
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
Definition: utils.c:713
#define DDSVCAPS_RESERVED4
Definition: ddraw.h:440
#define DDFXCAPS_OVERLAYSHRINKXN
Definition: ddraw.h:423
#define DDCKEYCAPS_DESTBLTCLRSPACEYUV
Definition: ddraw.h:483
#define DDPCAPS_PRIMARYSURFACE
Definition: ddraw.h:456
#define DDCKEYCAPS_SRCBLTCLRSPACEYUV
Definition: ddraw.h:492
#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL
Definition: ddraw.h:386
#define DDCAPS_OVERLAYSTRETCH
Definition: ddraw.h:343
#define DDFXALPHACAPS_BLTALPHASURFACES
Definition: ddraw.h:395
#define DDCAPS_3D
Definition: ddraw.h:329
#define DDFXALPHACAPS_BLTALPHAPIXELS
Definition: ddraw.h:393
#define DDFXCAPS_BLTSHRINKYN
Definition: ddraw.h:416
#define DDCAPS_BLT
Definition: ddraw.h:335
#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG
Definition: ddraw.h:401
#define DDCAPS_ALIGNBOUNDARYSRC
Definition: ddraw.h:332
#define DDCAPS2_CANDROPZ16BIT
Definition: ddraw.h:370
#define DDCAPS_BLTDEPTHFILL
Definition: ddraw.h:357
#define DDCAPS2_FLIPINTERVAL
Definition: ddraw.h:381
#define DDCKEYCAPS_DESTBLT
Definition: ddraw.h:481
#define DDCKEYCAPS_SRCOVERLAYYUV
Definition: ddraw.h:498
#define DDCKEYCAPS_SRCBLTYUV
Definition: ddraw.h:493
#define DDSVCAPS_RESERVED3
Definition: ddraw.h:439
#define DDFXCAPS_BLTSHRINKX
Definition: ddraw.h:413
#define DDCAPS_ALIGNBOUNDARYDEST
Definition: ddraw.h:330
#define DDCAPS2_FLIPNOVSYNC
Definition: ddraw.h:382
#define DDCAPS_PALETTE
Definition: ddraw.h:344
#define DDPCAPS_VSYNC
Definition: ddraw.h:459
#define DDCAPS_OVERLAY
Definition: ddraw.h:340
#define DDFXALPHACAPS_OVERLAYALPHAPIXELS
Definition: ddraw.h:398
#define DDCAPS2_PRIMARYGAMMA
Definition: ddraw.h:378
#define DDCKEYCAPS_DESTOVERLAY
Definition: ddraw.h:485
#define DDCAPS_BLTQUEUE
Definition: ddraw.h:336
#define DDCAPS2_COLORCONTROLOVERLAY
Definition: ddraw.h:368
#define DDFXCAPS_OVERLAYARITHSTRETCHY
Definition: ddraw.h:421
#define DDPCAPS_ALLOW256
Definition: ddraw.h:458
#define DDCAPS2_CANRENDERWINDOWED
Definition: ddraw.h:379
#define DDCAPS_STEREOVIEW
Definition: ddraw.h:63
#define DDSVCAPS_RESERVED1
Definition: ddraw.h:437
#define DDCKEYCAPS_DESTBLTCLRSPACE
Definition: ddraw.h:482
#define DDCAPS2_NONLOCALVIDMEM
Definition: ddraw.h:371
#define DDCKEYCAPS_SRCOVERLAY
Definition: ddraw.h:494
#define DDPCAPS_8BITENTRIES
Definition: ddraw.h:454
#define DDFXCAPS_BLTSTRETCHYN
Definition: ddraw.h:420
#define DDFXCAPS_BLTMIRRORLEFTRIGHT
Definition: ddraw.h:409
#define DDFXCAPS_OVERLAYARITHSTRETCHYN
Definition: ddraw.h:406
#define DDCAPS_ALPHA
Definition: ddraw.h:352
#define DDCAPS_CANBLTSYSMEM
Definition: ddraw.h:360
#define DDCAPS_READSCANLINE
Definition: ddraw.h:346
#define DDFXCAPS_BLTMIRRORUPDOWN
Definition: ddraw.h:410
#define DDFXCAPS_OVERLAYSTRETCHXN
Definition: ddraw.h:427
#define DDCAPS2_CERTIFIED
Definition: ddraw.h:362
#define DDSVCAPS_STEREOSEQUENTIAL
Definition: ddraw.h:450
#define DDCAPS_OVERLAYFOURCC
Definition: ddraw.h:342
#define DDCAPS2_COLORCONTROLPRIMARY
Definition: ddraw.h:369
#define DDCKEYCAPS_DESTOVERLAYCLRSPACE
Definition: ddraw.h:486
#define DDCAPS2_NONLOCALVIDMEMCAPS
Definition: ddraw.h:372
#define DDCAPS_BLTSTRETCH
Definition: ddraw.h:338
#define DDFXCAPS_OVERLAYSHRINKX
Definition: ddraw.h:422
#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV
Definition: ddraw.h:496
#define DDFXCAPS_BLTSTRETCHXN
Definition: ddraw.h:418
#define DDFXALPHACAPS_OVERLAYALPHASURFACES
Definition: ddraw.h:400
#define DDCAPS_ALIGNSIZESRC
Definition: ddraw.h:333
#define DDCKEYCAPS_SRCBLT
Definition: ddraw.h:490
#define DDFXCAPS_BLTSTRETCHY
Definition: ddraw.h:419
#define DDCKEYCAPS_SRCOVERLAYONEACTIVE
Definition: ddraw.h:497
#define DDCAPS_OVERLAYCANTCLIP
Definition: ddraw.h:341
#define DDCAPS_CANCLIPSTRETCHED
Definition: ddraw.h:359
#define DDCAPS_ZBLTS
Definition: ddraw.h:349
#define DDFXCAPS_BLTARITHSTRETCHY
Definition: ddraw.h:407
#define DDCAPS2_CANBOBINTERLEAVED
Definition: ddraw.h:366
#define DDFXCAPS_BLTARITHSTRETCHYN
Definition: ddraw.h:408
#define DDCAPS_BANKSWITCHED
Definition: ddraw.h:356
#define DDPCAPS_1BIT
Definition: ddraw.h:460
#define DDCAPS2_CANBOBNONINTERLEAVED
Definition: ddraw.h:367
#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND
Definition: ddraw.h:397
#define DDCAPS_GDI
Definition: ddraw.h:339
#define DDFXCAPS_BLTSHRINKXN
Definition: ddraw.h:414
#define DDCAPS_VBI
Definition: ddraw.h:348
#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG
Definition: ddraw.h:399
#define DDCAPS2_CANCALIBRATEGAMMA
Definition: ddraw.h:380
#define DDCKEYCAPS_DESTOVERLAYONEACTIVE
Definition: ddraw.h:488
#define DDCAPS_CANCLIP
Definition: ddraw.h:358
#define DDPCAPS_2BIT
Definition: ddraw.h:461
#define DDCAPS_BLTCOLORFILL
Definition: ddraw.h:355
#define DDSVCAPS_RESERVED2
Definition: ddraw.h:438
#define DDFXCAPS_OVERLAYMIRRORUPDOWN
Definition: ddraw.h:431
#define DDCAPS2_WIDESURFACES
Definition: ddraw.h:374
#define DDCAPS2_COPYFOURCC
Definition: ddraw.h:377
#define DDFXCAPS_BLTSTRETCHX
Definition: ddraw.h:417
#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT
Definition: ddraw.h:430
#define DDCAPS_ALIGNSTRIDE
Definition: ddraw.h:334
#define DDPCAPS_8BIT
Definition: ddraw.h:455
#define DDFXALPHACAPS_BLTALPHAEDGEBLEND
Definition: ddraw.h:392
#define DDCKEYCAPS_DESTBLTYUV
Definition: ddraw.h:484
#define DDCAPS2_AUTOFLIPOVERLAY
Definition: ddraw.h:365
#define DDFXCAPS_OVERLAYSTRETCHY
Definition: ddraw.h:428
#define DDFXCAPS_BLTROTATION90
Definition: ddraw.h:412
#define DDFXCAPS_OVERLAYALPHA
Definition: ddraw.h:405
#define DDCAPS_COLORKEY
Definition: ddraw.h:351
#define DDFXCAPS_OVERLAYSTRETCHX
Definition: ddraw.h:426
#define DDCAPS2_CANFLIPODDEVEN
Definition: ddraw.h:375
#define DDCAPS_NOHARDWARE
Definition: ddraw.h:354
#define DDCAPS_BLTFOURCC
Definition: ddraw.h:337
#define DDPCAPS_PRIMARYSURFACELEFT
Definition: ddraw.h:457
#define DDCKEYCAPS_DESTOVERLAYYUV
Definition: ddraw.h:489
#define DDPCAPS_ALPHA
Definition: ddraw.h:462
#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV
Definition: ddraw.h:487
#define DDCAPS2_STEREO
Definition: ddraw.h:385
#define DDFXCAPS_OVERLAYSTRETCHYN
Definition: ddraw.h:429
#define DDCKEYCAPS_SRCOVERLAYCLRSPACE
Definition: ddraw.h:495
#define DDCAPS_ALIGNSIZEDEST
Definition: ddraw.h:331
#define DDFXALPHACAPS_BLTALPHAPIXELSNEG
Definition: ddraw.h:394
#define DDFXCAPS_BLTROTATION
Definition: ddraw.h:411
#define DDFXALPHACAPS_BLTALPHASURFACESNEG
Definition: ddraw.h:396
#define DDCKEYCAPS_SRCBLTCLRSPACE
Definition: ddraw.h:491
#define DDCAPS2_TEXMANINNONLOCALVIDMEM
Definition: ddraw.h:384
#define DDCAPS2_NOPAGELOCKREQUIRED
Definition: ddraw.h:373
#define DDFXCAPS_OVERLAYSHRINKYN
Definition: ddraw.h:425
#define DDCAPS2_CANBOBHARDWARE
Definition: ddraw.h:376
#define DDCAPS2_CANMANAGETEXTURE
Definition: ddraw.h:383
#define DDFXCAPS_BLTSHRINKY
Definition: ddraw.h:415
#define DDPCAPS_INITIALIZE
Definition: ddraw.h:452
#define DDCKEYCAPS_NOCOSTOVERLAY
Definition: ddraw.h:499
#define DDFXCAPS_OVERLAYSHRINKY
Definition: ddraw.h:424
#define DDCAPS_ZOVERLAYS
Definition: ddraw.h:350
#define DDCAPS_COLORKEYHWASSIST
Definition: ddraw.h:353
#define DDCAPS2_VIDEOPORT
Definition: ddraw.h:364
#define DDCAPS2_NO2DDURING3DSCENE
Definition: ddraw.h:363
#define DDCAPS_PALETTEVSYNC
Definition: ddraw.h:345
#define DDPCAPS_4BIT
Definition: ddraw.h:453
#define DDFXCAPS_BLTALPHA
Definition: ddraw.h:404

Referenced by ddraw7_GetCaps().

◆ DDRAW_dump_DDSCAPS2()

void DDRAW_dump_DDSCAPS2 ( const DDSCAPS2 in)

Definition at line 713 of file utils.c.

714{
715 static const struct flag_info flags[] =
716 {
747 };
748 static const struct flag_info flags2[] =
749 {
769 };
770
772 DDRAW_dump_flags(in->dwCaps2, flags2, ARRAY_SIZE(flags2));
773}
static void DDRAW_dump_flags_nolf(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:697
GLuint in
Definition: glext.h:9616
#define DDSCAPS_ALPHA
Definition: surface.c:310
#define DDSCAPS_MODEX
Definition: ddraw.h:271
#define DDSCAPS2_CUBEMAP_NEGATIVEZ
Definition: ddraw.h:296
#define DDSCAPS_FRONTBUFFER
Definition: ddraw.h:254
#define DDSCAPS_ALLOCONLOAD
Definition: ddraw.h:274
#define DDSCAPS2_OPAQUE
Definition: ddraw.h:288
#define DDSCAPS_OVERLAY
Definition: ddraw.h:256
#define DDSCAPS_VISIBLE
Definition: ddraw.h:265
#define DDSCAPS2_HARDWAREDEINTERLACE
Definition: ddraw.h:281
#define DDSCAPS2_RESERVED1
Definition: ddraw.h:286
#define DDSCAPS_HWCODEC
Definition: ddraw.h:270
#define DDSCAPS_RESERVED2
Definition: ddraw.h:273
#define DDSCAPS2_CUBEMAP_POSITIVEX
Definition: ddraw.h:291
#define DDSCAPS_MIPMAP
Definition: ddraw.h:272
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:258
#define DDSCAPS_WRITEONLY
Definition: ddraw.h:266
#define DDSCAPS_OPTIMIZED
Definition: ddraw.h:279
#define DDSCAPS_NONLOCALVIDMEM
Definition: ddraw.h:277
#define DDSCAPS_RESERVED1
Definition: ddraw.h:249
#define DDSCAPS2_MIPMAPSUBLEVEL
Definition: ddraw.h:304
#define DDSCAPS_LIVEVIDEO
Definition: ddraw.h:269
#define DDSCAPS_PALETTE
Definition: ddraw.h:257
#define DDSCAPS2_D3DTEXTUREMANAGE
Definition: ddraw.h:305
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:255
#define DDSCAPS2_RESERVED2
Definition: ddraw.h:287
#define DDSCAPS2_CUBEMAP
Definition: ddraw.h:290
#define DDSCAPS_PRIMARYSURFACELEFT
Definition: ddraw.h:260
#define DDSCAPS_FLIP
Definition: ddraw.h:253
#define DDSCAPS2_HINTDYNAMIC
Definition: ddraw.h:283
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:251
#define DDSCAPS2_CUBEMAP_NEGATIVEY
Definition: ddraw.h:294
#define DDSCAPS2_CUBEMAP_POSITIVEY
Definition: ddraw.h:293
#define DDSCAPS2_CUBEMAP_NEGATIVEX
Definition: ddraw.h:292
#define DDSCAPS2_TEXTUREMANAGE
Definition: ddraw.h:285
#define DDSCAPS2_HINTANTIALIASING
Definition: ddraw.h:289
#define DDSCAPS2_CUBEMAP_POSITIVEZ
Definition: ddraw.h:295
#define DDSCAPS_TEXTURE
Definition: ddraw.h:262
#define DDSCAPS_LOCALVIDMEM
Definition: ddraw.h:276
#define DDSCAPS_OWNDC
Definition: ddraw.h:268
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:261
#define DDSCAPS2_HINTSTATIC
Definition: ddraw.h:284
#define DDSCAPS_VIDEOPORT
Definition: ddraw.h:275
#define DDSCAPS_STANDARDVGAMODE
Definition: ddraw.h:278
#define DDSCAPS2_STEREOSURFACELEFT
Definition: ddraw.h:307
#define DDSCAPS2_DONOTPERSIST
Definition: ddraw.h:306
#define DDSCAPS_COMPLEX
Definition: ddraw.h:252

Referenced by ddraw7_GetAvailableVidMem(), DDRAW_dump_DDCAPS(), DDRAW_dump_DDSCAPS(), and DDRAW_dump_surface_desc().

◆ DDRAW_dump_surface_desc()

void DDRAW_dump_surface_desc ( const DDSURFACEDESC2 lpddsd)

Definition at line 864 of file utils.c.

865{
866#define STRUCT DDSURFACEDESC2
867 static const struct member_info members[] =
868 {
871 ME(DDSD_PITCH, DDRAW_dump_DWORD, u1 /* lPitch */),
872 ME(DDSD_LINEARSIZE, DDRAW_dump_DWORD, u1 /* dwLinearSize */),
873 ME(DDSD_BACKBUFFERCOUNT, DDRAW_dump_DWORD, u5.dwBackBufferCount),
874 ME(DDSD_MIPMAPCOUNT, DDRAW_dump_DWORD, u2 /* dwMipMapCount */),
875 ME(DDSD_ZBUFFERBITDEPTH, DDRAW_dump_DWORD, u2 /* dwZBufferBitDepth */), /* This is for 'old-style' D3D */
876 ME(DDSD_REFRESHRATE, DDRAW_dump_DWORD, u2 /* dwRefreshRate */),
878 ME(DDSD_LPSURFACE, DDRAW_dump_PTR, lpSurface),
879 ME(DDSD_CKDESTOVERLAY, DDRAW_dump_DDCOLORKEY, u3 /* ddckCKDestOverlay */),
880 ME(DDSD_CKDESTBLT, DDRAW_dump_DDCOLORKEY, ddckCKDestBlt),
881 ME(DDSD_CKSRCOVERLAY, DDRAW_dump_DDCOLORKEY, ddckCKSrcOverlay),
882 ME(DDSD_CKSRCBLT, DDRAW_dump_DDCOLORKEY, ddckCKSrcBlt),
883 ME(DDSD_PIXELFORMAT, DDRAW_dump_pixelformat, u4 /* ddpfPixelFormat */)
884 };
885 static const struct member_info members_caps[] =
886 {
888 };
889 static const struct member_info members_caps2[] =
890 {
892 };
893#undef STRUCT
894
895 if (NULL == lpddsd)
896 {
897 TRACE("(null)\n");
898 }
899 else
900 {
901 if (lpddsd->dwSize >= sizeof(DDSURFACEDESC2))
902 {
903 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps2, 1);
904 }
905 else
906 {
907 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps, 1);
908 }
909 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members, ARRAY_SIZE(members));
910 }
911}
#define ME(x, f, e)
#define DDSD_LPSURFACE
Definition: ddrawex.h:22
static void DDRAW_dump_members(DWORD flags, const void *data, const struct member_info *mems, size_t num_mems)
Definition: utils.c:812
static void DDRAW_dump_PTR(const void *in)
Definition: utils.c:687
static void DDRAW_dump_DDSCAPS(const DDSCAPS *in)
Definition: utils.c:776
static void DDRAW_dump_DDCOLORKEY(const DDCOLORKEY *ddck)
Definition: utils.c:692
static void DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf)
Definition: utils.c:827
static void DDRAW_dump_DWORD(const void *in)
Definition: utils.c:682
static const WCHAR dwWidth[]
Definition: provider.c:62
static const WCHAR dwHeight[]
Definition: provider.c:63
GLdouble GLdouble u2
Definition: glext.h:8308
GLdouble u1
Definition: glext.h:8308
static BYTE u3[]
Definition: msg.c:580
static BYTE u5[]
Definition: msg.c:590
static BYTE u4[]
Definition: msg.c:588
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSD_PIXELFORMAT
Definition: ddraw.h:216
DWORD dwAlphaBitDepth
Definition: ddraw.h:3
#define DDSD_PITCH
Definition: ddraw.h:211
#define DDSD_REFRESHRATE
Definition: ddraw.h:222
#define DDSD_MIPMAPCOUNT
Definition: ddraw.h:221
#define DDSD_ALPHABITDEPTH
Definition: ddraw.h:214
#define DDSD_HEIGHT
Definition: ddraw.h:209
#define DDSD_ZBUFFERBITDEPTH
Definition: ddraw.h:213
#define DDSD_CKDESTOVERLAY
Definition: ddraw.h:217
#define DDSD_CKSRCBLT
Definition: ddraw.h:220
#define DDSD_LINEARSIZE
Definition: ddraw.h:223
#define DDSD_CAPS
Definition: ddraw.h:208
#define DDSD_CKDESTBLT
Definition: ddraw.h:218
#define DDSD_BACKBUFFERCOUNT
Definition: ddraw.h:212
#define DDSD_CKSRCOVERLAY
Definition: ddraw.h:219
DWORD dwFlags
Definition: ddraw.h:1153
DWORD dwSize
Definition: ddraw.h:1152

Referenced by ddraw2_CreateSurface(), ddraw4_CreateSurface(), ddraw7_CreateSurface(), ddraw7_GetDisplayMode(), ddraw_surface3_GetSurfaceDesc(), ddraw_surface7_GetSurfaceDesc(), ddraw_surface_create(), and surface_lock().

◆ ddraw_find_decl()

struct wined3d_vertex_declaration * ddraw_find_decl ( struct ddraw ddraw,
DWORD  fvf 
)

Definition at line 4797 of file ddraw.c.

4798{
4799 struct wined3d_vertex_declaration *pDecl = NULL;
4800 HRESULT hr;
4801 int p, low, high; /* deliberately signed */
4802 struct FvfToDecl *convertedDecls = This->decls;
4803
4804 TRACE("Searching for declaration for fvf %08x... ", fvf);
4805
4806 low = 0;
4807 high = This->numConvertedDecls - 1;
4808 while(low <= high) {
4809 p = (low + high) >> 1;
4810 TRACE("%d ", p);
4811 if(convertedDecls[p].fvf == fvf) {
4812 TRACE("found %p\n", convertedDecls[p].decl);
4813 return convertedDecls[p].decl;
4814 } else if(convertedDecls[p].fvf < fvf) {
4815 low = p + 1;
4816 } else {
4817 high = p - 1;
4818 }
4819 }
4820 TRACE("not found. Creating and inserting at position %d.\n", low);
4821
4824 if (hr != S_OK) return NULL;
4825
4826 if (This->declArraySize == This->numConvertedDecls)
4827 {
4828 unsigned int grow = max(This->declArraySize / 2, 8);
4829
4830 if (!(convertedDecls = heap_realloc(convertedDecls,
4831 (This->numConvertedDecls + grow) * sizeof(*convertedDecls))))
4832 {
4834 return NULL;
4835 }
4836 This->decls = convertedDecls;
4837 This->declArraySize += grow;
4838 }
4839
4840 memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low));
4841 convertedDecls[low].decl = pDecl;
4842 convertedDecls[low].fvf = fvf;
4843 This->numConvertedDecls++;
4844
4845 TRACE("Returning %p. %d decls in array\n", pDecl, This->numConvertedDecls);
4846 return pDecl;
4847}
#define S_OK
Definition: intsafe.h:52
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
struct wined3d_vertex_declaration * decl
Definition: ddraw_private.h:51
DWORD fvf
Definition: d3d8_private.h:87
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
HRESULT CDECL wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *device, DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration)

Referenced by d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), and d3d_vertex_buffer_create().

◆ ddraw_free_handle()

void * ddraw_free_handle ( struct ddraw_handle_table t,
DWORD  handle,
enum ddraw_handle_type  type 
)

Definition at line 156 of file main.c.

157{
159 void *object;
160
161 if (handle == DDRAW_INVALID_HANDLE || handle >= t->entry_count)
162 {
163 WARN("Invalid handle %#x passed.\n", handle);
164 return NULL;
165 }
166
167 entry = &t->entries[handle];
168 if (entry->type != type)
169 {
170 WARN("Handle %#x (%p) is not of type %#x.\n", handle, entry->object, type);
171 return NULL;
172 }
173
174 object = entry->object;
175 entry->object = t->free_entries;
176 entry->type = DDRAW_HANDLE_FREE;
177 t->free_entries = entry;
178
179 return object;
180}

Referenced by d3d_device1_DeleteMatrix(), d3d_device7_DeleteStateBlock(), d3d_material3_Release(), and ddraw_surface_wined3d_object_destroyed().

◆ ddraw_get_d3dcaps()

HRESULT ddraw_get_d3dcaps ( const struct ddraw ddraw,
D3DDEVICEDESC7 caps 
)

Definition at line 1248 of file ddraw.c.

1249{
1250 WINED3DCAPS wined3d_caps;
1251 HRESULT hr;
1252
1253 TRACE("ddraw %p, caps %p.\n", ddraw, caps);
1254
1255 memset(&wined3d_caps, 0, sizeof(wined3d_caps));
1256
1260 if (FAILED(hr))
1261 {
1262 WARN("Failed to get device caps, hr %#x.\n", hr);
1263 return hr;
1264 }
1265
1266 caps->dwDevCaps = wined3d_caps.DevCaps;
1267 caps->dpcLineCaps.dwMiscCaps = wined3d_caps.PrimitiveMiscCaps;
1268 caps->dpcLineCaps.dwRasterCaps = wined3d_caps.RasterCaps;
1269 caps->dpcLineCaps.dwZCmpCaps = wined3d_caps.ZCmpCaps;
1270 caps->dpcLineCaps.dwSrcBlendCaps = wined3d_caps.SrcBlendCaps;
1271 caps->dpcLineCaps.dwDestBlendCaps = wined3d_caps.DestBlendCaps;
1272 caps->dpcLineCaps.dwAlphaCmpCaps = wined3d_caps.AlphaCmpCaps;
1273 caps->dpcLineCaps.dwShadeCaps = wined3d_caps.ShadeCaps;
1274 caps->dpcLineCaps.dwTextureCaps = wined3d_caps.TextureCaps;
1277
1278 caps->dwMaxTextureWidth = wined3d_caps.MaxTextureWidth;
1279 caps->dwMaxTextureHeight = wined3d_caps.MaxTextureHeight;
1280
1281 caps->dwMaxTextureRepeat = wined3d_caps.MaxTextureRepeat;
1283 caps->dwMaxAnisotropy = wined3d_caps.MaxAnisotropy;
1284 caps->dvMaxVertexW = wined3d_caps.MaxVertexW;
1285
1286 caps->dvGuardBandLeft = wined3d_caps.GuardBandLeft;
1287 caps->dvGuardBandTop = wined3d_caps.GuardBandTop;
1288 caps->dvGuardBandRight = wined3d_caps.GuardBandRight;
1289 caps->dvGuardBandBottom = wined3d_caps.GuardBandBottom;
1290
1291 caps->dvExtentsAdjust = wined3d_caps.ExtentsAdjust;
1292 caps->dwStencilCaps = wined3d_caps.StencilCaps;
1293
1294 caps->dwFVFCaps = wined3d_caps.FVFCaps;
1295 caps->dwTextureOpCaps = wined3d_caps.TextureOpCaps;
1296
1297 caps->dwVertexProcessingCaps = wined3d_caps.VertexProcessingCaps;
1298 caps->dwMaxActiveLights = wined3d_caps.MaxActiveLights;
1299
1300 /* Remove all non-d3d7 caps */
1301 caps->dwDevCaps &= (
1309
1310 caps->dwStencilCaps &= (
1314
1315 /* FVF caps ?*/
1316
1317 caps->dwTextureOpCaps &= (
1326
1327 caps->dwVertexProcessingCaps &= (
1330
1331 caps->dpcLineCaps.dwMiscCaps &= (
1335
1336 caps->dpcLineCaps.dwRasterCaps &= (
1345
1346 caps->dpcLineCaps.dwZCmpCaps &= (
1350
1351 caps->dpcLineCaps.dwSrcBlendCaps &= (
1357
1358 caps->dpcLineCaps.dwDestBlendCaps &= (
1364
1365 caps->dpcLineCaps.dwAlphaCmpCaps &= (
1369
1370 caps->dpcLineCaps.dwShadeCaps &= (
1378
1379 caps->dpcLineCaps.dwTextureCaps &= (
1384
1392
1396
1398 {
1399 /* DirectX7 always has the np2 flag set, no matter what the card
1400 * supports. Some old games (Rollcage) check the caps incorrectly.
1401 * If wined3d supports nonpow2 textures it also has np2 conditional
1402 * support. */
1404 }
1405
1406 /* Fill the missing members, and do some fixup */
1407 caps->dpcLineCaps.dwSize = sizeof(caps->dpcLineCaps);
1416 caps->dpcLineCaps.dwStippleWidth = 32;
1417 caps->dpcLineCaps.dwStippleHeight = 32;
1418 /* Use the same for the TriCaps */
1419 caps->dpcTriCaps = caps->dpcLineCaps;
1420
1423 caps->dwMinTextureWidth = 1;
1424 caps->dwMinTextureHeight = 1;
1425
1426 /* Convert DWORDs safely to WORDs */
1427 caps->wMaxTextureBlendStages = min(wined3d_caps.MaxTextureBlendStages, 0xffff);
1428 caps->wMaxSimultaneousTextures = min(wined3d_caps.MaxSimultaneousTextures, 0xffff);
1430 caps->wMaxVertexBlendMatrices = min(wined3d_caps.MaxVertexBlendMatrices, 0xffff);
1431
1432 caps->deviceGUID = IID_IDirect3DTnLHalDevice;
1433
1434 caps->dwReserved1 = 0;
1435 caps->dwReserved2 = 0;
1436 caps->dwReserved3 = 0;
1437 caps->dwReserved4 = 0;
1438
1439 return DD_OK;
1440}
#define D3DPCMPCAPS_EQUAL
Definition: d3d8caps.h:90
#define D3DPRASTERCAPS_ANTIALIASEDGES
Definition: d3d8caps.h:77
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
Definition: d3d8caps.h:171
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY
Definition: d3d8caps.h:36
#define D3DTEXOPCAPS_MODULATE2X
Definition: d3d8caps.h:156
#define D3DTEXOPCAPS_ADDSIGNED2X
Definition: d3d8caps.h:160
#define D3DPTADDRESSCAPS_MIRROR
Definition: d3d8caps.h:139
#define D3DPBLENDCAPS_SRCCOLOR
Definition: d3d8caps.h:98
#define D3DDEVCAPS_CANRENDERAFTERFLIP
Definition: d3d8caps.h:43
#define D3DTEXOPCAPS_SELECTARG1
Definition: d3d8caps.h:153
#define D3DVTXPCAPS_LOCALVIEWER
Definition: d3d8caps.h:185
#define D3DPTEXTURECAPS_PROJECTED
Definition: d3d8caps.h:120
#define D3DTEXOPCAPS_BLENDCURRENTALPHA
Definition: d3d8caps.h:167
#define D3DPRASTERCAPS_WBUFFER
Definition: d3d8caps.h:83
#define D3DPBLENDCAPS_DESTCOLOR
Definition: d3d8caps.h:104
#define D3DTEXOPCAPS_ADDSMOOTH
Definition: d3d8caps.h:162
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT
Definition: d3d8caps.h:48
#define D3DPTADDRESSCAPS_WRAP
Definition: d3d8caps.h:138
#define D3DPCMPCAPS_LESS
Definition: d3d8caps.h:89
#define D3DPMISCCAPS_CULLNONE
Definition: d3d8caps.h:58
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC
Definition: d3d8caps.h:136
#define D3DPTFILTERCAPS_MIPFLINEAR
Definition: d3d8caps.h:132
#define D3DPMISCCAPS_CULLCW
Definition: d3d8caps.h:59
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY
Definition: d3d8caps.h:41
#define D3DTEXOPCAPS_ADDSIGNED
Definition: d3d8caps.h:159
#define D3DDEVCAPS_DRAWPRIMITIVES2
Definition: d3d8caps.h:45
#define D3DPBLENDCAPS_INVSRCCOLOR
Definition: d3d8caps.h:99
#define D3DPBLENDCAPS_ZERO
Definition: d3d8caps.h:96
#define D3DSTENCILCAPS_DECR
Definition: d3d8caps.h:151
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM
Definition: d3d8caps.h:166
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY
Definition: d3d8caps.h:40
#define D3DPTFILTERCAPS_MINFANISOTROPIC
Definition: d3d8caps.h:130
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE
Definition: d3d8caps.h:117
#define D3DPBLENDCAPS_INVDESTCOLOR
Definition: d3d8caps.h:105
#define D3DTEXOPCAPS_SUBTRACT
Definition: d3d8caps.h:161
#define D3DPBLENDCAPS_INVDESTALPHA
Definition: d3d8caps.h:103
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
Definition: d3d8caps.h:170
#define D3DSTENCILCAPS_INVERT
Definition: d3d8caps.h:149
#define D3DVTXPCAPS_MATERIALSOURCE7
Definition: d3d8caps.h:182
#define D3DPTFILTERCAPS_MINFLINEAR
Definition: d3d8caps.h:129
#define D3DPTEXTURECAPS_SQUAREONLY
Definition: d3d8caps.h:116
#define D3DDEVCAPS_DRAWPRIMITIVES2EX
Definition: d3d8caps.h:47
#define D3DPTFILTERCAPS_MAGFANISOTROPIC
Definition: d3d8caps.h:135
#define D3DPTEXTURECAPS_ALPHAPALETTE
Definition: d3d8caps.h:118
#define D3DPSHADECAPS_COLORGOURAUDRGB
Definition: d3d8caps.h:109
#define D3DPRASTERCAPS_ZBUFFERLESSHSR
Definition: d3d8caps.h:80
#define D3DPBLENDCAPS_SRCALPHASAT
Definition: d3d8caps.h:106
#define D3DPBLENDCAPS_BOTHSRCALPHA
Definition: d3d8caps.h:107
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY
Definition: d3d8caps.h:37
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE
Definition: d3d8caps.h:174
#define D3DPRASTERCAPS_WFOG
Definition: d3d8caps.h:84
#define D3DPTADDRESSCAPS_BORDER
Definition: d3d8caps.h:141
#define D3DPTADDRESSCAPS_INDEPENDENTUV
Definition: d3d8caps.h:142
#define D3DPSHADECAPS_FOGGOURAUD
Definition: d3d8caps.h:112
#define D3DPTEXTURECAPS_ALPHA
Definition: d3d8caps.h:115
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES
Definition: d3d8caps.h:46
#define D3DTEXOPCAPS_DISABLE
Definition: d3d8caps.h:152
#define D3DPSHADECAPS_SPECULARGOURAUDRGB
Definition: d3d8caps.h:110
#define D3DPMISCCAPS_CULLCCW
Definition: d3d8caps.h:60
#define D3DTEXOPCAPS_SELECTARG2
Definition: d3d8caps.h:154
#define D3DPMISCCAPS_LINEPATTERNREP
Definition: d3d8caps.h:57
#define D3DPCMPCAPS_NOTEQUAL
Definition: d3d8caps.h:93
#define D3DSTENCILCAPS_DECRSAT
Definition: d3d8caps.h:148
#define D3DDEVCAPS_DRAWPRIMTLVERTEX
Definition: d3d8caps.h:42
#define D3DPRASTERCAPS_ANISOTROPY
Definition: d3d8caps.h:82
#define D3DVTXPCAPS_DIRECTIONALLIGHTS
Definition: d3d8caps.h:183
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY
Definition: d3d8caps.h:38
#define D3DPBLENDCAPS_INVSRCALPHA
Definition: d3d8caps.h:101
#define D3DSTENCILCAPS_ZERO
Definition: d3d8caps.h:145
#define D3DPRASTERCAPS_ZFOG
Definition: d3d8caps.h:85
#define D3DPCMPCAPS_GREATER
Definition: d3d8caps.h:92
#define D3DPBLENDCAPS_DESTALPHA
Definition: d3d8caps.h:102
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA
Definition: d3d8caps.h:164
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC
Definition: d3d8caps.h:137
#define D3DSTENCILCAPS_INCR
Definition: d3d8caps.h:150
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL
Definition: d3d8caps.h:119
#define D3DTEXOPCAPS_MODULATE
Definition: d3d8caps.h:155
#define D3DPRASTERCAPS_PAT
Definition: d3d8caps.h:73
#define D3DTEXOPCAPS_BUMPENVMAP
Definition: d3d8caps.h:173
#define D3DPCMPCAPS_ALWAYS
Definition: d3d8caps.h:95
#define D3DPRASTERCAPS_FOGRANGE
Definition: d3d8caps.h:81
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND
Definition: d3d8caps.h:111
#define D3DPTEXTURECAPS_PERSPECTIVE
Definition: d3d8caps.h:113
#define D3DPBLENDCAPS_SRCALPHA
Definition: d3d8caps.h:100
#define D3DDEVCAPS_HWRASTERIZATION
Definition: d3d8caps.h:50
#define D3DPBLENDCAPS_ONE
Definition: d3d8caps.h:97
#define D3DTEXOPCAPS_PREMODULATE
Definition: d3d8caps.h:168
#define D3DPRASTERCAPS_FOGVERTEX
Definition: d3d8caps.h:75
#define D3DTEXOPCAPS_BLENDFACTORALPHA
Definition: d3d8caps.h:165
#define D3DSTENCILCAPS_INCRSAT
Definition: d3d8caps.h:147
#define D3DPCMPCAPS_LESSEQUAL
Definition: d3d8caps.h:91
#define D3DPTFILTERCAPS_MAGFLINEAR
Definition: d3d8caps.h:134
#define D3DPTADDRESSCAPS_CLAMP
Definition: d3d8caps.h:140
#define D3DPTFILTERCAPS_MINFPOINT
Definition: d3d8caps.h:128
#define D3DPTEXTURECAPS_CUBEMAP
Definition: d3d8caps.h:121
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM
Definition: d3d8caps.h:44
#define D3DVTXPCAPS_TEXGEN
Definition: d3d8caps.h:181
#define D3DTEXOPCAPS_DOTPRODUCT3
Definition: d3d8caps.h:175
#define D3DPBLENDCAPS_BOTHINVSRCALPHA
Definition: d3d8caps.h:108
#define D3DPCMPCAPS_NEVER
Definition: d3d8caps.h:88
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL
Definition: d3d8caps.h:49
#define D3DPRASTERCAPS_FOGTABLE
Definition: d3d8caps.h:76
#define D3DSTENCILCAPS_KEEP
Definition: d3d8caps.h:144
#define D3DPTFILTERCAPS_MIPFPOINT
Definition: d3d8caps.h:131
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY
Definition: d3d8caps.h:39
#define D3DPMISCCAPS_MASKZ
Definition: d3d8caps.h:56
#define D3DPCMPCAPS_GREATEREQUAL
Definition: d3d8caps.h:94
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
Definition: d3d8caps.h:169
#define D3DPRASTERCAPS_ZTEST
Definition: d3d8caps.h:74
#define D3DVTXPCAPS_POSITIONALLIGHTS
Definition: d3d8caps.h:184
#define D3DPRASTERCAPS_ZBIAS
Definition: d3d8caps.h:79
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA
Definition: d3d8caps.h:172
#define D3DPTEXTURECAPS_POW2
Definition: d3d8caps.h:114
#define D3DTEXOPCAPS_ADD
Definition: d3d8caps.h:158
#define D3DSTENCILCAPS_REPLACE
Definition: d3d8caps.h:146
#define D3DPTFILTERCAPS_MAGFPOINT
Definition: d3d8caps.h:133
#define D3DPRASTERCAPS_MIPMAPLODBIAS
Definition: d3d8caps.h:78
#define D3DTEXOPCAPS_MODULATE4X
Definition: d3d8caps.h:157
#define D3DPRASTERCAPS_DITHER
Definition: d3d8caps.h:72
#define D3DMAXUSERCLIPPLANES
Definition: d3d8types.h:75
#define D3DPTBLENDCAPS_COPY
Definition: d3dcaps.h:99
#define D3DPTBLENDCAPS_MODULATEALPHA
Definition: d3dcaps.h:96
#define D3DPRASTERCAPS_ROP2
Definition: d3dcaps.h:30
#define D3DPTFILTERCAPS_LINEAR
Definition: d3dcaps.h:88
#define D3DPSHADECAPS_SPECULARFLATMONO
Definition: d3dcaps.h:66
#define D3DPTFILTERCAPS_LINEARMIPNEAREST
Definition: d3dcaps.h:91
#define D3DPTBLENDCAPS_MODULATEMASK
Definition: d3dcaps.h:98
#define D3DDEVCAPS_FLOATTLVERTEX
Definition: d3dcaps.h:116
#define D3DPTBLENDCAPS_MODULATE
Definition: d3dcaps.h:94
#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT
Definition: d3dcaps.h:159
#define D3DPRASTERCAPS_STIPPLE
Definition: d3dcaps.h:38
#define D3DPTEXTURECAPS_BORDER
Definition: d3dcaps.h:85
#define D3DPTFILTERCAPS_NEAREST
Definition: d3dcaps.h:87
#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED
Definition: d3dcaps.h:75
#define D3DPTBLENDCAPS_DECALMASK
Definition: d3dcaps.h:97
#define D3DDEVCAPS_SORTDECREASINGZ
Definition: d3dcaps.h:118
#define D3DPTEXTURECAPS_TRANSPARENCY
Definition: d3dcaps.h:84
#define D3DPSHADECAPS_SPECULARGOURAUDMONO
Definition: d3dcaps.h:68
#define D3DPSHADECAPS_ALPHAPHONGBLEND
Definition: d3dcaps.h:76
#define D3DPSHADECAPS_COLORPHONGRGB
Definition: d3dcaps.h:65
#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED
Definition: d3dcaps.h:77
#define D3DPMISCCAPS_CONFORMANT
Definition: d3dcaps.h:25
#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT
Definition: d3dcaps.h:160
#define D3DPTFILTERCAPS_LINEARMIPLINEAR
Definition: d3dcaps.h:92
#define D3DDEVCAPS_SORTEXACT
Definition: d3dcaps.h:119
#define D3DPTFILTERCAPS_MIPNEAREST
Definition: d3dcaps.h:89
#define D3DPSHADECAPS_SPECULARFLATRGB
Definition: d3dcaps.h:67
#define D3DVTXPCAPS_VERTEXFOG
Definition: d3dcaps.h:242
#define D3DPTEXTURECAPS_COLORKEYBLEND
Definition: d3dcaps.h:236
#define D3DPTBLENDCAPS_ADD
Definition: d3dcaps.h:167
#define D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT
Definition: d3dcaps.h:177
#define D3DPSHADECAPS_COLORFLATMONO
Definition: d3dcaps.h:60
#define D3DPRASTERCAPS_SUBPIXELX
Definition: d3dcaps.h:35
#define D3DPSHADECAPS_ALPHAFLATBLEND
Definition: d3dcaps.h:72
#define D3DPTBLENDCAPS_DECALALPHA
Definition: d3dcaps.h:95
#define D3DPRASTERCAPS_XOR
Definition: d3dcaps.h:31
#define D3DPSHADECAPS_ALPHAFLATSTIPPLED
Definition: d3dcaps.h:73
#define D3DPMISCCAPS_MASKPLANES
Definition: d3dcaps.h:22
#define D3DPRASTERCAPS_SUBPIXEL
Definition: d3dcaps.h:34
#define D3DPSHADECAPS_FOGFLAT
Definition: d3dcaps.h:78
#define D3DPSHADECAPS_FOGPHONG
Definition: d3dcaps.h:80
#define D3DPSHADECAPS_COLORPHONGMONO
Definition: d3dcaps.h:64
#define D3DPSHADECAPS_COLORGOURAUDMONO
Definition: d3dcaps.h:62
#define D3DPSHADECAPS_SPECULARPHONGMONO
Definition: d3dcaps.h:70
#define D3DPSHADECAPS_SPECULARPHONGRGB
Definition: d3dcaps.h:71
#define D3DPSHADECAPS_COLORFLATRGB
Definition: d3dcaps.h:61
#define D3DPTBLENDCAPS_DECAL
Definition: d3dcaps.h:93
#define D3DDEVCAPS_SORTINCREASINGZ
Definition: d3dcaps.h:117
#define D3DPTFILTERCAPS_MIPLINEAR
Definition: d3dcaps.h:90
#define DDBD_24
Definition: ddraw.h:472
#define DDBD_32
Definition: ddraw.h:473
#define DDBD_16
Definition: ddraw.h:471
GUID deviceGUID
Definition: d3dcaps.h:382
WORD wMaxUserClipPlanes
Definition: d3dcaps.h:383
DWORD dwReserved2
Definition: d3dcaps.h:387
DWORD dwVertexProcessingCaps
Definition: d3dcaps.h:385
DWORD dwReserved4
Definition: d3dcaps.h:389
DWORD dwReserved1
Definition: d3dcaps.h:386
WORD wMaxVertexBlendMatrices
Definition: d3dcaps.h:384
DWORD dwReserved3
Definition: d3dcaps.h:388
D3DVALUE dvMaxVertexW
Definition: d3dcaps.h:381
DWORD dwZCmpCaps
Definition: d3dcaps.h:267
DWORD dwMiscCaps
Definition: d3dcaps.h:265
DWORD dwDestBlendCaps
Definition: d3dcaps.h:269
DWORD dwAlphaCmpCaps
Definition: d3dcaps.h:270
DWORD dwRasterCaps
Definition: d3dcaps.h:266
DWORD dwTextureBlendCaps
Definition: d3dcaps.h:274
DWORD dwStippleWidth
Definition: d3dcaps.h:276
DWORD dwShadeCaps
Definition: d3dcaps.h:271
DWORD dwSize
Definition: d3dcaps.h:264
DWORD dwStippleHeight
Definition: d3dcaps.h:277
DWORD dwTextureAddressCaps
Definition: d3dcaps.h:275
DWORD dwTextureFilterCaps
Definition: d3dcaps.h:273
DWORD dwSrcBlendCaps
Definition: d3dcaps.h:268
DWORD dwTextureCaps
Definition: d3dcaps.h:272
DWORD DevCaps
Definition: wined3d.h:1895
DWORD MaxTextureAspectRatio
Definition: wined3d.h:1915
DWORD ShadeCaps
Definition: wined3d.h:1902
DWORD PrimitiveMiscCaps
Definition: wined3d.h:1896
float GuardBandRight
Definition: wined3d.h:1921
DWORD TextureFilterCaps
Definition: wined3d.h:1904
DWORD MaxTextureHeight
Definition: wined3d.h:1912
DWORD MaxAnisotropy
Definition: wined3d.h:1916
DWORD MaxTextureWidth
Definition: wined3d.h:1911
float MaxVertexW
Definition: wined3d.h:1917
DWORD AlphaCmpCaps
Definition: wined3d.h:1901
DWORD TextureAddressCaps
Definition: wined3d.h:1907
float GuardBandBottom
Definition: wined3d.h:1922
DWORD MaxTextureRepeat
Definition: wined3d.h:1914
DWORD StencilCaps
Definition: wined3d.h:1925
DWORD MaxUserClipPlanes
Definition: wined3d.h:1934
DWORD VertexProcessingCaps
Definition: wined3d.h:1932
DWORD TextureCaps
Definition: wined3d.h:1903
DWORD MaxTextureBlendStages
Definition: wined3d.h:1929
DWORD DestBlendCaps
Definition: wined3d.h:1900
float ExtentsAdjust
Definition: wined3d.h:1924
float GuardBandLeft
Definition: wined3d.h:1919
DWORD TextureOpCaps
Definition: wined3d.h:1928
DWORD MaxVertexBlendMatrices
Definition: wined3d.h:1935
DWORD ZCmpCaps
Definition: wined3d.h:1898
DWORD MaxSimultaneousTextures
Definition: wined3d.h:1930
float GuardBandTop
Definition: wined3d.h:1920
DWORD FVFCaps
Definition: wined3d.h:1927
DWORD RasterCaps
Definition: wined3d.h:1897
DWORD SrcBlendCaps
Definition: wined3d.h:1899
DWORD MaxActiveLights
Definition: wined3d.h:1933
struct wined3d * wined3d
Definition: ddraw_private.h:92
HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, WINED3DCAPS *caps)
Definition: directx.c:5659
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:87

Referenced by d3d3_EnumDevices(), d3d3_FindDevice(), d3d7_EnumDevices(), d3d_device3_GetCaps(), and d3d_device7_GetCaps().

◆ ddraw_get_object()

void * ddraw_get_object ( struct ddraw_handle_table t,
DWORD  handle,
enum ddraw_handle_type  type 
)

Definition at line 182 of file main.c.

183{
185
186 if (handle == DDRAW_INVALID_HANDLE || handle >= t->entry_count)
187 {
188 WARN("Invalid handle %#x passed.\n", handle);
189 return NULL;
190 }
191
192 entry = &t->entries[handle];
193 if (entry->type != type)
194 {
195 WARN("Handle %#x (%p) is not of type %#x.\n", handle, entry->object, type);
196 return NULL;
197 }
198
199 return entry->object;
200}

Referenced by d3d_device1_GetMatrix(), d3d_device1_SetMatrix(), d3d_device3_SetLightState(), d3d_device3_SetRenderState(), d3d_device7_ApplyStateBlock(), d3d_device7_CaptureStateBlock(), and d3d_viewport_SetBackground().

◆ ddraw_handle_table_destroy()

void ddraw_handle_table_destroy ( struct ddraw_handle_table t)

Definition at line 107 of file main.c.

108{
109 heap_free(t->entries);
110 memset(t, 0, sizeof(*t));
111}

Referenced by d3d_device_init(), and d3d_device_inner_Release().

◆ ddraw_handle_table_init()

BOOL ddraw_handle_table_init ( struct ddraw_handle_table t,
UINT  initial_size 
)

Definition at line 93 of file main.c.

94{
95 if (!(t->entries = heap_alloc_zero(initial_size * sizeof(*t->entries))))
96 {
97 ERR("Failed to allocate handle table memory.\n");
98 return FALSE;
99 }
100 t->free_entries = NULL;
101 t->table_size = initial_size;
102 t->entry_count = 0;
103
104 return TRUE;
105}

Referenced by d3d_device_init().

◆ ddraw_init()

HRESULT ddraw_init ( struct ddraw ddraw,
DWORD  flags,
enum wined3d_device_type  device_type 
)

Definition at line 5048 of file ddraw.c.

5049{
5050 WINED3DCAPS caps;
5051 HRESULT hr;
5052
5057 ddraw->IDirect3D_iface.lpVtbl = &d3d1_vtbl;
5058 ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl;
5059 ddraw->IDirect3D3_iface.lpVtbl = &d3d3_vtbl;
5060 ddraw->IDirect3D7_iface.lpVtbl = &d3d7_vtbl;
5062 ddraw->numIfaces = 1;
5063 ddraw->ref7 = 1;
5064
5066 if (!(ddraw->wined3d = wined3d_create(flags)))
5067 {
5069 if (!(ddraw->wined3d = wined3d_create(flags)))
5070 {
5071 WARN("Failed to create a wined3d object.\n");
5072 return E_FAIL;
5073 }
5074 }
5075
5077 {
5078 ERR("Failed to get device caps, hr %#x.\n", hr);
5080 return E_FAIL;
5081 }
5082
5083 if (!(caps.ddraw_caps.caps & WINEDDCAPS_3D))
5084 {
5085 WARN("Created a wined3d object without 3D support.\n");
5087 }
5088
5091 {
5092 WARN("Failed to create a wined3d device, hr %#x.\n", hr);
5094 return hr;
5095 }
5096
5098
5099 return DD_OK;
5100}
#define DDRAW_STRIDE_ALIGNMENT
Definition: ddraw_private.h:62
#define DDRAW_WINED3D_FLAGS
Definition: ddraw_private.h:64
#define E_FAIL
Definition: ddrawi.h:102
device_type
static const struct IDirect3D3Vtbl d3d3_vtbl
Definition: ddraw.c:4730
static const struct IDirect3D7Vtbl d3d7_vtbl
Definition: ddraw.c:4716
static const struct IDirect3D2Vtbl d3d2_vtbl
Definition: ddraw.c:4748
static const struct IDirectDraw2Vtbl ddraw2_vtbl
Definition: ddraw.c:4656
static const struct IDirectDraw7Vtbl ddraw7_vtbl
Definition: ddraw.c:4579
static const struct IDirect3DVtbl d3d1_vtbl
Definition: ddraw.c:4763
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops
Definition: ddraw.c:5037
static const struct IDirectDraw4Vtbl ddraw4_vtbl
Definition: ddraw.c:4619
static struct IDirectDrawVtbl ddraw1_vtbl
Definition: ddraw.c:4687
struct wined3d_ddraw_caps ddraw_caps
Definition: wined3d.h:1973
IDirectDraw2 IDirectDraw2_iface
Definition: ddraw_private.h:81
IDirect3D3 IDirect3D3_iface
Definition: ddraw_private.h:84
struct wined3d_device * wined3d_device
Definition: ddraw_private.h:93
IDirect3D IDirect3D_iface
Definition: ddraw_private.h:86
LONG ref7
Definition: ddraw_private.h:90
struct list surface_list
IDirectDraw4 IDirectDraw4_iface
Definition: ddraw_private.h:80
LONG numIfaces
Definition: ddraw_private.h:90
IDirect3D7 IDirect3D7_iface
Definition: ddraw_private.h:83
struct wined3d_device_parent device_parent
Definition: ddraw_private.h:87
IDirect3D2 IDirect3D2_iface
Definition: ddraw_private.h:85
IDirectDraw IDirectDraw_iface
Definition: ddraw_private.h:82
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
Definition: directx.c:465
HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, HWND focus_window, DWORD flags, BYTE surface_alignment, struct wined3d_device_parent *device_parent, struct wined3d_device **device)
Definition: directx.c:6244
#define WINED3D_NO3D
Definition: wined3d.h:1316
#define WINED3DADAPTER_DEFAULT
Definition: wined3d.h:857
#define WINEDDCAPS_3D
Definition: wined3d.h:1495
struct wined3d *CDECL wined3d_create(DWORD flags)
Definition: wined3d_main.c:97

Referenced by DDRAW_Create().

◆ ddraw_palette_init()

HRESULT ddraw_palette_init ( struct ddraw_palette palette,
struct ddraw ddraw,
DWORD  flags,
PALETTEENTRY entries 
)

Definition at line 258 of file palette.c.

260{
261 unsigned int entry_count;
262 DWORD wined3d_flags = 0;
263 HRESULT hr;
264
265 if ((entry_count = palette_size(flags)) == ~0u)
266 {
267 WARN("Invalid flags %#x.\n", flags);
268 return DDERR_INVALIDPARAMS;
269 }
270
272 wined3d_flags |= WINED3D_PALETTE_8BIT_ENTRIES;
274 wined3d_flags |= WINED3D_PALETTE_ALLOW_256;
275 if (flags & DDPCAPS_ALPHA)
276 wined3d_flags |= WINED3D_PALETTE_ALPHA;
277
278 palette->IDirectDrawPalette_iface.lpVtbl = &ddraw_palette_vtbl;
279 palette->ref = 1;
280 palette->flags = flags;
281
283 wined3d_flags, entry_count, entries, &palette->wined3d_palette)))
284 {
285 WARN("Failed to create wined3d palette, hr %#x.\n", hr);
286 return hr;
287 }
288
289 palette->ddraw = ddraw;
290 palette->ifaceToRelease = (IUnknown *)&ddraw->IDirectDraw7_iface;
291 IUnknown_AddRef(palette->ifaceToRelease);
292
293 return DD_OK;
294}
static const struct IDirectDrawPaletteVtbl ddraw_palette_vtbl
Definition: palette.c:221
static unsigned int palette_size(DWORD flags)
Definition: palette.c:241
HRESULT CDECL wined3d_palette_create(struct wined3d_device *device, DWORD flags, unsigned int entry_count, const PALETTEENTRY *entries, struct wined3d_palette **palette)
Definition: palette.c:162
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static HPALETTE palette
Definition: clipboard.c:1345
#define WINED3D_PALETTE_8BIT_ENTRIES
Definition: wined3d.h:1554
#define WINED3D_PALETTE_ALLOW_256
Definition: wined3d.h:1555
#define WINED3D_PALETTE_ALPHA
Definition: wined3d.h:1556

Referenced by ddraw7_CreatePalette().

◆ ddraw_set_swapchain_window()

static void ddraw_set_swapchain_window ( struct ddraw ddraw,
HWND  window 
)
inlinestatic

Definition at line 135 of file ddraw_private.h.

136{
137 if (window == GetDesktopWindow())
138 window = NULL;
140}
static IHTMLWindow2 * window
Definition: events.c:77
HWND swapchain_window
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628

Referenced by ddraw_create_swapchain(), ddraw_destroy_swapchain(), and ddraw_surface7_SetClipper().

◆ ddraw_surface_create()

HRESULT ddraw_surface_create ( struct ddraw ddraw,
const DDSURFACEDESC2 surface_desc,
struct ddraw_surface **  surface,
IUnknown outer_unknown,
unsigned int  version 
)

Definition at line 5791 of file surface.c.

5793{
5794 struct wined3d_sub_resource_desc wined3d_mip_desc;
5795 struct ddraw_surface *root, *mip, **attach;
5796 struct wined3d_resource_desc wined3d_desc;
5799 DDSURFACEDESC2 *desc, *mip_desc;
5800 struct ddraw_texture *texture;
5801 unsigned int layers = 1;
5802 unsigned int pitch = 0;
5803 UINT levels, i, j;
5804 HRESULT hr;
5805
5806 TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p, version %u.\n",
5807 ddraw, surface_desc, surface, outer_unknown, version);
5808 if (TRACE_ON(ddraw))
5809 {
5810 TRACE("Requesting surface desc:\n");
5812 }
5813
5814 if (outer_unknown)
5815 return CLASS_E_NOAGGREGATION;
5816
5817 if (!surface)
5818 return E_POINTER;
5819
5820 if (!(texture = heap_alloc(sizeof(*texture))))
5821 return E_OUTOFMEMORY;
5822
5823 texture->version = version;
5824 texture->surface_desc = *surface_desc;
5825 desc = &texture->surface_desc;
5826
5827 /* Ensure DDSD_CAPS is always set. */
5828 desc->dwFlags |= DDSD_CAPS;
5829
5830 if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
5831 {
5832 if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount)
5833 {
5834 WARN("Tried to create a flippable surface without any back buffers.\n");
5836 return DDERR_INVALIDCAPS;
5837 }
5838
5839 if (!(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
5840 {
5841 WARN("Tried to create a flippable surface without DDSCAPS_COMPLEX.\n");
5843 return DDERR_INVALIDCAPS;
5844 }
5845
5846 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
5847 {
5848 WARN("Tried to create a flippable cubemap.\n");
5850 return DDERR_INVALIDPARAMS;
5851 }
5852
5853 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
5854 {
5855 FIXME("Flippable textures not implemented.\n");
5857 return DDERR_INVALIDCAPS;
5858 }
5859 }
5860 else
5861 {
5862 if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
5863 {
5864 WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
5867 return hr;
5868 }
5869 }
5870
5871 if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
5872 {
5873 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
5874 {
5875 WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
5877 return DDERR_INVALIDCAPS;
5878 }
5879
5880 if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) && !(desc->ddsCaps.dwCaps & DDSCAPS_FLIP))
5881 {
5882 WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
5884 return DDERR_INVALIDCAPS;
5885 }
5886
5887 if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
5888 {
5889 WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
5891 return DDERR_NOEXCLUSIVEMODE;
5892 }
5893 }
5894
5895 /* This is a special case in ddrawex, but not allowed in ddraw. */
5896 if ((desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
5898 {
5899 WARN("Tried to create a surface in both system and video memory.\n");
5901 return DDERR_INVALIDCAPS;
5902 }
5903
5904 if ((desc->ddsCaps.dwCaps & (DDSCAPS_ALLOCONLOAD | DDSCAPS_MIPMAP))
5905 && !(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
5906 {
5907 WARN("Caps %#x require DDSCAPS_TEXTURE.\n", desc->ddsCaps.dwCaps);
5909 return DDERR_INVALIDCAPS;
5910 }
5911
5912 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES)
5913 && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
5914 {
5915 WARN("Cube map faces requested without cube map flag.\n");
5917 return DDERR_INVALIDCAPS;
5918 }
5919
5920 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
5921 && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES))
5922 {
5923 WARN("Cube map without faces requested.\n");
5925 return DDERR_INVALIDPARAMS;
5926 }
5927
5928 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
5929 && (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) != DDSCAPS2_CUBEMAP_ALLFACES)
5930 FIXME("Partial cube maps not implemented.\n");
5931
5932 if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
5933 {
5934 if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
5935 {
5936 WARN("DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.\n");
5938 return DDERR_INVALIDCAPS;
5939 }
5940 if (desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
5941 {
5942 WARN("DDSCAPS2_TEXTUREMANAGE used width DDSCAPS_VIDEOMEMORY "
5943 "or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.\n");
5945 return DDERR_INVALIDCAPS;
5946 }
5947 }
5948
5950 {
5951 ERR("Failed to get display mode, hr %#x.\n", hr);
5953 return hr_ddraw_from_wined3d(hr);
5954 }
5955
5956 /* No pixelformat given? Use the current screen format. */
5957 if (!(desc->dwFlags & DDSD_PIXELFORMAT))
5958 {
5959 desc->dwFlags |= DDSD_PIXELFORMAT;
5960 desc->u4.ddpfPixelFormat.dwSize = sizeof(desc->u4.ddpfPixelFormat);
5961 ddrawformat_from_wined3dformat(&desc->u4.ddpfPixelFormat, mode.format_id);
5962 }
5963
5964 wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
5965 wined3d_desc.format = wined3dformat_from_ddrawformat(&desc->u4.ddpfPixelFormat);
5966 if (wined3d_desc.format == WINED3DFMT_UNKNOWN)
5967 {
5968 WARN("Unsupported / unknown pixelformat.\n");
5971 }
5972
5973 /* No width or no height? Use the screen size. */
5974 if (!(desc->dwFlags & DDSD_WIDTH) || !(desc->dwFlags & DDSD_HEIGHT))
5975 {
5976 if (!(desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
5977 {
5978 WARN("No width / height specified.\n");
5980 return DDERR_INVALIDPARAMS;
5981 }
5982
5983 desc->dwFlags |= DDSD_WIDTH | DDSD_HEIGHT;
5984 desc->dwWidth = mode.width;
5985 desc->dwHeight = mode.height;
5986 }
5987
5988 if (!desc->dwWidth || !desc->dwHeight)
5989 {
5991 return DDERR_INVALIDPARAMS;
5992 }
5993
5994 if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
5995 desc->ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER;
5996
5997 if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
5998 {
5999 /* The first surface is a front buffer, the back buffers are created
6000 * afterwards. */
6001 desc->ddsCaps.dwCaps |= DDSCAPS_VISIBLE;
6003 {
6004 struct wined3d_swapchain_desc swapchain_desc;
6005
6007 swapchain_desc.backbuffer_width = mode.width;
6008 swapchain_desc.backbuffer_height = mode.height;
6009 swapchain_desc.backbuffer_format = mode.format_id;
6010
6012 &swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE)))
6013 {
6014 ERR("Failed to reset device.\n");
6016 return hr_ddraw_from_wined3d(hr);
6017 }
6018
6020 !!swapchain_desc.enable_auto_depth_stencil);
6021 }
6022 }
6023
6024 wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
6025 wined3d_desc.multisample_quality = 0;
6026 wined3d_desc.usage = 0;
6028 wined3d_desc.width = desc->dwWidth;
6029 wined3d_desc.height = desc->dwHeight;
6030 wined3d_desc.depth = 1;
6031 wined3d_desc.size = 0;
6032
6033 if ((desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && (ddraw->flags & DDRAW_NO3D))
6034 {
6035 WARN("The application requests a 3D capable surface, but the ddraw object was created without 3D support.\n");
6036 /* Do not fail surface creation, only fail 3D device creation. */
6037 }
6038
6039 /* Mipmap count fixes */
6040 if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP)
6041 {
6042 if (desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX)
6043 {
6044 if (desc->dwFlags & DDSD_MIPMAPCOUNT)
6045 {
6046 /* Mipmap count is given, should not be 0. */
6047 if (!desc->u2.dwMipMapCount)
6048 {
6050 return DDERR_INVALIDPARAMS;
6051 }
6052 }
6053 else
6054 {
6055 /* Undocumented feature: Create sublevels until either the
6056 * width or the height is 1. */
6057 if (version == 7)
6058 desc->u2.dwMipMapCount = wined3d_log2i(max(desc->dwWidth, desc->dwHeight)) + 1;
6059 else
6060 desc->u2.dwMipMapCount = wined3d_log2i(min(desc->dwWidth, desc->dwHeight)) + 1;
6061 }
6062 }
6063 else
6064 {
6065 desc->u2.dwMipMapCount = 1;
6066 }
6067
6068 desc->dwFlags |= DDSD_MIPMAPCOUNT;
6069 levels = desc->u2.dwMipMapCount;
6070 }
6071 else
6072 {
6073 levels = 1;
6074 }
6075
6076 if (!(desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY)))
6077 {
6078 if (!(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)))
6079 {
6080 DWORD usage = 0;
6081
6082 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6084 else if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
6086
6087 if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
6089 else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
6091
6093 WINED3D_DEVICE_TYPE_HAL, mode.format_id, usage, WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
6094 desc->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
6095 else
6096 desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
6097 }
6098 else if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
6099 {
6100 /* Tests show surfaces without memory flags get these flags added
6101 * right after creation. */
6102 desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY;
6103 }
6104 }
6105
6106 if ((desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
6108 {
6109 WARN("System memory overlays are not allowed.\n");
6111 return DDERR_NOOVERLAYHW;
6112 }
6113
6114 if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
6115 {
6116 /*
6117 * The ddraw RGB device allows to use system memory surfaces as rendering target.
6118 * This does not cause problems because the RGB device does software rasterization
6119 * though it will fail with hardware accelerated ddraw. In order to be partially
6120 * compatible with games requesting explicitly the RGB device, we ignore the
6121 * specified location and try to create rendering targets in video memory if
6122 * possible.
6123 */
6124 if ((desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) &&
6127 WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
6128 {
6129 FIXME("Application wants to create rendering target in system memory, using video memory instead\n");
6130 wined3d_desc.usage |= WINED3DUSAGE_RENDERTARGET;
6131 }
6132 else
6133 wined3d_desc.access = WINED3D_RESOURCE_ACCESS_CPU
6135 }
6136 else
6137 {
6138 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
6139 wined3d_desc.usage |= WINED3DUSAGE_TEXTURE;
6140 if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
6141 wined3d_desc.usage |= WINED3DUSAGE_DEPTHSTENCIL;
6142 else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
6143 wined3d_desc.usage |= WINED3DUSAGE_RENDERTARGET;
6144
6145 if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
6146 {
6149 /* Managed textures have the system memory flag set. */
6150 desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
6151 }
6152 else if (desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
6153 {
6154 /* Videomemory adds localvidmem. This is mutually exclusive with
6155 * systemmemory and texturemanage. */
6156 desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM;
6157 wined3d_desc.usage |= WINED3DUSAGE_DYNAMIC;
6158 }
6159 }
6160
6161 if (desc->dwFlags & DDSD_LPSURFACE)
6162 {
6163 if (wined3d_desc.access & WINED3D_RESOURCE_ACCESS_GPU)
6164 {
6165 WARN("User memory surfaces should not be GPU accessible.\n");
6167 return DDERR_INVALIDCAPS;
6168 }
6169
6170 if (version < 4)
6171 {
6172 WARN("User memory surfaces not supported before version 4.\n");
6174 return DDERR_INVALIDPARAMS;
6175 }
6176
6177 if (!desc->lpSurface)
6178 {
6179 WARN("NULL surface memory pointer specified.\n");
6181 return DDERR_INVALIDPARAMS;
6182 }
6183
6184 if (format_is_compressed(&desc->u4.ddpfPixelFormat))
6185 {
6186 if (version != 4 && (desc->dwFlags & DDSD_PITCH))
6187 {
6188 WARN("Pitch specified on a compressed user memory surface.\n");
6190 return DDERR_INVALIDPARAMS;
6191 }
6192
6193 if (!(desc->dwFlags & (DDSD_LINEARSIZE | DDSD_PITCH)))
6194 {
6195 WARN("Compressed user memory surfaces should explicitly specify the linear size.\n");
6197 return DDERR_INVALIDPARAMS;
6198 }
6199
6200 if ((desc->dwFlags & DDSD_LINEARSIZE)
6202 wined3d_desc.format, wined3d_desc.width) * ((desc->dwHeight + 3) / 4))
6203 {
6204 WARN("Invalid linear size %u specified.\n", desc->u1.dwLinearSize);
6206 return DDERR_INVALIDPARAMS;
6207 }
6208 }
6209 else
6210 {
6211 if (!(desc->dwFlags & DDSD_PITCH))
6212 {
6213 WARN("User memory surfaces should explicitly specify the pitch.\n");
6215 return DDERR_INVALIDPARAMS;
6216 }
6217
6219 wined3d_desc.format, wined3d_desc.width) || desc->u1.lPitch & 3)
6220 {
6221 WARN("Invalid pitch %u specified.\n", desc->u1.lPitch);
6223 return DDERR_INVALIDPARAMS;
6224 }
6225
6226 pitch = desc->u1.lPitch;
6227 }
6228 }
6229
6230 if (((desc->dwFlags & DDSD_CKDESTOVERLAY)
6231 && desc->u3.ddckCKDestOverlay.dwColorSpaceLowValue != desc->u3.ddckCKDestOverlay.dwColorSpaceHighValue)
6232 || ((desc->dwFlags & DDSD_CKDESTBLT)
6233 && desc->ddckCKDestBlt.dwColorSpaceLowValue != desc->ddckCKDestBlt.dwColorSpaceHighValue)
6234 || ((desc->dwFlags & DDSD_CKSRCOVERLAY)
6235 && desc->ddckCKSrcOverlay.dwColorSpaceLowValue != desc->ddckCKSrcOverlay.dwColorSpaceHighValue)
6236 || ((desc->dwFlags & DDSD_CKSRCBLT)
6237 && desc->ddckCKSrcBlt.dwColorSpaceLowValue != desc->ddckCKSrcBlt.dwColorSpaceHighValue))
6238 {
6239 WARN("Range color keys not supported, returning DDERR_NOCOLORKEYHW.\n");
6241 return DDERR_NOCOLORKEYHW;
6242 }
6243
6244 if (desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY))
6245 wined3d_desc.usage |= WINED3DUSAGE_OVERLAY;
6246
6247 if (desc->ddsCaps.dwCaps & DDSCAPS_OWNDC)
6248 wined3d_desc.usage |= WINED3DUSAGE_OWNDC;
6249
6250 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6251 {
6252 wined3d_desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
6253 layers = 6;
6254 }
6255
6256 /* Some applications assume surfaces will always be mapped at the same
6257 * address. Some of those also assume that this address is valid even when
6258 * the surface isn't mapped, and that updates done this way will be
6259 * visible on the screen. The game Nox is such an application,
6260 * Commandos: Behind Enemy Lines is another. Setting
6261 * WINED3D_TEXTURE_CREATE_GET_DC_LENIENT will ensure this. */
6262 if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, layers, levels,
6265 {
6266 WARN("Failed to create wined3d texture, hr %#x.\n", hr);
6268 return hr_ddraw_from_wined3d(hr);
6269 }
6270
6273 root->is_complex_root = TRUE;
6274 texture->root = root;
6276
6277 if (desc->dwFlags & DDSD_CKDESTOVERLAY)
6279 (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay);
6280 if (desc->dwFlags & DDSD_CKDESTBLT)
6282 (struct wined3d_color_key *)&desc->ddckCKDestBlt);
6283 if (desc->dwFlags & DDSD_CKSRCOVERLAY)
6285 (struct wined3d_color_key *)&desc->ddckCKSrcOverlay);
6286 if (desc->dwFlags & DDSD_CKSRCBLT)
6288 (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
6289
6290 for (i = 0; i < layers; ++i)
6291 {
6292 attach = &root->complex_array[layers - 1 - i];
6293
6294 for (j = 0; j < levels; ++j)
6295 {
6297 mip_desc = &mip->surface_desc;
6298
6299 if (j)
6300 {
6302 mip_desc->dwWidth = wined3d_mip_desc.width;
6303 mip_desc->dwHeight = wined3d_mip_desc.height;
6304
6305 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL;
6306 }
6307 else
6308 {
6309 mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL;
6310 }
6311
6312 if (mip_desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6313 {
6314 mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES;
6315
6316 switch (i)
6317 {
6319 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX;
6320 break;
6322 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX;
6323 break;
6325 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY;
6326 break;
6328 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY;
6329 break;
6331 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ;
6332 break;
6334 mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ;
6335 break;
6336 }
6337
6338 }
6339
6340 if (mip == root)
6341 continue;
6342
6343 *attach = mip;
6344 attach = &mip->complex_array[0];
6345 }
6346 }
6347
6349 wined3d_desc.width, wined3d_desc.height, wined3d_desc.format,
6350 WINED3D_MULTISAMPLE_NONE, 0, desc->lpSurface, pitch)))
6351 {
6352 ERR("Failed to set surface memory, hr %#x.\n", hr);
6353 goto fail;
6354 }
6355
6356 if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
6357 {
6358 unsigned int count = desc->u5.dwBackBufferCount;
6359 struct ddraw_surface *last = root;
6360
6361 attach = &last->complex_array[0];
6362 for (i = 0; i < count; ++i)
6363 {
6364 if (!(texture = heap_alloc(sizeof(*texture))))
6365 {
6366 hr = E_OUTOFMEMORY;
6367 goto fail;
6368 }
6369
6370 texture->version = version;
6371 texture->surface_desc = root->surface_desc;
6372 desc = &texture->surface_desc;
6373
6374 /* Only one surface in the flipping chain is a back buffer, one is
6375 * a front buffer, the others are just flippable surfaces. */
6378 if (!i)
6379 desc->ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
6380 desc->u5.dwBackBufferCount = 0;
6381
6382 if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, 1, 1,
6385 {
6388 goto fail;
6389 }
6390
6393 texture->root = last;
6395
6396 if (desc->dwFlags & DDSD_CKDESTOVERLAY)
6398 (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay);
6399 if (desc->dwFlags & DDSD_CKDESTBLT)
6401 (struct wined3d_color_key *)&desc->ddckCKDestBlt);
6402 if (desc->dwFlags & DDSD_CKSRCOVERLAY)
6404 (struct wined3d_color_key *)&desc->ddckCKSrcOverlay);
6405 if (desc->dwFlags & DDSD_CKSRCBLT)
6407 (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
6408
6409 *attach = last;
6410 attach = &last->complex_array[0];
6411 }
6412 *attach = root;
6413 }
6414
6416 ddraw->primary = root;
6417 *surface = root;
6418
6419 return DD_OK;
6420
6421fail:
6422 if (version == 7)
6423 IDirectDrawSurface7_Release(&root->IDirectDrawSurface7_iface);
6424 else if (version == 4)
6425 IDirectDrawSurface4_Release(&root->IDirectDrawSurface4_iface);
6426 else
6427 IDirectDrawSurface_Release(&root->IDirectDrawSurface_iface);
6428
6429 return hr;
6430}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
struct _root root
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN
Definition: utils.c:864
static BOOL format_is_compressed(const DDPIXELFORMAT *format)
void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format, enum wined3d_format_id wined3d_format) DECLSPEC_HIDDEN
Definition: utils.c:33
HRESULT hr_ddraw_from_wined3d(HRESULT hr) DECLSPEC_HIDDEN
Definition: utils.c:1206
enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format) DECLSPEC_HIDDEN
Definition: utils.c:333
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops
Definition: surface.c:5781
static HRESULT CDECL ddraw_reset_enum_callback(struct wined3d_resource *resource)
Definition: surface.c:5786
HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, wined3d_device_reset_cb callback, BOOL reset_state)
Definition: device.c:4771
ULONG CDECL wined3d_device_incref(struct wined3d_device *device)
Definition: device.c:456
HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc)
Definition: texture.c:3480
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:3511
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:3449
HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT width, UINT height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type, UINT multisample_quality, void *mem, UINT pitch)
Definition: texture.c:1356
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1023
HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture, DWORD flags, const struct wined3d_color_key *color_key)
Definition: texture.c:1235
GLenum GLuint texture
Definition: glext.h:6295
GLenum mode
Definition: glext.h:6217
GLsizei levels
Definition: glext.h:7884
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLi