ReactOS 0.4.16-dev-297-gc569aee
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:4801
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 1196 of file ddraw.c.

1197{
1198 memset(caps1, 0, sizeof(*caps1));
1199 caps1->dwSize = sizeof(*caps1);
1200 caps1->dwFlags = D3DDD_COLORMODEL
1211 caps1->dcmColorModel = D3DCOLOR_RGB;
1212 caps1->dwDevCaps = caps7->dwDevCaps;
1213 caps1->dtcTransformCaps.dwSize = sizeof(caps1->dtcTransformCaps);
1215 caps1->bClipping = TRUE;
1216 caps1->dlcLightingCaps.dwSize = sizeof(caps1->dlcLightingCaps);
1223 caps1->dpcLineCaps = caps7->dpcLineCaps;
1224 caps1->dpcTriCaps = caps7->dpcTriCaps;
1227 caps1->dwMaxBufferSize = 0;
1228 caps1->dwMaxVertexCount = 65536;
1229 caps1->dwMinTextureWidth = caps7->dwMinTextureWidth;
1230 caps1->dwMinTextureHeight = caps7->dwMinTextureHeight;
1231 caps1->dwMaxTextureWidth = caps7->dwMaxTextureWidth;
1232 caps1->dwMaxTextureHeight = caps7->dwMaxTextureHeight;
1233 caps1->dwMinStippleWidth = 1;
1234 caps1->dwMinStippleHeight = 1;
1235 caps1->dwMaxStippleWidth = 32;
1236 caps1->dwMaxStippleHeight = 32;
1237 caps1->dwMaxTextureRepeat = caps7->dwMaxTextureRepeat;
1239 caps1->dwMaxAnisotropy = caps7->dwMaxAnisotropy;
1240 caps1->dvGuardBandLeft = caps7->dvGuardBandLeft;
1241 caps1->dvGuardBandTop = caps7->dvGuardBandTop;
1242 caps1->dvGuardBandRight = caps7->dvGuardBandRight;
1243 caps1->dvGuardBandBottom = caps7->dvGuardBandBottom;
1244 caps1->dvExtentsAdjust = caps7->dvExtentsAdjust;
1245 caps1->dwStencilCaps = caps7->dwStencilCaps;
1246 caps1->dwFVFCaps = caps7->dwFVFCaps;
1247 caps1->dwTextureOpCaps = caps7->dwTextureOpCaps;
1250}
#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 4801 of file ddraw.c.

4802{
4803 struct wined3d_vertex_declaration *pDecl = NULL;
4804 HRESULT hr;
4805 int p, low, high; /* deliberately signed */
4806 struct FvfToDecl *convertedDecls = This->decls;
4807
4808 TRACE("Searching for declaration for fvf %08x... ", fvf);
4809
4810 low = 0;
4811 high = This->numConvertedDecls - 1;
4812 while(low <= high) {
4813 p = (low + high) >> 1;
4814 TRACE("%d ", p);
4815 if(convertedDecls[p].fvf == fvf) {
4816 TRACE("found %p\n", convertedDecls[p].decl);
4817 return convertedDecls[p].decl;
4818 } else if(convertedDecls[p].fvf < fvf) {
4819 low = p + 1;
4820 } else {
4821 high = p - 1;
4822 }
4823 }
4824 TRACE("not found. Creating and inserting at position %d.\n", low);
4825
4828 if (hr != S_OK) return NULL;
4829
4830 if (This->declArraySize == This->numConvertedDecls)
4831 {
4832 unsigned int grow = max(This->declArraySize / 2, 8);
4833
4834 if (!(convertedDecls = heap_realloc(convertedDecls,
4835 (This->numConvertedDecls + grow) * sizeof(*convertedDecls))))
4836 {
4838 return NULL;
4839 }
4840 This->decls = convertedDecls;
4841 This->declArraySize += grow;
4842 }
4843
4844 memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low));
4845 convertedDecls[low].decl = pDecl;
4846 convertedDecls[low].fvf = fvf;
4847 This->numConvertedDecls++;
4848
4849 TRACE("Returning %p. %d decls in array\n", pDecl, This->numConvertedDecls);
4850 return pDecl;
4851}
#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 1252 of file ddraw.c.

1253{
1254 WINED3DCAPS wined3d_caps;
1255 HRESULT hr;
1256
1257 TRACE("ddraw %p, caps %p.\n", ddraw, caps);
1258
1259 memset(&wined3d_caps, 0, sizeof(wined3d_caps));
1260
1264 if (FAILED(hr))
1265 {
1266 WARN("Failed to get device caps, hr %#x.\n", hr);
1267 return hr;
1268 }
1269
1270 caps->dwDevCaps = wined3d_caps.DevCaps;
1271 caps->dpcLineCaps.dwMiscCaps = wined3d_caps.PrimitiveMiscCaps;
1272 caps->dpcLineCaps.dwRasterCaps = wined3d_caps.RasterCaps;
1273 caps->dpcLineCaps.dwZCmpCaps = wined3d_caps.ZCmpCaps;
1274 caps->dpcLineCaps.dwSrcBlendCaps = wined3d_caps.SrcBlendCaps;
1275 caps->dpcLineCaps.dwDestBlendCaps = wined3d_caps.DestBlendCaps;
1276 caps->dpcLineCaps.dwAlphaCmpCaps = wined3d_caps.AlphaCmpCaps;
1277 caps->dpcLineCaps.dwShadeCaps = wined3d_caps.ShadeCaps;
1278 caps->dpcLineCaps.dwTextureCaps = wined3d_caps.TextureCaps;
1281
1282 caps->dwMaxTextureWidth = wined3d_caps.MaxTextureWidth;
1283 caps->dwMaxTextureHeight = wined3d_caps.MaxTextureHeight;
1284
1285 caps->dwMaxTextureRepeat = wined3d_caps.MaxTextureRepeat;
1287 caps->dwMaxAnisotropy = wined3d_caps.MaxAnisotropy;
1288 caps->dvMaxVertexW = wined3d_caps.MaxVertexW;
1289
1290 caps->dvGuardBandLeft = wined3d_caps.GuardBandLeft;
1291 caps->dvGuardBandTop = wined3d_caps.GuardBandTop;
1292 caps->dvGuardBandRight = wined3d_caps.GuardBandRight;
1293 caps->dvGuardBandBottom = wined3d_caps.GuardBandBottom;
1294
1295 caps->dvExtentsAdjust = wined3d_caps.ExtentsAdjust;
1296 caps->dwStencilCaps = wined3d_caps.StencilCaps;
1297
1298 caps->dwFVFCaps = wined3d_caps.FVFCaps;
1299 caps->dwTextureOpCaps = wined3d_caps.TextureOpCaps;
1300
1301 caps->dwVertexProcessingCaps = wined3d_caps.VertexProcessingCaps;
1302 caps->dwMaxActiveLights = wined3d_caps.MaxActiveLights;
1303
1304 /* Remove all non-d3d7 caps */
1305 caps->dwDevCaps &= (
1313
1314 caps->dwStencilCaps &= (
1318
1319 /* FVF caps ?*/
1320
1321 caps->dwTextureOpCaps &= (
1330
1331 caps->dwVertexProcessingCaps &= (
1334
1335 caps->dpcLineCaps.dwMiscCaps &= (
1339
1340 caps->dpcLineCaps.dwRasterCaps &= (
1349
1350 caps->dpcLineCaps.dwZCmpCaps &= (
1354
1355 caps->dpcLineCaps.dwSrcBlendCaps &= (
1361
1362 caps->dpcLineCaps.dwDestBlendCaps &= (
1368
1369 caps->dpcLineCaps.dwAlphaCmpCaps &= (
1373
1374 caps->dpcLineCaps.dwShadeCaps &= (
1382
1383 caps->dpcLineCaps.dwTextureCaps &= (
1388
1396
1400
1402 {
1403 /* DirectX7 always has the np2 flag set, no matter what the card
1404 * supports. Some old games (Rollcage) check the caps incorrectly.
1405 * If wined3d supports nonpow2 textures it also has np2 conditional
1406 * support. */
1408 }
1409
1410 /* Fill the missing members, and do some fixup */
1411 caps->dpcLineCaps.dwSize = sizeof(caps->dpcLineCaps);
1420 caps->dpcLineCaps.dwStippleWidth = 32;
1421 caps->dpcLineCaps.dwStippleHeight = 32;
1422 /* Use the same for the TriCaps */
1423 caps->dpcTriCaps = caps->dpcLineCaps;
1424
1427 caps->dwMinTextureWidth = 1;
1428 caps->dwMinTextureHeight = 1;
1429
1430 /* Convert DWORDs safely to WORDs */
1431 caps->wMaxTextureBlendStages = min(wined3d_caps.MaxTextureBlendStages, 0xffff);
1432 caps->wMaxSimultaneousTextures = min(wined3d_caps.MaxSimultaneousTextures, 0xffff);
1434 caps->wMaxVertexBlendMatrices = min(wined3d_caps.MaxVertexBlendMatrices, 0xffff);
1435
1436 caps->deviceGUID = IID_IDirect3DTnLHalDevice;
1437
1438 caps->dwReserved1 = 0;
1439 caps->dwReserved2 = 0;
1440 caps->dwReserved3 = 0;
1441 caps->dwReserved4 = 0;
1442
1443 return DD_OK;
1444}
#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 5052 of file ddraw.c.

5053{
5054 WINED3DCAPS caps;
5055 HRESULT hr;
5056
5061 ddraw->IDirect3D_iface.lpVtbl = &d3d1_vtbl;
5062 ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl;
5063 ddraw->IDirect3D3_iface.lpVtbl = &d3d3_vtbl;
5064 ddraw->IDirect3D7_iface.lpVtbl = &d3d7_vtbl;
5066 ddraw->numIfaces = 1;
5067 ddraw->ref7 = 1;
5068
5070 if (!(ddraw->wined3d = wined3d_create(flags)))
5071 {
5073 if (!(ddraw->wined3d = wined3d_create(flags)))
5074 {
5075 WARN("Failed to create a wined3d object.\n");
5076 return E_FAIL;
5077 }
5078 }
5079
5081 {
5082 ERR("Failed to get device caps, hr %#x.\n", hr);
5084 return E_FAIL;
5085 }
5086
5087 if (!(caps.ddraw_caps.caps & WINEDDCAPS_3D))
5088 {
5089 WARN("Created a wined3d object without 3D support.\n");
5091 }
5092
5095 {
5096 WARN("Failed to create a wined3d device, hr %#x.\n", hr);
5098 return hr;
5099 }
5100
5102
5103 return DD_OK;
5104}
#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:4734
static const struct IDirect3D7Vtbl d3d7_vtbl
Definition: ddraw.c:4720
static const struct IDirect3D2Vtbl d3d2_vtbl
Definition: ddraw.c:4752
static const struct IDirectDraw2Vtbl ddraw2_vtbl
Definition: ddraw.c:4660
static const struct IDirectDraw7Vtbl ddraw7_vtbl
Definition: ddraw.c:4583
static const struct IDirect3DVtbl d3d1_vtbl
Definition: ddraw.c:4767
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops
Definition: ddraw.c:5041
static const struct IDirectDraw4Vtbl ddraw4_vtbl
Definition: ddraw.c:4623
static struct IDirectDrawVtbl ddraw1_vtbl
Definition: ddraw.c:4691
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 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 GLint GLint j
Definition: glfuncs.h:250
static UINT UINT last
Definition: font.c:45
#define DDSCAPS2_CUBEMAP_ALLFACES
Definition: ddraw.h:297
#define DDERR_INVALIDPIXELFORMAT
Definition: ddraw.h:80
#define DDERR_NOOVERLAYHW
Definition: ddraw.h:98
#define DDCKEY_SRCOVERLAY
Definition: ddraw.h:479
#define DDCKEY_DESTOVERLAY
Definition: ddraw.h:477
#define DDERR_NOEXCLUSIVEMODE
Definition: ddraw.h:93
#define DDCKEY_DESTBLT
Definition: ddraw.h:476
#define DDERR_NOCOLORKEYHW
Definition: ddraw.h:91
#define DDCKEY_SRCBLT
Definition: ddraw.h:478
DDSCAPS2 ddsCaps
Definition: ddraw.h:1188
DDSURFACEDESC2 surface_desc
struct ddraw_surface * complex_array[MAX_COMPLEX_ATTACHED]
DDSURFACEDESC2 surface_desc
struct ddraw_surface * primary
Definition: ddraw_private.h:97
DWORD cooperative_level
struct wined3d_swapchain * wined3d_swapchain
UINT CDECL wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, UINT width)
Definition: directx.c:5517
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
Definition: directx.c:5334
HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: directx.c:4767
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:271
@ WINED3D_CUBEMAP_FACE_NEGATIVE_Z
Definition: wined3d.h:680
@ WINED3D_CUBEMAP_FACE_NEGATIVE_X
Definition: wined3d.h:676
@ WINED3D_CUBEMAP_FACE_POSITIVE_Z
Definition: wined3d.h:679
@ WINED3D_CUBEMAP_FACE_POSITIVE_X
Definition: wined3d.h:675
@ WINED3D_CUBEMAP_FACE_NEGATIVE_Y
Definition: wined3d.h:678
@ WINED3D_CUBEMAP_FACE_POSITIVE_Y
Definition: wined3d.h:677
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2759
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:554
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:269
#define WINED3DUSAGE_OWNDC
Definition: wined3d.h:919
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:917
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
#define WINED3DUSAGE_OVERLAY
Definition: wined3d.h:921
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:107
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:899
#define WINED3D_TEXTURE_CREATE_GET_DC_LENIENT
Definition: wined3d.h:1560
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918
#define WINED3DUSAGE_DEPTHSTENCIL
Definition: wined3d.h:900
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define E_POINTER
Definition: winerror.h:2365

Referenced by ddraw1_CreateSurface(), ddraw2_CreateSurface(), ddraw4_CreateSurface(), and ddraw7_CreateSurface().

◆ ddraw_surface_get_rendertarget_view()

struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view ( struct ddraw_surface surface)

Definition at line 6520 of file surface.c.

6521{
6522 HRESULT hr;
6523
6524 if (surface->wined3d_rtv)
6525 return surface->wined3d_rtv;
6526
6528 surface->sub_resource_idx, surface, &ddraw_view_wined3d_parent_ops, &surface->wined3d_rtv)))
6529 {
6530 ERR("Failed to create rendertarget view, hr %#x.\n", hr);
6531 return NULL;
6532 }
6533
6534 return surface->wined3d_rtv;
6535}
static const struct wined3d_parent_ops ddraw_view_wined3d_parent_ops
Definition: surface.c:6515
HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view)
Definition: view.c:624
struct wined3d_rendertarget_view * wined3d_rtv
unsigned int sub_resource_idx
struct wined3d_texture * wined3d_texture

Referenced by d3d_device_init(), d3d_device_set_render_target(), d3d_device_update_depth_stencil(), ddraw_surface7_Flip(), and ddraw_surface_blt().

◆ ddraw_surface_init()

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 
)

Definition at line 6432 of file surface.c.

6435{
6437 unsigned int texture_level, row_pitch, slice_pitch;
6438 DDSURFACEDESC2 *desc = &surface->surface_desc;
6439 unsigned int version = texture->version;
6440
6447 surface->IDirect3DTexture2_iface.lpVtbl = &d3d_texture2_vtbl;
6448 surface->IDirect3DTexture_iface.lpVtbl = &d3d_texture1_vtbl;
6449 surface->iface_count = 1;
6450 surface->version = version;
6451 surface->ddraw = ddraw;
6452
6453 if (version == 7)
6454 {
6455 surface->ref7 = 1;
6456 surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface7_iface;
6457 }
6458 else if (version == 4)
6459 {
6460 surface->ref4 = 1;
6461 surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface4_iface;
6462 }
6463 else
6464 {
6465 surface->ref1 = 1;
6466 surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface_iface;
6467 }
6468
6469 *desc = texture->surface_desc;
6470 surface->first_attached = surface;
6471
6472 texture_level = desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP ? sub_resource_idx % desc->u2.dwMipMapCount : 0;
6473 wined3d_texture_get_pitch(wined3d_texture, texture_level, &row_pitch, &slice_pitch);
6474 if (format_is_compressed(&desc->u4.ddpfPixelFormat))
6475 {
6476 if (desc->dwFlags & DDSD_LPSURFACE)
6477 desc->u1.dwLinearSize = ~0u;
6478 else
6479 desc->u1.dwLinearSize = slice_pitch;
6480 desc->dwFlags |= DDSD_LINEARSIZE;
6481 desc->dwFlags &= ~(DDSD_LPSURFACE | DDSD_PITCH);
6482 }
6483 else
6484 {
6485 if (!(desc->dwFlags & DDSD_LPSURFACE))
6486 desc->u1.lPitch = row_pitch;
6487 desc->dwFlags |= DDSD_PITCH;
6488 desc->dwFlags &= ~(DDSD_LPSURFACE | DDSD_LINEARSIZE);
6489 }
6490 desc->lpSurface = NULL;
6491
6493 surface->sub_resource_idx = sub_resource_idx;
6494 *parent_ops = &ddraw_surface_wined3d_parent_ops;
6495
6497}
static const struct IDirect3DTexture2Vtbl d3d_texture2_vtbl
Definition: surface.c:5617
static const struct IDirectDrawGammaControlVtbl ddraw_gamma_control_vtbl
Definition: surface.c:5608
static const struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl
Definition: surface.c:5520
static const struct IDirectDrawSurface3Vtbl ddraw_surface3_vtbl
Definition: surface.c:5472
static struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl
Definition: surface.c:5566
static const struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl
Definition: surface.c:5418
static const struct IDirect3DTextureVtbl d3d_texture1_vtbl
Definition: surface.c:5627
static const struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl
Definition: surface.c:5359
static const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops
Definition: surface.c:5769
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1121
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
Definition: texture.c:994
void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture, unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: texture.c:1168
IDirectDrawSurface IDirectDrawSurface_iface
IDirectDrawSurface2 IDirectDrawSurface2_iface
struct ddraw * ddraw
IDirectDrawGammaControl IDirectDrawGammaControl_iface
IUnknown * texture_outer
struct wined3d_private_store private_store
IDirectDrawSurface3 IDirectDrawSurface3_iface
struct ddraw_surface * first_attached
IDirect3DTexture IDirect3DTexture_iface
IDirectDrawSurface7 IDirectDrawSurface7_iface
IDirectDrawSurface4 IDirectDrawSurface4_iface
IDirect3DTexture2 IDirect3DTexture2_iface
static void wined3d_private_store_init(struct wined3d_private_store *store)
Definition: wined3d.h:2512

Referenced by device_parent_surface_created().

◆ ddraw_surface_update_frontbuffer()

HRESULT ddraw_surface_update_frontbuffer ( struct ddraw_surface surface,
const RECT rect,
BOOL  read 
)

Definition at line 43 of file surface.c.

44{
45 struct ddraw *ddraw = surface->ddraw;
46 HDC surface_dc, screen_dc;
47 int x, y, w, h;
48 HRESULT hr;
49 BOOL ret;
50 RECT r;
51
52 if (!rect)
53 {
54 SetRect(&r, 0, 0, surface->surface_desc.dwWidth, surface->surface_desc.dwHeight);
55 rect = &r;
56 }
57
58 x = rect->left;
59 y = rect->top;
60 w = rect->right - rect->left;
61 h = rect->bottom - rect->top;
62
63 if (w <= 0 || h <= 0)
64 return DD_OK;
65
67 {
68 /* Nothing to do, we control the frontbuffer, or at least the parts we
69 * care about. */
70 if (read)
71 return DD_OK;
72
75 }
76
77 if (FAILED(hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, &surface_dc)))
78 {
79 ERR("Failed to get surface DC, hr %#x.\n", hr);
80 return hr;
81 }
82 if (surface->palette)
83 wined3d_palette_apply_to_dc(surface->palette->wined3d_palette, surface_dc);
84
85 if (!(screen_dc = GetDC(NULL)))
86 {
87 wined3d_texture_release_dc(surface->wined3d_texture, surface->sub_resource_idx, surface_dc);
88 ERR("Failed to get screen DC.\n");
89 return E_FAIL;
90 }
91
92 if (read)
93 ret = BitBlt(surface_dc, x, y, w, h,
94 screen_dc, x, y, SRCCOPY);
95 else
96 ret = BitBlt(screen_dc, x, y, w, h,
97 surface_dc, x, y, SRCCOPY);
98
99 ReleaseDC(NULL, screen_dc);
100 wined3d_texture_release_dc(surface->wined3d_texture, surface->sub_resource_idx, surface_dc);
101
102 if (!ret)
103 {
104 ERR("Failed to blit to/from screen.\n");
105 return E_FAIL;
106 }
107
108 return DD_OK;
109}
#define read
Definition: acwin.h:96
#define DDRAW_GDI_FLIP
Definition: ddraw_private.h:60
void CDECL wined3d_palette_apply_to_dc(const struct wined3d_palette *palette, HDC dc)
Definition: palette.c:86
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
Definition: texture.c:3623
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
Definition: texture.c:3671
HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: texture.c:3262
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static HDC
Definition: imagelist.c:88
& rect
Definition: startmenu.cpp:1413
DWORD dwWidth
Definition: ddraw.h:1155
DWORD dwHeight
Definition: ddraw.h:1154
struct ddraw_palette * palette
struct wined3d_texture * wined3d_frontbuffer
Definition: ddraw_private.h:99
int ret
@ WINED3D_TEXF_POINT
Definition: wined3d.h:686
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by ddraw_palette_SetEntries(), ddraw_surface7_BltFast(), ddraw_surface7_Flip(), ddraw_surface7_GetDC(), ddraw_surface7_ReleaseDC(), ddraw_surface7_Unlock(), ddraw_surface_blt_clipped(), ddraw_surface_set_palette(), and surface_lock().

◆ ddraw_update_lost_surfaces()

void ddraw_update_lost_surfaces ( struct ddraw ddraw)

Definition at line 4918 of file ddraw.c.

4919{
4920 struct ddraw_surface *surface;
4921
4923 return;
4924
4926 {
4927 surface->is_lost = TRUE;
4928 }
4930}
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list surface_list_entry
LONG device_state
Definition: ddraw_private.h:95

Referenced by ddraw_surface7_Restore(), and device_parent_surface_created().

◆ ddrawformat_from_wined3dformat()

void ddrawformat_from_wined3dformat ( DDPIXELFORMAT ddraw_format,
enum wined3d_format_id  wined3d_format 
)

Definition at line 33 of file utils.c.

34{
35 DWORD Size = DDPixelFormat->dwSize;
36
37 if(Size==0) return;
38
39 memset(DDPixelFormat, 0x00, Size);
40 DDPixelFormat->dwSize = Size;
41 switch (wined3d_format)
42 {
44 DDPixelFormat->dwFlags = DDPF_RGB;
45 DDPixelFormat->dwFourCC = 0;
46 DDPixelFormat->u1.dwRGBBitCount = 24;
47 DDPixelFormat->u2.dwRBitMask = 0x00ff0000;
48 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
49 DDPixelFormat->u4.dwBBitMask = 0x000000ff;
50 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
51 break;
52
54 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
55 DDPixelFormat->dwFourCC = 0;
56 DDPixelFormat->u1.dwRGBBitCount = 32;
57 DDPixelFormat->u2.dwRBitMask = 0x00ff0000;
58 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
59 DDPixelFormat->u4.dwBBitMask = 0x000000ff;
60 DDPixelFormat->u5.dwRGBAlphaBitMask = 0xff000000;
61 break;
62
64 DDPixelFormat->dwFlags = DDPF_RGB;
65 DDPixelFormat->dwFourCC = 0;
66 DDPixelFormat->u1.dwRGBBitCount = 32;
67 DDPixelFormat->u2.dwRBitMask = 0x00ff0000;
68 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
69 DDPixelFormat->u4.dwBBitMask = 0x000000ff;
70 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
71 break;
72
74 DDPixelFormat->dwFlags = DDPF_RGB;
75 DDPixelFormat->dwFourCC = 0;
76 DDPixelFormat->u1.dwRGBBitCount = 32;
77 DDPixelFormat->u2.dwRBitMask = 0x000000ff;
78 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
79 DDPixelFormat->u4.dwBBitMask = 0x00ff0000;
80 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
81 break;
82
84 DDPixelFormat->dwFlags = DDPF_RGB;
85 DDPixelFormat->dwFourCC = 0;
86 DDPixelFormat->u1.dwRGBBitCount = 16;
87 DDPixelFormat->u2.dwRBitMask = 0xF800;
88 DDPixelFormat->u3.dwGBitMask = 0x07E0;
89 DDPixelFormat->u4.dwBBitMask = 0x001F;
90 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
91 break;
92
94 DDPixelFormat->dwFlags = DDPF_RGB;
95 DDPixelFormat->dwFourCC = 0;
96 DDPixelFormat->u1.dwRGBBitCount = 16;
97 DDPixelFormat->u2.dwRBitMask = 0x7C00;
98 DDPixelFormat->u3.dwGBitMask = 0x03E0;
99 DDPixelFormat->u4.dwBBitMask = 0x001F;
100 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
101 break;
102
104 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
105 DDPixelFormat->dwFourCC = 0;
106 DDPixelFormat->u1.dwRGBBitCount = 16;
107 DDPixelFormat->u2.dwRBitMask = 0x7C00;
108 DDPixelFormat->u3.dwGBitMask = 0x03E0;
109 DDPixelFormat->u4.dwBBitMask = 0x001F;
110 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x8000;
111 break;
112
114 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
115 DDPixelFormat->dwFourCC = 0;
116 DDPixelFormat->u1.dwRGBBitCount = 16;
117 DDPixelFormat->u2.dwRBitMask = 0x0F00;
118 DDPixelFormat->u3.dwGBitMask = 0x00F0;
119 DDPixelFormat->u4.dwBBitMask = 0x000F;
120 DDPixelFormat->u5.dwRGBAlphaBitMask = 0xF000;
121 break;
122
124 DDPixelFormat->dwFlags = DDPF_RGB;
125 DDPixelFormat->dwFourCC = 0;
126 DDPixelFormat->u1.dwRGBBitCount = 8;
127 DDPixelFormat->u2.dwRBitMask = 0xE0;
128 DDPixelFormat->u3.dwGBitMask = 0x1C;
129 DDPixelFormat->u4.dwBBitMask = 0x03;
130 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0;
131 break;
132
134 DDPixelFormat->dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
135 DDPixelFormat->dwFourCC = 0;
136 DDPixelFormat->u1.dwRGBBitCount = 8;
137 DDPixelFormat->u2.dwRBitMask = 0x00;
138 DDPixelFormat->u3.dwGBitMask = 0x00;
139 DDPixelFormat->u4.dwBBitMask = 0x00;
140 break;
141
143 DDPixelFormat->dwFlags = DDPF_ALPHA;
144 DDPixelFormat->dwFourCC = 0;
145 DDPixelFormat->u1.dwAlphaBitDepth = 8;
146 DDPixelFormat->u2.dwRBitMask = 0x0;
147 DDPixelFormat->u3.dwZBitMask = 0x0;
148 DDPixelFormat->u4.dwStencilBitMask = 0x0;
149 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0;
150 break;
151
153 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
154 DDPixelFormat->dwFourCC = 0;
155 DDPixelFormat->u1.dwRGBBitCount = 16;
156 DDPixelFormat->u2.dwRBitMask = 0x00E0;
157 DDPixelFormat->u3.dwGBitMask = 0x001C;
158 DDPixelFormat->u4.dwBBitMask = 0x0003;
159 DDPixelFormat->u5.dwRGBAlphaBitMask = 0xFF00;
160 break;
161
163 DDPixelFormat->dwFlags = DDPF_RGB;
164 DDPixelFormat->dwFourCC = 0;
165 DDPixelFormat->u1.dwRGBBitCount = 16;
166 DDPixelFormat->u2.dwRBitMask = 0x0F00;
167 DDPixelFormat->u3.dwGBitMask = 0x00F0;
168 DDPixelFormat->u4.dwBBitMask = 0x000F;
169 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
170 break;
171
172 /* How are Z buffer bit depth and Stencil buffer bit depth related?
173 */
175 DDPixelFormat->dwFlags = DDPF_ZBUFFER;
176 DDPixelFormat->dwFourCC = 0;
177 DDPixelFormat->u1.dwZBufferBitDepth = 16;
178 DDPixelFormat->u2.dwStencilBitDepth = 0;
179 DDPixelFormat->u3.dwZBitMask = 0x0000FFFF;
180 DDPixelFormat->u4.dwStencilBitMask = 0x0;
181 DDPixelFormat->u5.dwRGBZBitMask = 0x00000000;
182 break;
183
185 DDPixelFormat->dwFlags = DDPF_ZBUFFER;
186 DDPixelFormat->dwFourCC = 0;
187 DDPixelFormat->u1.dwZBufferBitDepth = 32;
188 DDPixelFormat->u2.dwStencilBitDepth = 0;
189 DDPixelFormat->u3.dwZBitMask = 0xFFFFFFFF;
190 DDPixelFormat->u4.dwStencilBitMask = 0x0;
191 DDPixelFormat->u5.dwRGBZBitMask = 0x00000000;
192 break;
193
195 DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER;
196 DDPixelFormat->dwFourCC = 0;
197 /* Should I set dwZBufferBitDepth to 32 here? */
198 DDPixelFormat->u1.dwZBufferBitDepth = 32;
199 DDPixelFormat->u2.dwStencilBitDepth = 4;
200 DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF;
201 DDPixelFormat->u4.dwStencilBitMask = 0x0F000000;
202 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
203 break;
204
206 DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER;
207 DDPixelFormat->dwFourCC = 0;
208 DDPixelFormat->u1.dwZBufferBitDepth = 32;
209 DDPixelFormat->u2.dwStencilBitDepth = 8;
210 DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF;
211 DDPixelFormat->u4.dwStencilBitMask = 0xFF000000;
212 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
213 break;
214
216 DDPixelFormat->dwFlags = DDPF_ZBUFFER;
217 DDPixelFormat->dwFourCC = 0;
218 DDPixelFormat->u1.dwZBufferBitDepth = 32;
219 DDPixelFormat->u2.dwStencilBitDepth = 0;
220 DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF;
221 DDPixelFormat->u4.dwStencilBitMask = 0x00000000;
222 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
223 break;
224
226 DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER;
227 DDPixelFormat->dwFourCC = 0;
228 DDPixelFormat->u1.dwZBufferBitDepth = 16;
229 DDPixelFormat->u2.dwStencilBitDepth = 1;
230 DDPixelFormat->u3.dwZBitMask = 0x7fff;
231 DDPixelFormat->u4.dwStencilBitMask = 0x8000;
232 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
233 break;
234
235 case WINED3DFMT_UYVY:
236 case WINED3DFMT_YUY2:
237 DDPixelFormat->u1.dwYUVBitCount = 16;
238 DDPixelFormat->dwFlags = DDPF_FOURCC;
239 DDPixelFormat->dwFourCC = wined3d_format;
240 break;
241
242 case WINED3DFMT_YV12:
243 DDPixelFormat->u1.dwYUVBitCount = 12;
244 DDPixelFormat->dwFlags = DDPF_FOURCC;
245 DDPixelFormat->dwFourCC = wined3d_format;
246 break;
247
248 case WINED3DFMT_DXT1:
249 case WINED3DFMT_DXT2:
250 case WINED3DFMT_DXT3:
251 case WINED3DFMT_DXT4:
252 case WINED3DFMT_DXT5:
256 DDPixelFormat->dwFlags = DDPF_FOURCC;
257 DDPixelFormat->dwFourCC = wined3d_format;
258 break;
259
260 /* Luminance */
262 DDPixelFormat->dwFlags = DDPF_LUMINANCE;
263 DDPixelFormat->dwFourCC = 0;
264 DDPixelFormat->u1.dwLuminanceBitCount = 8;
265 DDPixelFormat->u2.dwLuminanceBitMask = 0xff;
266 DDPixelFormat->u3.dwBumpDvBitMask = 0x0;
267 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0;
268 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0;
269 break;
270
272 DDPixelFormat->dwFlags = DDPF_ALPHAPIXELS | DDPF_LUMINANCE;
273 DDPixelFormat->dwFourCC = 0;
274 DDPixelFormat->u1.dwLuminanceBitCount = 4;
275 DDPixelFormat->u2.dwLuminanceBitMask = 0x0f;
276 DDPixelFormat->u3.dwBumpDvBitMask = 0x0;
277 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0;
278 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0xf0;
279 break;
280
282 DDPixelFormat->dwFlags = DDPF_ALPHAPIXELS | DDPF_LUMINANCE;
283 DDPixelFormat->dwFourCC = 0;
284 DDPixelFormat->u1.dwLuminanceBitCount = 16;
285 DDPixelFormat->u2.dwLuminanceBitMask = 0x00ff;
286 DDPixelFormat->u3.dwBumpDvBitMask = 0x0;
287 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0;
288 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0xff00;
289 break;
290
291 /* Bump mapping */
293 DDPixelFormat->dwFlags = DDPF_BUMPDUDV;
294 DDPixelFormat->dwFourCC = 0;
295 DDPixelFormat->u1.dwBumpBitCount = 16;
296 DDPixelFormat->u2.dwBumpDuBitMask = 0x000000ff;
297 DDPixelFormat->u3.dwBumpDvBitMask = 0x0000ff00;
298 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x00000000;
299 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000;
300 break;
301
303 DDPixelFormat->dwFlags = DDPF_BUMPDUDV | DDPF_BUMPLUMINANCE;
304 DDPixelFormat->dwFourCC = 0;
305 DDPixelFormat->u1.dwBumpBitCount = 16;
306 DDPixelFormat->u2.dwBumpDuBitMask = 0x0000001f;
307 DDPixelFormat->u3.dwBumpDvBitMask = 0x000003e0;
308 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0000fc00;
309 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000;
310 break;
311
313 DDPixelFormat->dwFlags = DDPF_BUMPDUDV | DDPF_BUMPLUMINANCE;
314 DDPixelFormat->dwFourCC = 0;
315 DDPixelFormat->u1.dwBumpBitCount = 32;
316 DDPixelFormat->u2.dwBumpDuBitMask = 0x000000ff;
317 DDPixelFormat->u3.dwBumpDvBitMask = 0x0000ff00;
318 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x00ff0000;
319 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000;
320 break;
321
322 default:
323 FIXME("Unhandled wined3d format %#x.\n", wined3d_format);
324 break;
325 }
326
327 if(TRACE_ON(ddraw)) {
328 TRACE("Returning: ");
329 DDRAW_dump_pixelformat(DDPixelFormat);
330 }
331}
#define DDPF_ZBUFFER
Definition: ddraw.h:511
#define DDPF_LUMINANCE
Definition: ddraw.h:517
#define DDPF_STENCILBUFFER
Definition: ddraw.h:515
#define DDPF_ALPHA
Definition: ddraw.h:502
#define DDPF_FOURCC
Definition: ddraw.h:503
#define DDPF_RGB
Definition: ddraw.h:507
#define DDPF_PALETTEINDEXED8
Definition: ddraw.h:506
#define DDPF_BUMPLUMINANCE
Definition: ddraw.h:518
#define DDPF_ALPHAPIXELS
Definition: ddraw.h:501
#define DDPF_BUMPDUDV
Definition: ddraw.h:519
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:111
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:110
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_DXT2
Definition: wined3d.h:240
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:223
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:112
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:119
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:120
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:224
@ WINED3DFMT_R8G8B8X8_UNORM
Definition: wined3d.h:114
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:109
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:191
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:118
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:187
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:121
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:108
@ WINED3DFMT_DXT1
Definition: wined3d.h:239
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_DXT3
Definition: wined3d.h:241
@ WINED3DFMT_DXT4
Definition: wined3d.h:242
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:122
@ WINED3DFMT_YV12
Definition: wined3d.h:238
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:221
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_DXT5
Definition: wined3d.h:243
@ WINED3DFMT_YUY2
Definition: wined3d.h:237
@ WINED3DFMT_G8R8_G8B8
Definition: wined3d.h:245
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:117
@ WINED3DFMT_UYVY
Definition: wined3d.h:236
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:201
@ WINED3DFMT_R8G8_B8G8
Definition: wined3d.h:246
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:113
@ WINED3DFMT_MULTI2_ARGB8
Definition: wined3d.h:244
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:181

Referenced by d3d7_EnumZBufferFormats(), d3d_device2_EnumTextureFormats(), d3d_device3_GetRenderState(), d3d_device3_SetRenderState(), d3d_device3_SetTexture(), d3d_device7_EnumTextureFormats(), ddraw7_EnumDisplayModes(), ddraw7_GetDisplayMode(), ddraw7_SetDisplayMode(), and ddraw_surface_create().

◆ DDSD2_to_DDSD()

void DDSD2_to_DDSD ( const DDSURFACEDESC2 in,
DDSURFACEDESC out 
)

Definition at line 1262 of file utils.c.

1263{
1264 memset(out, 0, sizeof(*out));
1265 out->dwSize = sizeof(*out);
1266 out->dwFlags = in->dwFlags;
1267 if (in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
1268 if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
1269 if (in->dwFlags & DDSD_PIXELFORMAT)
1270 {
1271 out->ddpfPixelFormat = in->u4.ddpfPixelFormat;
1272 if ((in->dwFlags & DDSD_CAPS) && (in->ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
1273 {
1274 /* Z buffers have DDSD_ZBUFFERBITDEPTH set, but not DDSD_PIXELFORMAT. They do
1275 * have valid data in ddpfPixelFormat though */
1276 out->dwFlags &= ~DDSD_PIXELFORMAT;
1277 out->dwFlags |= DDSD_ZBUFFERBITDEPTH;
1278 out->u2.dwZBufferBitDepth = in->u4.ddpfPixelFormat.u1.dwZBufferBitDepth;
1279 }
1280 }
1281 /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */
1282 out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
1283 if (in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch;
1284 if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->u5.dwBackBufferCount;
1285 if (in->dwFlags & DDSD_ZBUFFERBITDEPTH) out->u2.dwZBufferBitDepth = in->u2.dwMipMapCount; /* same union */
1286 if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
1287 /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
1288 out->lpSurface = in->lpSurface;
1289 if (in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->u3.ddckCKDestOverlay;
1290 if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
1291 if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
1292 if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
1293 if (in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount;
1294 if (in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate;
1295 if (in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize;
1296 /* Does not exist in DDSURFACEDESC:
1297 * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
1298 */
1299 if (in->dwFlags & DDSD_TEXTURESTAGE) WARN("Does not exist in DDSURFACEDESC: DDSD_TEXTURESTAGE\n");
1300 if (in->dwFlags & DDSD_FVF) WARN("Does not exist in DDSURFACEDESC: DDSD_FVF\n");
1301 if (in->dwFlags & DDSD_SRCVBHANDLE) WARN("Does not exist in DDSURFACEDESC: DDSD_SRCVBHANDLE\n");
1303}
static FILE * out
Definition: regtests2xml.c:44
#define DDSD_TEXTURESTAGE
Definition: ddraw.h:224
#define DDSD_SRCVBHANDLE
Definition: ddraw.h:226
#define DDSD_FVF
Definition: ddraw.h:225

Referenced by ddraw_surface1_Lock(), ddraw_surface2_Lock(), ddraw_surface3_GetSurfaceDesc(), ddraw_surface3_Lock(), and EnumDisplayModesCallbackThunk().

◆ DDSD_to_DDSD2()

void DDSD_to_DDSD2 ( const DDSURFACEDESC in,
DDSURFACEDESC2 out 
)

Definition at line 1218 of file utils.c.

1219{
1220 /* The output of this function is never passed to the application directly, so
1221 * the memset is not strictly needed. CreateSurface still has problems with this
1222 * though. Don't forget to set ddsCaps.dwCaps2/3/4 to 0 when removing this */
1223 memset(out, 0x00, sizeof(*out));
1224 out->dwSize = sizeof(*out);
1225 out->dwFlags = in->dwFlags & ~DDSD_ZBUFFERBITDEPTH;
1226 if (in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
1227 if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
1228 if (in->dwFlags & DDSD_PIXELFORMAT) out->u4.ddpfPixelFormat = in->ddpfPixelFormat;
1229 else if(in->dwFlags & DDSD_ZBUFFERBITDEPTH)
1230 {
1231 out->dwFlags |= DDSD_PIXELFORMAT;
1232 memset(&out->u4.ddpfPixelFormat, 0, sizeof(out->u4.ddpfPixelFormat));
1233 out->u4.ddpfPixelFormat.dwSize = sizeof(out->u4.ddpfPixelFormat);
1234 out->u4.ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
1235 out->u4.ddpfPixelFormat.u1.dwZBufferBitDepth = in->u2.dwZBufferBitDepth;
1236 /* 0 is not a valid DDSURFACEDESC / DDPIXELFORMAT on either side of the
1237 * conversion */
1238 out->u4.ddpfPixelFormat.u3.dwZBitMask = ~0U >> (32 - in->u2.dwZBufferBitDepth);
1239 }
1240 /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */
1241 out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
1242 if (in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch;
1243 if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->u5.dwBackBufferCount = in->dwBackBufferCount;
1244 if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
1245 /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
1246 out->lpSurface = in->lpSurface;
1247 if (in->dwFlags & DDSD_CKDESTOVERLAY) out->u3.ddckCKDestOverlay = in->ddckCKDestOverlay;
1248 if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
1249 if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
1250 if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
1251 if (in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount;
1252 if (in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate;
1253 if (in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize;
1254 /* Does not exist in DDSURFACEDESC:
1255 * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
1256 */
1257}
#define U(x)
Definition: wordpad.c:45

Referenced by ddraw1_CreateSurface(), ddraw1_EnumDisplayModes(), ddraw1_EnumSurfaces(), ddraw2_CreateSurface(), ddraw2_EnumDisplayModes(), ddraw2_EnumSurfaces(), ddraw_surface1_Initialize(), ddraw_surface2_Initialize(), ddraw_surface3_Initialize(), and ddraw_surface3_SetSurfaceDesc().

◆ dump_D3DMATRIX()

void dump_D3DMATRIX ( const D3DMATRIX mat)

Definition at line 914 of file utils.c.

915{
916 TRACE(" %f %f %f %f\n", mat->_11, mat->_12, mat->_13, mat->_14);
917 TRACE(" %f %f %f %f\n", mat->_21, mat->_22, mat->_23, mat->_24);
918 TRACE(" %f %f %f %f\n", mat->_31, mat->_32, mat->_33, mat->_34);
919 TRACE(" %f %f %f %f\n", mat->_41, mat->_42, mat->_43, mat->_44);
920}
static const MAT2 mat
Definition: font.c:66

Referenced by d3d_device1_SetMatrix().

◆ format_is_compressed()

static BOOL format_is_compressed ( const DDPIXELFORMAT format)
inlinestatic

Definition at line 602 of file ddraw_private.h.

603{
604 return (format->dwFlags & DDPF_FOURCC) && (format->dwFourCC == WINED3DFMT_DXT1
605 || format->dwFourCC == WINED3DFMT_DXT2 || format->dwFourCC == WINED3DFMT_DXT3
606 || format->dwFourCC == WINED3DFMT_DXT4 || format->dwFourCC == WINED3DFMT_DXT5);
607}
Definition: format.c:58

Referenced by ddraw_surface_create(), and ddraw_surface_init().

◆ format_is_paletteindexed()

static BOOL format_is_paletteindexed ( const DDPIXELFORMAT fmt)
inlinestatic

Definition at line 609 of file ddraw_private.h.

610{
613 return !!(fmt->dwFlags & flags);
614}
#define DDPF_PALETTEINDEXEDTO8
Definition: ddraw.h:505
#define DDPF_PALETTEINDEXED4
Definition: ddraw.h:504
#define DDPF_PALETTEINDEXED2
Definition: ddraw.h:513
#define DDPF_PALETTEINDEXED1
Definition: ddraw.h:512
Definition: dsound.c:943

Referenced by ddraw_surface7_GetDC(), ddraw_surface_set_palette(), and validate_surface_palette().

◆ get_flexible_vertex_size()

DWORD get_flexible_vertex_size ( DWORD  d3dvtVertexType)

Definition at line 923 of file utils.c.

924{
925 DWORD size = 0;
926 DWORD i;
927
928 if (d3dvtVertexType & D3DFVF_NORMAL) size += 3 * sizeof(D3DVALUE);
929 if (d3dvtVertexType & D3DFVF_DIFFUSE) size += sizeof(DWORD);
930 if (d3dvtVertexType & D3DFVF_SPECULAR) size += sizeof(DWORD);
931 if (d3dvtVertexType & D3DFVF_RESERVED1) size += sizeof(DWORD);
932 switch (d3dvtVertexType & D3DFVF_POSITION_MASK)
933 {
934 case D3DFVF_XYZ: size += 3 * sizeof(D3DVALUE); break;
935 case D3DFVF_XYZRHW: size += 4 * sizeof(D3DVALUE); break;
936 case D3DFVF_XYZB1: size += 4 * sizeof(D3DVALUE); break;
937 case D3DFVF_XYZB2: size += 5 * sizeof(D3DVALUE); break;
938 case D3DFVF_XYZB3: size += 6 * sizeof(D3DVALUE); break;
939 case D3DFVF_XYZB4: size += 7 * sizeof(D3DVALUE); break;
940 case D3DFVF_XYZB5: size += 8 * sizeof(D3DVALUE); break;
941 default: ERR("Unexpected position mask\n");
942 }
943 for (i = 0; i < GET_TEXCOUNT_FROM_FVF(d3dvtVertexType); i++)
944 {
945 size += GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, i) * sizeof(D3DVALUE);
946 }
947
948 return size;
949}
#define D3DFVF_DIFFUSE
Definition: d3d8types.h:122
#define D3DFVF_XYZ
Definition: d3d8types.h:113
#define D3DFVF_XYZB1
Definition: d3d8types.h:115
#define D3DFVF_XYZB5
Definition: d3d8types.h:119
#define D3DFVF_XYZRHW
Definition: d3d8types.h:114
#define D3DFVF_XYZB4
Definition: d3d8types.h:118
#define D3DFVF_NORMAL
Definition: d3d8types.h:120
#define D3DFVF_XYZB3
Definition: d3d8types.h:117
#define D3DFVF_XYZB2
Definition: d3d8types.h:116
#define D3DFVF_SPECULAR
Definition: d3d8types.h:123
#define D3DFVF_POSITION_MASK
Definition: d3d8types.h:112
float D3DVALUE
Definition: d3dtypes.h:89
#define D3DFVF_RESERVED1
Definition: d3dtypes.h:1309
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num)
#define GET_TEXCOUNT_FROM_FVF(d3dvtVertexType)
#define DWORD
Definition: nt_native.h:44

Referenced by d3d_device3_Begin(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), d3d_device7_DrawPrimitiveVB(), d3d_vertex_buffer7_GetVertexBufferDesc(), d3d_vertex_buffer7_ProcessVertices(), d3d_vertex_buffer_create(), and process_vertices_strided().

◆ hr_ddraw_from_wined3d()

◆ impl_from_IDirect3DDevice()

◆ impl_from_IDirect3DDevice2()

◆ impl_from_IDirect3DDevice3()

◆ impl_from_IDirect3DDevice7()

static struct d3d_device * impl_from_IDirect3DDevice7 ( IDirect3DDevice7 *  iface)
inlinestatic

◆ impl_from_IDirect3DTexture()

static struct ddraw_surface * impl_from_IDirect3DTexture ( IDirect3DTexture *  iface)
inlinestatic

◆ impl_from_IDirect3DTexture2()

static struct ddraw_surface * impl_from_IDirect3DTexture2 ( IDirect3DTexture2 *  iface)
inlinestatic

Definition at line 228 of file ddraw_private.h.

229{
230 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture2_iface);
231}

Referenced by d3d_texture2_AddRef(), d3d_texture2_GetHandle(), d3d_texture2_Load(), d3d_texture2_QueryInterface(), and d3d_texture2_Release().

◆ impl_from_IDirectDrawPalette()

static struct ddraw_palette * impl_from_IDirectDrawPalette ( IDirectDrawPalette *  iface)
inlinestatic

◆ impl_from_IDirectDrawSurface()

◆ impl_from_IDirectDrawSurface2()

◆ impl_from_IDirectDrawSurface3()

◆ impl_from_IDirectDrawSurface4()

static struct ddraw_surface * impl_from_IDirectDrawSurface4 ( IDirectDrawSurface4 *  iface)
inlinestatic

Definition at line 248 of file ddraw_private.h.

249{
250 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface4_iface);
251}

Referenced by ddraw_surface4_AddAttachedSurface(), ddraw_surface4_AddOverlayDirtyRect(), ddraw_surface4_AddRef(), ddraw_surface4_Blt(), ddraw_surface4_BltBatch(), ddraw_surface4_BltFast(), ddraw_surface4_ChangeUniquenessValue(), ddraw_surface4_DeleteAttachedSurface(), ddraw_surface4_EnumAttachedSurfaces(), ddraw_surface4_EnumOverlayZOrders(), ddraw_surface4_Flip(), ddraw_surface4_FreePrivateData(), ddraw_surface4_GetAttachedSurface(), ddraw_surface4_GetBltStatus(), ddraw_surface4_GetCaps(), ddraw_surface4_GetClipper(), ddraw_surface4_GetColorKey(), ddraw_surface4_GetDC(), ddraw_surface4_GetDDInterface(), ddraw_surface4_GetFlipStatus(), ddraw_surface4_GetOverlayPosition(), ddraw_surface4_GetPalette(), ddraw_surface4_GetPixelFormat(), ddraw_surface4_GetPrivateData(), ddraw_surface4_GetSurfaceDesc(), ddraw_surface4_GetUniquenessValue(), ddraw_surface4_Initialize(), ddraw_surface4_IsLost(), ddraw_surface4_Lock(), ddraw_surface4_PageLock(), ddraw_surface4_PageUnlock(), ddraw_surface4_QueryInterface(), ddraw_surface4_Release(), ddraw_surface4_ReleaseDC(), ddraw_surface4_Restore(), ddraw_surface4_SetClipper(), ddraw_surface4_SetColorKey(), ddraw_surface4_SetOverlayPosition(), ddraw_surface4_SetPalette(), ddraw_surface4_SetPrivateData(), ddraw_surface4_SetSurfaceDesc(), ddraw_surface4_Unlock(), ddraw_surface4_UpdateOverlay(), ddraw_surface4_UpdateOverlayDisplay(), and ddraw_surface4_UpdateOverlayZOrder().

◆ impl_from_IDirectDrawSurface7()

static struct ddraw_surface * impl_from_IDirectDrawSurface7 ( IDirectDrawSurface7 iface)
inlinestatic

Definition at line 253 of file ddraw_private.h.

254{
255 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface7_iface);
256}

Referenced by d3d_device2_GetRenderTarget(), d3d_device3_GetRenderTarget(), d3d_device_update_depth_stencil(), ddraw1_DuplicateSurface(), ddraw1_GetGDISurface(), ddraw2_DuplicateSurface(), ddraw2_GetGDISurface(), ddraw4_DuplicateSurface(), ddraw4_GetGDISurface(), ddraw4_GetSurfaceFromDC(), ddraw7_FlipToGDISurface(), ddraw_surface1_GetAttachedSurface(), ddraw_surface2_GetAttachedSurface(), ddraw_surface3_GetAttachedSurface(), ddraw_surface4_GetAttachedSurface(), ddraw_surface7_AddAttachedSurface(), ddraw_surface7_AddRef(), ddraw_surface7_Blt(), ddraw_surface7_BltFast(), ddraw_surface7_DeleteAttachedSurface(), ddraw_surface7_EnumAttachedSurfaces(), ddraw_surface7_Flip(), ddraw_surface7_FreePrivateData(), ddraw_surface7_GetAttachedSurface(), ddraw_surface7_GetCaps(), ddraw_surface7_GetClipper(), ddraw_surface7_GetColorKey(), ddraw_surface7_GetDC(), ddraw_surface7_GetDDInterface(), ddraw_surface7_GetLOD(), ddraw_surface7_GetOverlayPosition(), ddraw_surface7_GetPalette(), ddraw_surface7_GetPixelFormat(), ddraw_surface7_GetPriority(), ddraw_surface7_GetPrivateData(), ddraw_surface7_GetSurfaceDesc(), ddraw_surface7_IsLost(), ddraw_surface7_Lock(), ddraw_surface7_QueryInterface(), ddraw_surface7_Release(), ddraw_surface7_ReleaseDC(), ddraw_surface7_Restore(), ddraw_surface7_SetClipper(), ddraw_surface7_SetColorKey(), ddraw_surface7_SetLOD(), ddraw_surface7_SetOverlayPosition(), ddraw_surface7_SetPalette(), ddraw_surface7_SetPriority(), ddraw_surface7_SetPrivateData(), ddraw_surface7_SetSurfaceDesc(), ddraw_surface7_Unlock(), ddraw_surface7_UpdateOverlay(), ddraw_surface7_UpdateOverlayZOrder(), EnumCallback(), EnumCallback2(), EnumSurfacesCallback2Thunk(), EnumSurfacesCallbackThunk(), and get_sub_mimaplevel().

◆ light_activate()

void light_activate ( struct d3d_light light)

Definition at line 51 of file light.c.

52{
53 struct d3d_device *device;
54
55 TRACE("light %p.\n", light);
56
57 if (!light->active_viewport || !light->active_viewport->active_device) return;
58 device = light->active_viewport->active_device;
59
61 if (!(light->light.dwFlags & D3DLIGHT_ACTIVE))
62 {
63 IDirect3DDevice7_LightEnable(&device->IDirect3DDevice7_iface, light->dwLightIndex, TRUE);
64 light->light.dwFlags |= D3DLIGHT_ACTIVE;
65 }
66}
#define IDirect3DDevice7_LightEnable(p, a, b)
Definition: d3d.h:1387
#define D3DLIGHT_ACTIVE
Definition: d3dtypes.h:596
static void light_update(struct d3d_light *light)
Definition: light.c:33

Referenced by d3d_light_SetLight(), d3d_viewport_AddLight(), and viewport_activate().

◆ light_deactivate()

void light_deactivate ( struct d3d_light light)

Definition at line 75 of file light.c.

76{
77 struct d3d_device *device;
78
79 TRACE("light %p.\n", light);
80
81 if (!light->active_viewport || !light->active_viewport->active_device) return;
82 device = light->active_viewport->active_device;
83
84 if (light->light.dwFlags & D3DLIGHT_ACTIVE)
85 {
86 IDirect3DDevice7_LightEnable(&device->IDirect3DDevice7_iface, light->dwLightIndex, FALSE);
87 light->light.dwFlags &= ~D3DLIGHT_ACTIVE;
88 }
89}

Referenced by d3d_light_SetLight(), and d3d_viewport_DeleteLight().

◆ material_activate()

void material_activate ( struct d3d_material material)

Definition at line 447 of file material.c.

448{
449 D3DMATERIAL7 d3d7mat;
450
451 TRACE("Activating material %p.\n", material);
452
453 d3d7mat.u.diffuse = material->mat.u.diffuse;
454 d3d7mat.u1.ambient = material->mat.u1.ambient;
455 d3d7mat.u2.specular = material->mat.u2.specular;
456 d3d7mat.u3.emissive = material->mat.u3.emissive;
457 d3d7mat.u4.power = material->mat.u4.power;
458
459 IDirect3DDevice7_SetMaterial(&material->active_device->IDirect3DDevice7_iface, &d3d7mat);
460}
#define IDirect3DDevice7_SetMaterial(p, a)
Definition: d3d.h:1359
D3DCOLORVALUE emissive
Definition: d3dtypes.h:543
D3DCOLORVALUE specular
Definition: d3dtypes.h:539
D3DCOLORVALUE ambient
Definition: d3dtypes.h:535
D3DVALUE power
Definition: d3dtypes.h:547
D3DCOLORVALUE diffuse
Definition: d3dtypes.h:531
D3DCOLORVALUE ambient
Definition: d3dtypes.h:510
D3DCOLORVALUE emissive
Definition: d3dtypes.h:518
D3DVALUE power
Definition: d3dtypes.h:522
D3DCOLORVALUE diffuse
Definition: d3dtypes.h:506
D3DCOLORVALUE specular
Definition: d3dtypes.h:514
D3DMATERIAL mat
struct d3d_device * active_device

Referenced by d3d_device3_SetLightState().

◆ multiply_matrix()

void multiply_matrix ( D3DMATRIX dst,
const D3DMATRIX src1,
const D3DMATRIX src2 
)

Definition at line 1173 of file utils.c.

1176{
1178
1179 /* Now do the multiplication 'by hand'.
1180 I know that all this could be optimised, but this will be done later :-) */
1181 temp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
1182 temp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
1183 temp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
1184 temp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
1185
1186 temp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
1187 temp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
1188 temp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
1189 temp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
1190
1191 temp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
1192 temp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
1193 temp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
1194 temp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
1195
1196 temp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
1197 temp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
1198 temp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
1199 temp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
1200
1201 /* And copy the new matrix in the good storage.. */
1202 memcpy(dest, &temp, 16 * sizeof(D3DVALUE));
1203}
static char * dest
Definition: rtl.c:135
static calc_node_t temp
Definition: rpn_ieee.c:38
float _32
Definition: d3d8types.h:1113
float _42
Definition: d3d8types.h:1114
float _13
Definition: d3d8types.h:1111
float _44
Definition: d3d8types.h:1114
float _14
Definition: d3d8types.h:1111
float _11
Definition: d3d8types.h:1111
float _33
Definition: d3d8types.h:1113
float _24
Definition: d3d8types.h:1112
float _31
Definition: d3d8types.h:1113
float _34
Definition: d3d8types.h:1113
float _12
Definition: d3d8types.h:1111
float _21
Definition: d3d8types.h:1112
float _41
Definition: d3d8types.h:1114
float _23
Definition: d3d8types.h:1112
float _43
Definition: d3d8types.h:1114
float _22
Definition: d3d8types.h:1112

Referenced by d3d_device3_MultiplyTransform(), d3d_device3_SetTransform(), d3d_viewport_TransformVertices(), get_modelview_matrix(), get_projection_matrix(), get_texture_matrix(), prepare_clip_space_planes(), process_vertices_strided(), update_clip_space(), and wined3d_device_multiply_transform().

◆ unsafe_impl_from_IDirect3DDevice()

struct d3d_device * unsafe_impl_from_IDirect3DDevice ( IDirect3DDevice *  iface)

Definition at line 6871 of file device.c.

6872{
6873 if (!iface) return NULL;
6874 assert(iface->lpVtbl == &d3d_device1_vtbl);
6875 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice_iface);
6876}
static const struct IDirect3DDeviceVtbl d3d_device1_vtbl
Definition: device.c:6815
#define assert(x)
Definition: debug.h:53

Referenced by d3d_material1_GetHandle(), and d3d_texture1_GetHandle().

◆ unsafe_impl_from_IDirect3DDevice2()

struct d3d_device * unsafe_impl_from_IDirect3DDevice2 ( IDirect3DDevice2 *  iface)

Definition at line 6864 of file device.c.

6865{
6866 if (!iface) return NULL;
6867 assert(iface->lpVtbl == &d3d_device2_vtbl);
6868 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice2_iface);
6869}
static const struct IDirect3DDevice2Vtbl d3d_device2_vtbl
Definition: device.c:6776

Referenced by d3d_material2_GetHandle(), and d3d_texture2_GetHandle().

◆ unsafe_impl_from_IDirect3DDevice3()

struct d3d_device * unsafe_impl_from_IDirect3DDevice3 ( IDirect3DDevice3 *  iface)

Definition at line 6857 of file device.c.

6858{
6859 if (!iface) return NULL;
6860 assert(iface->lpVtbl == &d3d_device3_vtbl);
6861 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice3_iface);
6862}
static const struct IDirect3DDevice3Vtbl d3d_device3_vtbl
Definition: device.c:6728

Referenced by d3d_material3_GetHandle(), and d3d_vertex_buffer7_ProcessVertices().

◆ unsafe_impl_from_IDirect3DDevice7()

struct d3d_device * unsafe_impl_from_IDirect3DDevice7 ( IDirect3DDevice7 *  iface)

Definition at line 6850 of file device.c.

6851{
6852 if (!iface) return NULL;
6853 assert((iface->lpVtbl == &d3d_device7_fpu_preserve_vtbl) || (iface->lpVtbl == &d3d_device7_fpu_setup_vtbl));
6854 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice7_iface);
6855}
static const struct IDirect3DDevice7Vtbl d3d_device7_fpu_preserve_vtbl
Definition: device.c:6673
static const struct IDirect3DDevice7Vtbl d3d_device7_fpu_setup_vtbl
Definition: device.c:6618

Referenced by d3d_vertex_buffer7_ProcessVertices().

◆ unsafe_impl_from_IDirect3DExecuteBuffer()

struct d3d_execute_buffer * unsafe_impl_from_IDirect3DExecuteBuffer ( IDirect3DExecuteBuffer *  iface)

Definition at line 809 of file executebuffer.c.

810{
811 if (!iface)
812 return NULL;
813 assert(iface->lpVtbl == &d3d_execute_buffer_vtbl);
814
816}
static struct d3d_execute_buffer * impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface)

Referenced by d3d_device1_Execute().

◆ unsafe_impl_from_IDirect3DLight()

struct d3d_light * unsafe_impl_from_IDirect3DLight ( IDirect3DLight *  iface)

Definition at line 254 of file light.c.

255{
256 if (!iface)
257 return NULL;
258 assert(iface->lpVtbl == &d3d_light_vtbl);
259
260 return impl_from_IDirect3DLight(iface);
261}
static struct d3d_light * impl_from_IDirect3DLight(IDirect3DLight *iface)
Definition: light.c:91

Referenced by d3d_viewport_AddLight(), d3d_viewport_DeleteLight(), and d3d_viewport_NextLight().

◆ unsafe_impl_from_IDirect3DTexture()

struct ddraw_surface * unsafe_impl_from_IDirect3DTexture ( IDirect3DTexture *  iface)

Definition at line 5728 of file surface.c.

5729{
5730 if (!iface) return NULL;
5731 assert(iface->lpVtbl == &d3d_texture1_vtbl);
5732 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture_iface);
5733}

Referenced by d3d_device1_SwapTextureHandles(), and d3d_texture1_Load().

◆ unsafe_impl_from_IDirect3DTexture2()

struct ddraw_surface * unsafe_impl_from_IDirect3DTexture2 ( IDirect3DTexture2 *  iface)

Definition at line 5721 of file surface.c.

5722{
5723 if (!iface) return NULL;
5724 assert(iface->lpVtbl == &d3d_texture2_vtbl);
5725 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture2_iface);
5726}

Referenced by d3d_device2_SwapTextureHandles(), d3d_device3_SetTexture(), and d3d_texture2_Load().

◆ unsafe_impl_from_IDirect3DVertexBuffer()

struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer ( IDirect3DVertexBuffer *  iface)

◆ unsafe_impl_from_IDirect3DVertexBuffer7()

struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer7 ( IDirect3DVertexBuffer7 *  iface)

Definition at line 486 of file vertexbuffer.c.

487{
488 if (!iface)
489 return NULL;
490 assert(iface->lpVtbl == &d3d_vertex_buffer7_vtbl);
491
493}
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:27

Referenced by d3d_device3_DrawIndexedPrimitiveVB(), d3d_device3_DrawPrimitiveVB(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitiveVB(), and d3d_vertex_buffer7_ProcessVertices().

◆ unsafe_impl_from_IDirect3DViewport()

struct d3d_viewport * unsafe_impl_from_IDirect3DViewport ( IDirect3DViewport *  iface)

Definition at line 1138 of file viewport.c.

1139{
1140 /* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
1141 if (!iface) return NULL;
1142 assert(iface->lpVtbl == (IDirect3DViewportVtbl *)&d3d_viewport_vtbl);
1143 return CONTAINING_RECORD((IDirect3DViewport3 *)iface, struct d3d_viewport, IDirect3DViewport3_iface);
1144}

Referenced by d3d_device1_AddViewport(), d3d_device1_DeleteViewport(), d3d_device1_Execute(), and d3d_device1_NextViewport().

◆ unsafe_impl_from_IDirect3DViewport2()

struct d3d_viewport * unsafe_impl_from_IDirect3DViewport2 ( IDirect3DViewport2 *  iface)

Definition at line 1130 of file viewport.c.

1131{
1132 /* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
1133 if (!iface) return NULL;
1134 assert(iface->lpVtbl == (IDirect3DViewport2Vtbl *)&d3d_viewport_vtbl);
1135 return CONTAINING_RECORD((IDirect3DViewport3 *)iface, struct d3d_viewport, IDirect3DViewport3_iface);
1136}

Referenced by d3d_device2_AddViewport(), d3d_device2_DeleteViewport(), d3d_device2_NextViewport(), and d3d_device2_SetCurrentViewport().

◆ unsafe_impl_from_IDirect3DViewport3()

struct d3d_viewport * unsafe_impl_from_IDirect3DViewport3 ( IDirect3DViewport3 *  iface)

Definition at line 1123 of file viewport.c.

1124{
1125 if (!iface) return NULL;
1126 assert(iface->lpVtbl == &d3d_viewport_vtbl);
1127 return CONTAINING_RECORD(iface, struct d3d_viewport, IDirect3DViewport3_iface);
1128}

Referenced by d3d_device3_AddViewport(), d3d_device3_DeleteViewport(), d3d_device3_NextViewport(), and d3d_device3_SetCurrentViewport().

◆ unsafe_impl_from_IDirectDrawClipper()

struct ddraw_clipper * unsafe_impl_from_IDirectDrawClipper ( IDirectDrawClipper *  iface)

Definition at line 329 of file clipper.c.

330{
331 if (!iface)
332 return NULL;
333 assert(iface->lpVtbl == &ddraw_clipper_vtbl);
334
335 return impl_from_IDirectDrawClipper(iface);
336}
static struct ddraw_clipper * impl_from_IDirectDrawClipper(IDirectDrawClipper *iface)
Definition: clipper.c:29

Referenced by ddraw_surface7_SetClipper().

◆ unsafe_impl_from_IDirectDrawPalette()

struct ddraw_palette * unsafe_impl_from_IDirectDrawPalette ( IDirectDrawPalette *  iface)

Definition at line 234 of file palette.c.

235{
236 if (!iface) return NULL;
237 assert(iface->lpVtbl == &ddraw_palette_vtbl);
238 return CONTAINING_RECORD(iface, struct ddraw_palette, IDirectDrawPalette_iface);
239}

Referenced by ddraw_surface_set_palette().

◆ unsafe_impl_from_IDirectDrawSurface()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface ( IDirectDrawSurface *  iface)

Definition at line 5705 of file surface.c.

5706{
5707 if (!iface) return NULL;
5708 if (iface->lpVtbl != &ddraw_surface1_vtbl)
5709 {
5710 HRESULT hr = IDirectDrawSurface_QueryInterface(iface, &IID_IDirectDrawSurface, (void **)&iface);
5711 if (FAILED(hr))
5712 {
5713 WARN("Object %p doesn't expose interface IDirectDrawSurface.\n", iface);
5714 return NULL;
5715 }
5716 IDirectDrawSurface_Release(iface);
5717 }
5718 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface_iface);
5719}

Referenced by d3d2_CreateDevice(), d3d_device2_SetRenderTarget(), ddraw1_DuplicateSurface(), ddraw2_DuplicateSurface(), ddraw_surface1_AddAttachedSurface(), ddraw_surface1_Blt(), ddraw_surface1_BltFast(), ddraw_surface1_DeleteAttachedSurface(), ddraw_surface1_Flip(), ddraw_surface1_UpdateOverlay(), and ddraw_surface1_UpdateOverlayZOrder().

◆ unsafe_impl_from_IDirectDrawSurface4()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface4 ( IDirectDrawSurface4 *  iface)

Definition at line 5657 of file surface.c.

5658{
5659 if (!iface) return NULL;
5660 if (iface->lpVtbl != &ddraw_surface4_vtbl)
5661 {
5662 HRESULT hr = IDirectDrawSurface4_QueryInterface(iface, &IID_IDirectDrawSurface4, (void **)&iface);
5663 if (FAILED(hr))
5664 {
5665 WARN("Object %p doesn't expose interface IDirectDrawSurface4.\n", iface);
5666 return NULL;
5667 }
5668 IDirectDrawSurface4_Release(iface);
5669 }
5670 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface4_iface);
5671}

Referenced by d3d3_CreateDevice(), d3d_device3_SetRenderTarget(), ddraw4_DuplicateSurface(), ddraw_surface4_AddAttachedSurface(), ddraw_surface4_Blt(), ddraw_surface4_BltFast(), ddraw_surface4_DeleteAttachedSurface(), ddraw_surface4_Flip(), ddraw_surface4_UpdateOverlay(), and ddraw_surface4_UpdateOverlayZOrder().

◆ unsafe_impl_from_IDirectDrawSurface7()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface7 ( IDirectDrawSurface7 iface)

Definition at line 5641 of file surface.c.

5642{
5643 if (!iface) return NULL;
5644 if (iface->lpVtbl != &ddraw_surface7_vtbl)
5645 {
5646 HRESULT hr = IDirectDrawSurface7_QueryInterface(iface, &IID_IDirectDrawSurface7, (void **)&iface);
5647 if (FAILED(hr))
5648 {
5649 WARN("Object %p doesn't expose interface IDirectDrawSurface7.\n", iface);
5650 return NULL;
5651 }
5652 IDirectDrawSurface7_Release(iface);
5653 }
5654 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface7_iface);
5655}

Referenced by copy_mipmap_chain(), d3d7_CreateDevice(), d3d_device3_GetTexture(), d3d_device7_Load(), d3d_device7_PreLoad(), d3d_device7_SetRenderTarget(), d3d_device7_SetTexture(), ddraw7_DuplicateSurface(), ddraw7_EnumSurfaces(), ddraw_surface7_AddAttachedSurface(), ddraw_surface7_Blt(), ddraw_surface7_BltFast(), ddraw_surface7_DeleteAttachedSurface(), ddraw_surface7_Flip(), ddraw_surface7_UpdateOverlay(), and is_mip_level_subset().

◆ viewport_activate()

void viewport_activate ( struct d3d_viewport viewport,
BOOL  ignore_lights 
)

Definition at line 55 of file viewport.c.

56{
58 D3DVIEWPORT7 vp;
59
60 if (!ignore_lights)
61 {
62 struct d3d_light *light;
63
64 /* Activate all the lights associated with this context */
65 LIST_FOR_EACH_ENTRY(light, &This->light_list, struct d3d_light, entry)
66 {
68 }
69 }
70
71 /* And copy the values in the structure used by the device */
72 if (This->use_vp2)
73 {
74 vp.dwX = This->viewports.vp2.dwX;
75 vp.dwY = This->viewports.vp2.dwY;
76 vp.dwHeight = This->viewports.vp2.dwHeight;
77 vp.dwWidth = This->viewports.vp2.dwWidth;
78 vp.dvMinZ = 0.0f;
79 vp.dvMaxZ = 1.0f;
80
81 scale.x = 2.0f / This->viewports.vp2.dvClipWidth;
82 scale.y = 2.0f / This->viewports.vp2.dvClipHeight;
83 scale.z = 1.0f / (This->viewports.vp2.dvMaxZ - This->viewports.vp2.dvMinZ);
84 offset.x = -2.0f * This->viewports.vp2.dvClipX / This->viewports.vp2.dvClipWidth - 1.0f;
85 offset.y = -2.0f * This->viewports.vp2.dvClipY / This->viewports.vp2.dvClipHeight + 1.0f;
86 offset.z = -This->viewports.vp2.dvMinZ / (This->viewports.vp2.dvMaxZ - This->viewports.vp2.dvMinZ);
87 }
88 else
89 {
90 vp.dwX = This->viewports.vp1.dwX;
91 vp.dwY = This->viewports.vp1.dwY;
92 vp.dwHeight = This->viewports.vp1.dwHeight;
93 vp.dwWidth = This->viewports.vp1.dwWidth;
94 vp.dvMinZ = 0.0f;
95 vp.dvMaxZ = 1.0f;
96
97 scale.x = 2.0f * This->viewports.vp1.dvScaleX / This->viewports.vp1.dwWidth;
98 scale.y = 2.0f * This->viewports.vp1.dvScaleY / This->viewports.vp1.dwHeight;
99 scale.z = 1.0f;
100 offset.x = 0.0f;
101 offset.y = 0.0f;
102 offset.z = 0.0f;
103 }
104
105 update_clip_space(This->active_device, &scale, &offset);
106 IDirect3DDevice7_SetViewport(&This->active_device->IDirect3DDevice7_iface, &vp);
107}
#define IDirect3DDevice7_SetViewport(p, a)
Definition: d3d.h:1356
static void update_clip_space(struct d3d_device *device, struct wined3d_vec3 *scale, struct wined3d_vec3 *offset)
Definition: viewport.c:31
void light_activate(struct d3d_light *light) DECLSPEC_HIDDEN
Definition: light.c:51
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GLintptr offset
Definition: glext.h:5920

Referenced by d3d_device3_SetCurrentViewport(), d3d_viewport_Clear(), d3d_viewport_Clear2(), d3d_viewport_SetViewport(), d3d_viewport_SetViewport2(), and d3d_viewport_TransformVertices().

◆ wined3d_colour_from_ddraw_colour()

BOOL wined3d_colour_from_ddraw_colour ( const DDPIXELFORMAT pf,
const struct ddraw_palette palette,
DWORD  colour,
struct wined3d_color wined3d_colour 
)

Definition at line 596 of file utils.c.

598{
599 if (pf->dwFlags & DDPF_ALPHA)
600 {
601 DWORD size, mask;
602
603 size = pf->u1.dwAlphaBitDepth;
604 mask = size < 32 ? (1u << size) - 1 : ~0u;
605 wined3d_colour->r = 0.0f;
606 wined3d_colour->g = 0.0f;
607 wined3d_colour->b = 0.0f;
608 wined3d_colour->a = colour_to_float(colour, mask);
609 return TRUE;
610 }
611
612 if (pf->dwFlags & DDPF_FOURCC)
613 {
614 WARN("FourCC formats not supported.\n");
615 goto fail;
616 }
617
619 {
621
622 colour &= 0xff;
623 if (!palette || FAILED(wined3d_palette_get_entries(palette->wined3d_palette, 0, colour, 1, &entry)))
624 {
625 wined3d_colour->r = 0.0f;
626 wined3d_colour->g = 0.0f;
627 wined3d_colour->b = 0.0f;
628 }
629 else
630 {
631 wined3d_colour->r = entry.peRed / 255.0f;
632 wined3d_colour->g = entry.peGreen / 255.0f;
633 wined3d_colour->b = entry.peBlue / 255.0f;
634 }
635 wined3d_colour->a = colour / 255.0f;
636 return TRUE;
637 }
638
639 if (pf->dwFlags & DDPF_RGB)
640 {
641 wined3d_colour->r = colour_to_float(colour, pf->u2.dwRBitMask);
642 wined3d_colour->g = colour_to_float(colour, pf->u3.dwGBitMask);
643 wined3d_colour->b = colour_to_float(colour, pf->u4.dwBBitMask);
644 if (pf->dwFlags & DDPF_ALPHAPIXELS)
645 wined3d_colour->a = colour_to_float(colour, pf->u5.dwRGBAlphaBitMask);
646 else
647 wined3d_colour->a = 0.0f;
648 return TRUE;
649 }
650
651 if (pf->dwFlags & DDPF_ZBUFFER)
652 {
653 wined3d_colour->r = colour_to_float(colour, pf->u3.dwZBitMask);
654 if (pf->dwFlags & DDPF_STENCILBUFFER)
655 wined3d_colour->g = colour_to_float(colour, pf->u4.dwStencilBitMask);
656 else
657 wined3d_colour->g = 0.0f;
658 wined3d_colour->b = 0.0f;
659 wined3d_colour->a = 0.0f;
660 return TRUE;
661 }
662
663 FIXME("Unhandled pixel format.\n");
665
666fail:
667 wined3d_colour->r = 0.0f;
668 wined3d_colour->g = 0.0f;
669 wined3d_colour->b = 0.0f;
670 wined3d_colour->a = 0.0f;
671
672 return FALSE;
673}
static float colour_to_float(DWORD colour, DWORD mask)
Definition: utils.c:589
HRESULT CDECL wined3d_palette_get_entries(const struct wined3d_palette *palette, DWORD flags, DWORD start, DWORD count, PALETTEENTRY *entries)
Definition: palette.c:53
GLenum GLint GLuint mask
Definition: glext.h:6028
DWORD dwBBitMask
Definition: ddraw.h:1106
DWORD dwAlphaBitDepth
Definition: ddraw.h:1078
DWORD dwRBitMask
Definition: ddraw.h:1085
DWORD dwGBitMask
Definition: ddraw.h:1094
DWORD dwFlags
Definition: ddraw.h:1071
DWORD dwRGBAlphaBitMask
Definition: ddraw.h:1113
DWORD dwZBitMask
Definition: ddraw.h:1096
DWORD dwStencilBitMask
Definition: ddraw.h:1108

Referenced by ddraw_surface_blt().

◆ wined3dformat_from_ddrawformat()

enum wined3d_format_id wined3dformat_from_ddrawformat ( const DDPIXELFORMAT format)

Definition at line 333 of file utils.c.

334{
335 TRACE("Convert a DirectDraw Pixelformat to a WineD3D Pixelformat\n");
336 if(TRACE_ON(ddraw))
337 {
338 DDRAW_dump_pixelformat(DDPixelFormat);
339 }
340
341 if(DDPixelFormat->dwFlags & DDPF_PALETTEINDEXED8)
342 {
343 return WINED3DFMT_P8_UINT;
344 }
345 else if(DDPixelFormat->dwFlags & (DDPF_PALETTEINDEXED1 | DDPF_PALETTEINDEXED2 | DDPF_PALETTEINDEXED4) )
346 {
347 FIXME("DDPF_PALETTEINDEXED1 to DDPF_PALETTEINDEXED4 are not supported by WineD3D (yet). Returning WINED3DFMT_P8\n");
348 return WINED3DFMT_P8_UINT;
349 }
350 else if(DDPixelFormat->dwFlags & DDPF_RGB)
351 {
352 switch(DDPixelFormat->u1.dwRGBBitCount)
353 {
354 case 8:
355 /* This is the only format that can match here */
357
358 case 16:
359 /* Read the Color masks */
360 if( (DDPixelFormat->u2.dwRBitMask == 0xF800) &&
361 (DDPixelFormat->u3.dwGBitMask == 0x07E0) &&
362 (DDPixelFormat->u4.dwBBitMask == 0x001F) )
363 {
365 }
366
367 if( (DDPixelFormat->u2.dwRBitMask == 0x7C00) &&
368 (DDPixelFormat->u3.dwGBitMask == 0x03E0) &&
369 (DDPixelFormat->u4.dwBBitMask == 0x001F) )
370 {
371 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
372 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0x8000))
374 else
376 }
377
378 if( (DDPixelFormat->u2.dwRBitMask == 0x0F00) &&
379 (DDPixelFormat->u3.dwGBitMask == 0x00F0) &&
380 (DDPixelFormat->u4.dwBBitMask == 0x000F) )
381 {
382 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
383 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xF000))
385 else
387 }
388
389 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
390 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xFF00) &&
391 (DDPixelFormat->u2.dwRBitMask == 0x00E0) &&
392 (DDPixelFormat->u3.dwGBitMask == 0x001C) &&
393 (DDPixelFormat->u4.dwBBitMask == 0x0003) )
394 {
396 }
397 WARN("16 bit RGB Pixel format does not match.\n");
398 return WINED3DFMT_UNKNOWN;
399
400 case 24:
402
403 case 32:
404 /* Read the Color masks */
405 if( (DDPixelFormat->u2.dwRBitMask == 0x00FF0000) &&
406 (DDPixelFormat->u3.dwGBitMask == 0x0000FF00) &&
407 (DDPixelFormat->u4.dwBBitMask == 0x000000FF) )
408 {
409 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
410 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xFF000000))
412 else
414
415 }
416 WARN("32 bit RGB pixel format does not match.\n");
417 return WINED3DFMT_UNKNOWN;
418
419 default:
420 WARN("Invalid dwRGBBitCount in Pixelformat structure.\n");
421 return WINED3DFMT_UNKNOWN;
422 }
423 }
424 else if( (DDPixelFormat->dwFlags & DDPF_ALPHA) )
425 {
426 /* Alpha only Pixelformat */
427 switch(DDPixelFormat->u1.dwAlphaBitDepth)
428 {
429 case 8:
430 return WINED3DFMT_A8_UNORM;
431
432 default:
433 WARN("Invalid AlphaBitDepth in Alpha-Only Pixelformat.\n");
434 return WINED3DFMT_UNKNOWN;
435 }
436 }
437 else if(DDPixelFormat->dwFlags & DDPF_LUMINANCE)
438 {
439 /* Luminance-only or luminance-alpha */
440 if(DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS)
441 {
442 /* Luminance with Alpha */
443 switch(DDPixelFormat->u1.dwLuminanceBitCount)
444 {
445 case 4:
446 if(DDPixelFormat->u1.dwAlphaBitDepth == 4)
448 WARN("Unknown Alpha / Luminance bit depth combination.\n");
449 return WINED3DFMT_UNKNOWN;
450
451 case 6:
452 FIXME("A luminance Pixelformat shouldn't have 6 luminance bits. Returning D3DFMT_L6V5U5 for now.\n");
454
455 case 8:
456 if(DDPixelFormat->u1.dwAlphaBitDepth == 8)
458 WARN("Unknown Alpha / Lumincase bit depth combination.\n");
459 return WINED3DFMT_UNKNOWN;
460 }
461 }
462 else
463 {
464 /* Luminance-only */
465 switch(DDPixelFormat->u1.dwLuminanceBitCount)
466 {
467 case 6:
468 FIXME("A luminance Pixelformat shouldn't have 6 luminance bits. Returning D3DFMT_L6V5U5 for now.\n");
470
471 case 8:
472 return WINED3DFMT_L8_UNORM;
473
474 default:
475 WARN("Unknown luminance-only bit depth 0x%x.\n", DDPixelFormat->u1.dwLuminanceBitCount);
476 return WINED3DFMT_UNKNOWN;
477 }
478 }
479 }
480 else if(DDPixelFormat->dwFlags & DDPF_ZBUFFER)
481 {
482 /* Z buffer */
483 if(DDPixelFormat->dwFlags & DDPF_STENCILBUFFER)
484 {
485 switch(DDPixelFormat->u1.dwZBufferBitDepth)
486 {
487 case 16:
488 if (DDPixelFormat->u2.dwStencilBitDepth == 1) return WINED3DFMT_S1_UINT_D15_UNORM;
489 WARN("Unknown depth stencil format: 16 z bits, %u stencil bits.\n",
490 DDPixelFormat->u2.dwStencilBitDepth);
491 return WINED3DFMT_UNKNOWN;
492
493 case 32:
494 if (DDPixelFormat->u2.dwStencilBitDepth == 8) return WINED3DFMT_D24_UNORM_S8_UINT;
495 else if (DDPixelFormat->u2.dwStencilBitDepth == 4) return WINED3DFMT_S4X4_UINT_D24_UNORM;
496 WARN("Unknown depth stencil format: 32 z bits, %u stencil bits.\n",
497 DDPixelFormat->u2.dwStencilBitDepth);
498 return WINED3DFMT_UNKNOWN;
499
500 default:
501 WARN("Unknown depth stencil format: %u z bits, %u stencil bits.\n",
502 DDPixelFormat->u1.dwZBufferBitDepth, DDPixelFormat->u2.dwStencilBitDepth);
503 return WINED3DFMT_UNKNOWN;
504 }
505 }
506 else
507 {
508 switch(DDPixelFormat->u1.dwZBufferBitDepth)
509 {
510 case 16:
512
513 case 24:
515
516 case 32:
517 if (DDPixelFormat->u3.dwZBitMask == 0x00FFFFFF) return WINED3DFMT_X8D24_UNORM;
518 else if (DDPixelFormat->u3.dwZBitMask == 0xFFFFFF00) return WINED3DFMT_X8D24_UNORM;
519 else if (DDPixelFormat->u3.dwZBitMask == 0xFFFFFFFF) return WINED3DFMT_D32_UNORM;
520 WARN("Unknown depth-only format: 32 z bits, mask 0x%08x\n",
521 DDPixelFormat->u3.dwZBitMask);
522 return WINED3DFMT_UNKNOWN;
523
524 default:
525 WARN("Unknown depth-only format: %u z bits, mask 0x%08x\n",
526 DDPixelFormat->u1.dwZBufferBitDepth, DDPixelFormat->u3.dwZBitMask);
527 return WINED3DFMT_UNKNOWN;
528 }
529 }
530 }
531 else if(DDPixelFormat->dwFlags & DDPF_FOURCC)
532 {
533 return DDPixelFormat->dwFourCC;
534 }
535 else if(DDPixelFormat->dwFlags & DDPF_BUMPDUDV)
536 {
537 if( (DDPixelFormat->u1.dwBumpBitCount == 16 ) &&
538 (DDPixelFormat->u2.dwBumpDuBitMask == 0x000000ff) &&
539 (DDPixelFormat->u3.dwBumpDvBitMask == 0x0000ff00) &&
540 (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x00000000) )
541 {
543 }
544 else if ( (DDPixelFormat->u1.dwBumpBitCount == 16 ) &&
545 (DDPixelFormat->u2.dwBumpDuBitMask == 0x0000001f) &&
546 (DDPixelFormat->u3.dwBumpDvBitMask == 0x000003e0) &&
547 (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x0000fc00) )
548 {
550 }
551 else if ( (DDPixelFormat->u1.dwBumpBitCount == 32 ) &&
552 (DDPixelFormat->u2.dwBumpDuBitMask == 0x000000ff) &&
553 (DDPixelFormat->u3.dwBumpDvBitMask == 0x0000ff00) &&
554 (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x00ff0000) )
555 {
557 }
558 }
559
560 WARN("Unknown Pixelformat.\n");
561 return WINED3DFMT_UNKNOWN;
562}

Referenced by ddraw_surface7_SetSurfaceDesc(), and ddraw_surface_create().

◆ wined3dmapflags_from_ddrawmapflags()

unsigned int wined3dmapflags_from_ddrawmapflags ( unsigned int  flags)

Definition at line 564 of file utils.c.

565{
566 static const unsigned int handled = DDLOCK_NOSYSLOCK
570 unsigned int wined3d_flags;
571
572 wined3d_flags = flags & handled;
574 wined3d_flags |= WINED3D_MAP_READ;
575 if (!(flags & DDLOCK_READONLY))
576 wined3d_flags |= WINED3D_MAP_WRITE;
577 if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
578 wined3d_flags |= WINED3D_MAP_READ | WINED3D_MAP_WRITE;
580 wined3d_flags |= WINED3D_MAP_NO_DIRTY_UPDATE;
582
583 if (flags)
584 FIXME("Unhandled flags %#x.\n", flags);
585
586 return wined3d_flags;
587}
#define DDLOCK_READONLY
Definition: ddraw.h:624
#define DDLOCK_WRITEONLY
Definition: ddraw.h:625
#define DDLOCK_NODIRTYUPDATE
Definition: ddraw.h:632
#define DDLOCK_DONOTWAIT
Definition: ddraw.h:630
#define DDLOCK_DISCARDCONTENTS
Definition: ddraw.h:628
#define DDLOCK_NOOVERWRITE
Definition: ddraw.h:627
#define DDLOCK_NOSYSLOCK
Definition: ddraw.h:626
#define DDLOCK_WAIT
Definition: ddraw.h:622
#define WINED3D_MAP_NO_DIRTY_UPDATE
Definition: wined3d.h:937
#define WINED3D_MAP_READ
Definition: wined3d.h:939

Referenced by d3d_vertex_buffer7_Lock(), and surface_lock().

Variable Documentation

◆ DECLSPEC_HIDDEN

const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN
extern

Definition at line 43 of file ddraw_private.h.