ReactOS  0.4.14-dev-583-g2a1ba2c
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
 
struct FvfToDecl helpstring
 

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)
#define min(a, b)
Definition: monoChain.cc:55
CardRegion * from
Definition: spigame.cpp:19
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

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_LEGACY_DEPTH_BIAS
Definition: wined3d.h:1315
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1325
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1322
#define WINED3D_LEGACY_CUBEMAP_FILTERING
Definition: wined3d.h:1327
#define WINED3D_FOCUS_MESSAGES
Definition: wined3d.h:1320
#define WINED3D_LIMIT_VIEWPORT
Definition: wined3d.h:1330
#define WINED3D_NO_PRIMITIVE_RESTART
Definition: wined3d.h:1326
#define WINED3D_VIDMEM_ACCOUNTING
Definition: wined3d.h:1317

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.

◆ 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.

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);
7003  return DDERR_NOPALETTEATTACHED;
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 }
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:263
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
IUnknown * rt_iface
#define WARN(fmt,...)
Definition: debug.h:111
#define ERR_(ch,...)
Definition: debug.h:156
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111
#define DDERR_NO3D
Definition: ddraw.h:83
const GUID * guid
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
static const WCHAR version[]
Definition: asmname.c:66
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
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:264
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
struct d3d_device * d3ddevice
LONG HRESULT
Definition: typedefs.h:77
IUnknown * outer_unknown
#define ERR(fmt,...)
Definition: debug.h:109
#define DDERR_NOPALETTEATTACHED
Definition: ddraw.h:146
DWORD flags
Definition: ddraw_private.h:94
#define D3D_OK
Definition: d3d.h:106
#define DDRAW_NO3D
Definition: ddraw_private.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
GLenum target
Definition: glext.h:7315
#define DDERR_INVALIDCAPS
Definition: ddraw.h:75
#define D3DERR_SURFACENOTINVIDMEM
Definition: d3d.h:147
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
void * object
Definition: jmemsys.h:48
static BOOL validate_surface_palette(struct ddraw_surface *surface)
Definition: device.c:1798
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 }
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
Definition: device.c:4524
static struct ddraw_surface * impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
DWORD IDirectDrawSurface7
Definition: vmrender.idl:20
#define TRACE(s)
Definition: solgame.cpp:4
struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN
Definition: surface.c:6520
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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);
65  return DDERR_INVALIDPARAMS;
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;
92  wined3d_device_set_stream_source(device->wined3d_device, 0,
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;
129  struct wined3d_buffer_desc desc;
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 */
169  if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1)
170  TRACE("EDGEENABLE1 ");
171  if (ci->wFlags & D3DTRIFLAG_EDGEENABLE2)
172  TRACE("EDGEENABLE2 ");
173  if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1)
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 
285  case D3DOP_STATERENDER:
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  {
328  wined3d_device_set_render_state(device->wined3d_device,
330  }
331  else
332  {
335  wined3d_device_set_render_state(device->wined3d_device,
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 
363  case D3DOP_TEXTURELOAD:
364  TRACE("TEXTURELOAD (%u)\n", count);
365 
366  for (i = 0; i < count; ++i)
367  {
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 
395  case D3DOP_BRANCHFORWARD:
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 
449 end_of_buffer:
450  return D3D_OK;
451 }
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2027
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
DWORD dwValue
Definition: d3dtypes.h:1220
HRESULT hr
Definition: shlfolder.c:183
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
Definition: device.c:3769
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
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:382
#define WARN(fmt,...)
Definition: debug.h:111
void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, struct wined3d_vertex_declaration *declaration)
Definition: device.c:2157
GLuint buffer
Definition: glext.h:5915
void viewport_activate(struct d3d_viewport *viewport, BOOL ignore_lights) DECLSPEC_HIDDEN
Definition: viewport.c:55
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define IDirect3DTexture2_Load(p, a)
Definition: d3d.h:632
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
D3DLIGHTSTATETYPE dlstLightStateType
Definition: d3dtypes.h:1026
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 WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:891
#define IDirect3DDevice3_SetTransform(p, a, b)
Definition: d3d.h:1216
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
Definition: devices.h:37
#define a
Definition: ke_i.h:78
static const WCHAR desc[]
Definition: protectdata.c:36
#define FIXME(fmt,...)
Definition: debug.h:110
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count)
Definition: device.c:3740
smooth NULL
Definition: ftsmooth.c:416
void * ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type) DECLSPEC_HIDDEN
Definition: main.c:182
struct _D3DTLVERTEX D3DTLVERTEX
#define D3DFVF_VERTEX
Definition: d3dtypes.h:1328
DWORD dwMask
Definition: d3dtypes.h:1219
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
#define b
Definition: ke_i.h:79
#define IDirect3DDevice3_SetRenderState(p, a, b)
Definition: d3d.h:1213
#define WINED3D_MAP_DISCARD
Definition: wined3d.h:935
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define WINED3DUSAGE_WRITEONLY
Definition: wined3d.h:901
#define D3DTRIFLAG_START
Definition: d3dtypes.h:1170
LONG HRESULT
Definition: typedefs.h:77
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
struct d3d_device * active_device
unsigned long DWORD
Definition: ntddk_ex.h:95
#define D3DPROCESSVERTICES_UPDATEEXTENTS
Definition: d3dtypes.h:1059
#define D3DFVF_TLVERTEX
Definition: d3dtypes.h:1331
#define D3DTRIFLAG_EDGEENABLE1
Definition: d3dtypes.h:1175
D3DMATRIXHANDLE hSrcMatrix1
Definition: d3dtypes.h:1042
#define WINED3D_MAP_WRITE
Definition: wined3d.h:938
D3DTRANSFORMSTATETYPE dtstTransformStateType
Definition: d3dtypes.h:1025
D3DTEXTUREHANDLE hSrcTexture
Definition: d3dtypes.h:670
unsigned char BYTE
Definition: mem.h:68
#define D3DPROCESSVERTICES_COPY
Definition: d3dtypes.h:1056
GLenum src
Definition: glext.h:6340
#define D3DTRIFLAG_ODD
Definition: d3dtypes.h:1172
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3D_MAP_NOOVERWRITE
Definition: wined3d.h:934
DWORD dwOffset
Definition: d3dtypes.h:1222
#define ERR(fmt,...)
Definition: debug.h:109
DWORD dwArg[1]
Definition: d3dtypes.h:1030
#define D3DPROCESSVERTICES_NOCOLOR
Definition: d3dtypes.h:1060
#define D3D_OK
Definition: d3d.h:106
#define D3DPROCESSVERTICES_TRANSFORMLIGHT
Definition: d3dtypes.h:1054
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
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
GLenum GLenum dst
Definition: glext.h:6340
void multiply_matrix(D3DMATRIX *dst, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN
Definition: utils.c:1173
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
static void _dump_executedata(const D3DEXECUTEDATA *lpData)
Definition: executebuffer.c:36
#define IDirect3DDevice3_SetLightState(p, a, b)
Definition: d3d.h:1215
#define c
Definition: ke_i.h:80
#define D3DFVF_LVERTEX
Definition: d3dtypes.h:1329
D3DMATRIXHANDLE hSrcMatrix2
Definition: d3dtypes.h:1043
#define D3DPROCESSVERTICES_OPMASK
Definition: d3dtypes.h:1057
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
Definition: ddraw.c:83
UINT op
Definition: effect.c:223
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
BOOL bNegate
Definition: d3dtypes.h:1221
D3DTEXTUREHANDLE hDestTexture
Definition: d3dtypes.h:669
D3DMATRIXHANDLE hDestMatrix
Definition: d3dtypes.h:1041
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat p
Definition: glext.h:8902
#define D3DPROCESSVERTICES_TRANSFORM
Definition: d3dtypes.h:1055
#define D3DTRIFLAG_EVEN
Definition: d3dtypes.h:1173
#define TRACE_ON(x)
Definition: compat.h:65
D3DRENDERSTATETYPE drstRenderStateType
Definition: d3dtypes.h:1027
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
struct task_struct * current
Definition: linux.c:32
Definition: palette.c:467
#define D3DTRIFLAG_EDGEENABLE2
Definition: d3dtypes.h:1176
struct wined3d_vertex_declaration * ddraw_find_decl(struct ddraw *This, DWORD fvf)
Definition: ddraw.c:4781

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 {
778  execute_buffer->IDirect3DExecuteBuffer_iface.lpVtbl = &d3d_execute_buffer_vtbl;
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 TRUE
Definition: types.h:120
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111
Definition: devices.h:37
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface
static const WCHAR desc[]
Definition: protectdata.c:36
smooth NULL
Definition: ftsmooth.c:416
struct d3d_device * d3ddev
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
#define D3D_OK
Definition: d3d.h:106
#define D3DDEB_LPDATA
Definition: d3dcaps.h:144
D3DEXECUTEBUFFERDESC desc
static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl
#define D3DDEB_BUFSIZE
Definition: d3dcaps.h:142

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 }
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
struct ddraw * ddraw
static const struct IDirect3DLightVtbl d3d_light_vtbl
Definition: light.c:235

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 
508  material->IDirect3DMaterial3_iface.lpVtbl = &d3d_material3_vtbl;
509  material->IDirect3DMaterial2_iface.lpVtbl = &d3d_material2_vtbl;
510  material->IDirect3DMaterial_iface.lpVtbl = &d3d_material1_vtbl;
511  material->ref = 1;
512  material->ddraw = ddraw;
513 
514  return material;
515 }
IDirect3DMaterial2 IDirect3DMaterial2_iface
struct ddraw * ddraw
smooth NULL
Definition: ftsmooth.c:416
static const struct IDirect3DMaterial3Vtbl d3d_material3_vtbl
Definition: material.c:462
static const struct IDirect3DMaterial2Vtbl d3d_material2_vtbl
Definition: material.c:474
IDirect3DMaterial IDirect3DMaterial_iface
IDirect3DMaterial3 IDirect3DMaterial3_iface
static const struct IDirect3DMaterialVtbl d3d_material1_vtbl
Definition: material.c:486

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 {
435  struct d3d_vertex_buffer *buffer;
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);
462  if (hr == WINED3DERR_INVALIDCALL)
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 
476 end:
478  if (hr == D3D_OK)
479  *vertex_buf = buffer;
480  else
481  heap_free(buffer);
482 
483  return hr;
484 }
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
int d3dversion
GLuint buffer
Definition: glext.h:5915
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111
GLuint GLuint end
Definition: gl.h:1545
struct ddraw * ddraw
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 WCHAR desc[]
Definition: protectdata.c:36
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN
Definition: utils.c:923
static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl
Definition: vertexbuffer.c:419
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define ERR(fmt,...)
Definition: debug.h:109
#define D3D_OK
Definition: d3d.h:106
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:79
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration)
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
struct wined3d_vertex_declaration * ddraw_find_decl(struct ddraw *This, DWORD fvf)
Definition: ddraw.c:4781

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 }
struct list light_list
struct ddraw * ddraw
static const struct IDirect3DViewport3Vtbl d3d_viewport_vtbl
Definition: viewport.c:1094
struct ddraw * ddraw
IDirect3DViewport3 IDirect3DViewport3_iface
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

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 {
115  struct ddraw_handle_entry *entry;
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);
125  return DDRAW_INVALID_HANDLE;
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");
143  return DDRAW_INVALID_HANDLE;
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 }
GLdouble GLdouble t
Definition: gl.h:2047
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
unsigned int idx
Definition: utils.c:41
#define DDRAW_INVALID_HANDLE
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t entry
Definition: isohybrid.c:63
#define ERR(fmt,...)
Definition: debug.h:109
int type
Definition: main.c:85
unsigned int UINT
Definition: ndis.h:50
void * object
Definition: jmemsys.h:48

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 {
323  clipper->IDirectDrawClipper_iface.lpVtbl = &ddraw_clipper_vtbl;
324  clipper->ref = 1;
325 
326  return DD_OK;
327 }
#define DD_OK
Definition: ddraw.h:186
static const struct IDirectDrawClipperVtbl ddraw_clipper_vtbl
Definition: clipper.c:308
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 }
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

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 dwCaps2
Definition: ddraw.h:733
DWORD dwCaps
Definition: ddraw.h:727
DWORD dwCaps4
Definition: ddraw.h:737
DWORD dwCaps
Definition: ddraw.h:732
DWORD dwCaps3
Definition: ddraw.h:734

Referenced by ddraw2_GetAvailableVidMem().

◆ ddraw_d3dcaps1_from_7()

void ddraw_d3dcaps1_from_7 ( D3DDEVICEDESC caps1,
D3DDEVICEDESC7 caps7 
)

Definition at line 1192 of file ddraw.c.

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

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  {
975  FE(DDSCL_NORMAL),
981  };
982 
983  if (TRACE_ON(ddraw))
984  {
985  TRACE(" - ");
986  DDRAW_dump_flags(cooplevel, flags, ARRAY_SIZE(flags));
987  }
988 }
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:536
#define DDSCL_ALLOWMODEX
Definition: ddraw.h:537
#define DDSCL_SETDEVICEWINDOW
Definition: ddraw.h:539
#define TRACE(s)
Definition: solgame.cpp:4
#define DDSCL_ALLOWREBOOT
Definition: ddraw.h:533
#define FE(x)
GLbitfield flags
Definition: glext.h:7161
#define DDSCL_SETFOCUSWINDOW
Definition: ddraw.h:538
#define DDSCL_FULLSCREEN
Definition: ddraw.h:532
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DDSCL_NOWINDOWCHANGES
Definition: ddraw.h:534
#define DDSCL_NORMAL
Definition: ddraw.h:535
#define TRACE_ON(x)
Definition: compat.h:65
static void DDRAW_dump_flags(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:707
#define DDSCL_CREATEDEVICEWINDOW
Definition: ddraw.h:540

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),
1005  FE(DDCAPS_OVERLAY),
1009  FE(DDCAPS_PALETTE),
1013  FE(DDCAPS_VBI),
1014  FE(DDCAPS_ZBLTS),
1017  FE(DDCAPS_ALPHA),
1023  FE(DDCAPS_CANCLIP),
1026  };
1027  static const struct flag_info flags2[] =
1028  {
1052  FE(DDCAPS2_STEREO),
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  {
1123  FE(DDPCAPS_4BIT),
1125  FE(DDPCAPS_8BIT),
1130  FE(DDPCAPS_VSYNC),
1131  FE(DDPCAPS_1BIT),
1132  FE(DDPCAPS_2BIT),
1133  FE(DDPCAPS_ALPHA),
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 }
#define DDFXCAPS_BLTALPHA
Definition: ddraw.h:404
#define DDFXCAPS_BLTSHRINKY
Definition: ddraw.h:415
#define DDCAPS2_COPYFOURCC
Definition: ddraw.h:377
#define DDCAPS2_COLORCONTROLPRIMARY
Definition: ddraw.h:369
#define DDCAPS_STEREOVIEW
Definition: ddraw.h:63
#define DDFXALPHACAPS_BLTALPHAPIXELS
Definition: ddraw.h:393
#define DDFXCAPS_OVERLAYSHRINKX
Definition: ddraw.h:422
#define DDPCAPS_INITIALIZE
Definition: ddraw.h:452
#define DDFXCAPS_OVERLAYSHRINKXN
Definition: ddraw.h:423
#define DDCAPS_ALIGNSIZEDEST
Definition: ddraw.h:331
#define DDFXCAPS_OVERLAYSHRINKYN
Definition: ddraw.h:425
#define DDFXCAPS_BLTSHRINKXN
Definition: ddraw.h:414
#define DDCAPS_OVERLAYCANTCLIP
Definition: ddraw.h:341
#define DDCAPS2_NONLOCALVIDMEM
Definition: ddraw.h:371
#define DDFXCAPS_OVERLAYSTRETCHYN
Definition: ddraw.h:429
#define DDCAPS_READSCANLINE
Definition: ddraw.h:346
#define DDPCAPS_4BIT
Definition: ddraw.h:453
#define DDCAPS_ZOVERLAYS
Definition: ddraw.h:350
#define DDPCAPS_2BIT
Definition: ddraw.h:461
#define DDCAPS2_CANDROPZ16BIT
Definition: ddraw.h:370
#define DDCAPS_ZBLTS
Definition: ddraw.h:349
#define DDCAPS2_STEREO
Definition: ddraw.h:385
#define DDFXALPHACAPS_BLTALPHAPIXELSNEG
Definition: ddraw.h:394
#define DDPCAPS_8BIT
Definition: ddraw.h:455
#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG
Definition: ddraw.h:399
#define DDCAPS_PALETTE
Definition: ddraw.h:344
#define DDCAPS2_CANMANAGETEXTURE
Definition: ddraw.h:383
#define DDFXCAPS_BLTSHRINKYN
Definition: ddraw.h:416
#define DDPCAPS_PRIMARYSURFACELEFT
Definition: ddraw.h:457
#define DDCAPS2_CANFLIPODDEVEN
Definition: ddraw.h:375
#define DDPCAPS_PRIMARYSURFACE
Definition: ddraw.h:456
#define DDFXCAPS_OVERLAYSHRINKY
Definition: ddraw.h:424
#define DDCAPS_BLTSTRETCH
Definition: ddraw.h:338
#define DDCAPS2_WIDESURFACES
Definition: ddraw.h:374
#define DDCAPS2_NONLOCALVIDMEMCAPS
Definition: ddraw.h:372
#define DDFXCAPS_OVERLAYMIRRORUPDOWN
Definition: ddraw.h:431
#define DDCAPS_BLTCOLORFILL
Definition: ddraw.h:355
#define DDCAPS_GDI
Definition: ddraw.h:339
#define DDPCAPS_8BITENTRIES
Definition: ddraw.h:454
#define DDCKEYCAPS_SRCBLTCLRSPACEYUV
Definition: ddraw.h:492
#define DDCAPS_OVERLAYFOURCC
Definition: ddraw.h:342
#define DDFXCAPS_BLTROTATION90
Definition: ddraw.h:412
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
Definition: utils.c:713
#define DDPCAPS_ALLOW256
Definition: ddraw.h:458
#define DDCAPS_BANKSWITCHED
Definition: ddraw.h:356
#define DDCAPS_BLTFOURCC
Definition: ddraw.h:337
#define DDCAPS2_VIDEOPORT
Definition: ddraw.h:364
#define DDCAPS_CANCLIPSTRETCHED
Definition: ddraw.h:359
#define DDFXCAPS_BLTARITHSTRETCHY
Definition: ddraw.h:407
#define DDCAPS2_PRIMARYGAMMA
Definition: ddraw.h:378
#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT
Definition: ddraw.h:430
#define DDCAPS_CANCLIP
Definition: ddraw.h:358
#define DDCKEYCAPS_DESTBLT
Definition: ddraw.h:481
#define DDSVCAPS_RESERVED3
Definition: ddraw.h:439
#define DDFXALPHACAPS_BLTALPHAEDGEBLEND
Definition: ddraw.h:392
#define DDCAPS_OVERLAYSTRETCH
Definition: ddraw.h:343
#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG
Definition: ddraw.h:401
#define DDCAPS_ALIGNBOUNDARYSRC
Definition: ddraw.h:332
#define DDFXALPHACAPS_BLTALPHASURFACESNEG
Definition: ddraw.h:396
#define DDCAPS_ALIGNSTRIDE
Definition: ddraw.h:334
#define DDCKEYCAPS_NOCOSTOVERLAY
Definition: ddraw.h:499
#define DDFXCAPS_OVERLAYARITHSTRETCHY
Definition: ddraw.h:421
#define DDCAPS_BLT
Definition: ddraw.h:335
#define DDCAPS_BLTDEPTHFILL
Definition: ddraw.h:357
#define DDCKEYCAPS_SRCOVERLAY
Definition: ddraw.h:494
#define DDSVCAPS_RESERVED2
Definition: ddraw.h:438
#define DDCAPS2_CANBOBINTERLEAVED
Definition: ddraw.h:366
#define DDCKEYCAPS_DESTOVERLAYCLRSPACE
Definition: ddraw.h:486
#define DDCAPS2_FLIPINTERVAL
Definition: ddraw.h:381
#define DDCKEYCAPS_SRCOVERLAYYUV
Definition: ddraw.h:498
#define DDFXALPHACAPS_OVERLAYALPHAPIXELS
Definition: ddraw.h:398
#define DDFXCAPS_BLTROTATION
Definition: ddraw.h:411
#define DDCKEYCAPS_SRCBLTYUV
Definition: ddraw.h:493
#define DDFXCAPS_BLTARITHSTRETCHYN
Definition: ddraw.h:408
#define DDCAPS2_CANRENDERWINDOWED
Definition: ddraw.h:379
#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV
Definition: ddraw.h:496
#define DDCKEYCAPS_DESTBLTYUV
Definition: ddraw.h:484
#define TRACE(s)
Definition: solgame.cpp:4
#define DDCAPS_ALIGNSIZESRC
Definition: ddraw.h:333
#define DDCAPS_ALIGNBOUNDARYDEST
Definition: ddraw.h:330
#define DDSVCAPS_RESERVED4
Definition: ddraw.h:440
#define DDSVCAPS_STEREOSEQUENTIAL
Definition: ddraw.h:450
#define DDPCAPS_VSYNC
Definition: ddraw.h:459
#define DDCAPS_BLTQUEUE
Definition: ddraw.h:336
#define FE(x)
#define DDCAPS2_TEXMANINNONLOCALVIDMEM
Definition: ddraw.h:384
#define DDFXCAPS_BLTSTRETCHXN
Definition: ddraw.h:418
#define DDCAPS_NOHARDWARE
Definition: ddraw.h:354
#define DDCKEYCAPS_DESTBLTCLRSPACEYUV
Definition: ddraw.h:483
#define DDCAPS_COLORKEY
Definition: ddraw.h:351
#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL
Definition: ddraw.h:386
#define DDFXCAPS_BLTSTRETCHX
Definition: ddraw.h:417
#define DDCAPS_COLORKEYHWASSIST
Definition: ddraw.h:353
#define DDFXCAPS_BLTSHRINKX
Definition: ddraw.h:413
#define DDFXCAPS_OVERLAYSTRETCHX
Definition: ddraw.h:426
#define DDCAPS2_AUTOFLIPOVERLAY
Definition: ddraw.h:365
#define DDCKEYCAPS_DESTOVERLAY
Definition: ddraw.h:485
#define DDFXCAPS_OVERLAYSTRETCHXN
Definition: ddraw.h:427
#define DDCAPS_CANBLTSYSMEM
Definition: ddraw.h:360
#define DDFXALPHACAPS_OVERLAYALPHASURFACES
Definition: ddraw.h:400
#define DDFXCAPS_OVERLAYALPHA
Definition: ddraw.h:405
#define DDFXCAPS_OVERLAYSTRETCHY
Definition: ddraw.h:428
#define DDCAPS2_NO2DDURING3DSCENE
Definition: ddraw.h:363
#define DDCAPS_OVERLAY
Definition: ddraw.h:340
#define DDPCAPS_1BIT
Definition: ddraw.h:460
#define DDCAPS_3D
Definition: ddraw.h:329
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DDFXCAPS_OVERLAYARITHSTRETCHYN
Definition: ddraw.h:406
#define DDFXCAPS_BLTSTRETCHYN
Definition: ddraw.h:420
#define DDCKEYCAPS_SRCBLTCLRSPACE
Definition: ddraw.h:491
#define DDCKEYCAPS_DESTOVERLAYYUV
Definition: ddraw.h:489
#define DDCAPS_VBI
Definition: ddraw.h:348
#define DDCAPS2_CANCALIBRATEGAMMA
Definition: ddraw.h:380
#define DDPCAPS_ALPHA
Definition: ddraw.h:462
#define DDCKEYCAPS_DESTOVERLAYONEACTIVE
Definition: ddraw.h:488
#define DDCAPS2_CANBOBHARDWARE
Definition: ddraw.h:376
#define DDFXCAPS_BLTMIRRORUPDOWN
Definition: ddraw.h:410
#define DDSVCAPS_RESERVED1
Definition: ddraw.h:437
#define DDFXCAPS_BLTMIRRORLEFTRIGHT
Definition: ddraw.h:409
#define DDCKEYCAPS_SRCOVERLAYCLRSPACE
Definition: ddraw.h:495
#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV
Definition: ddraw.h:487
#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND
Definition: ddraw.h:397
#define DDCAPS2_CANBOBNONINTERLEAVED
Definition: ddraw.h:367
#define DDFXCAPS_BLTSTRETCHY
Definition: ddraw.h:419
#define DDCKEYCAPS_SRCOVERLAYONEACTIVE
Definition: ddraw.h:497
#define DDCAPS2_FLIPNOVSYNC
Definition: ddraw.h:382
#define DDCAPS_PALETTEVSYNC
Definition: ddraw.h:345
#define DDCAPS2_COLORCONTROLOVERLAY
Definition: ddraw.h:368
#define DDCAPS2_CERTIFIED
Definition: ddraw.h:362
#define DDCAPS2_NOPAGELOCKREQUIRED
Definition: ddraw.h:373
#define DDFXALPHACAPS_BLTALPHASURFACES
Definition: ddraw.h:395
#define DDCKEYCAPS_SRCBLT
Definition: ddraw.h:490
#define DDCAPS_ALPHA
Definition: ddraw.h:352
#define DDCKEYCAPS_DESTBLTCLRSPACE
Definition: ddraw.h:482
static void DDRAW_dump_flags(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:707

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

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  {
887  ME(DDSD_CAPS, DDRAW_dump_DDSCAPS, ddsCaps)
888  };
889  static const struct member_info members_caps2[] =
890  {
891  ME(DDSD_CAPS, DDRAW_dump_DDSCAPS2, ddsCaps)
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 DDSD_CKDESTOVERLAY
Definition: ddraw.h:217
GLdouble GLdouble u2
Definition: glext.h:8308
DWORD dwFlags
Definition: ddraw.h:1153
#define DDSD_LPSURFACE
Definition: ddrawex.h:22
#define DDSD_CKSRCBLT
Definition: ddraw.h:220
GLdouble u1
Definition: glext.h:8308
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
Definition: utils.c:713
#define DDSD_BACKBUFFERCOUNT
Definition: ddraw.h:212
#define DDSD_CAPS
Definition: ddraw.h:208
smooth NULL
Definition: ftsmooth.c:416
static void DDRAW_dump_PTR(const void *in)
Definition: utils.c:687
#define DDSD_CKSRCOVERLAY
Definition: ddraw.h:219
static const WCHAR dwHeight[]
Definition: provider.c:63
#define DDSD_CKDESTBLT
Definition: ddraw.h:218
#define DDSD_ALPHABITDEPTH
Definition: ddraw.h:214
#define DDSD_HEIGHT
Definition: ddraw.h:209
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwSize
Definition: ddraw.h:1152
static BYTE u4[]
Definition: msg.c:588
static void DDRAW_dump_members(DWORD flags, const void *data, const struct member_info *mems, size_t num_mems)
Definition: utils.c:812
static BYTE u5[]
Definition: msg.c:590
static void DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf)
Definition: utils.c:827
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSD_ZBUFFERBITDEPTH
Definition: ddraw.h:213
#define DDSD_PIXELFORMAT
Definition: ddraw.h:216
#define DDSD_MIPMAPCOUNT
Definition: ddraw.h:221
#define DDSD_REFRESHRATE
Definition: ddraw.h:222
DWORD dwAlphaBitDepth
Definition: ddraw.h:1076
#define ARRAY_SIZE(a)
Definition: main.h:24
static BYTE u3[]
Definition: msg.c:580
#define DDSD_LINEARSIZE
Definition: ddraw.h:223
#define ME(x, f, e)
static void DDRAW_dump_DWORD(const void *in)
Definition: utils.c:682
static const WCHAR dwWidth[]
Definition: provider.c:62
static void DDRAW_dump_DDSCAPS(const DDSCAPS *in)
Definition: utils.c:776
#define DDSD_PITCH
Definition: ddraw.h:211
static void DDRAW_dump_DDCOLORKEY(const DDCOLORKEY *ddck)
Definition: utils.c:692

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 4781 of file ddraw.c.

4782 {
4783  struct wined3d_vertex_declaration *pDecl = NULL;
4784  HRESULT hr;
4785  int p, low, high; /* deliberately signed */
4786  struct FvfToDecl *convertedDecls = This->decls;
4787 
4788  TRACE("Searching for declaration for fvf %08x... ", fvf);
4789 
4790  low = 0;
4791  high = This->numConvertedDecls - 1;
4792  while(low <= high) {
4793  p = (low + high) >> 1;
4794  TRACE("%d ", p);
4795  if(convertedDecls[p].fvf == fvf) {
4796  TRACE("found %p\n", convertedDecls[p].decl);
4797  return convertedDecls[p].decl;
4798  } else if(convertedDecls[p].fvf < fvf) {
4799  low = p + 1;
4800  } else {
4801  high = p - 1;
4802  }
4803  }
4804  TRACE("not found. Creating and inserting at position %d.\n", low);
4805 
4808  if (hr != S_OK) return NULL;
4809 
4810  if (This->declArraySize == This->numConvertedDecls)
4811  {
4812  unsigned int grow = max(This->declArraySize / 2, 8);
4813 
4814  if (!(convertedDecls = heap_realloc(convertedDecls,
4815  (This->numConvertedDecls + grow) * sizeof(*convertedDecls))))
4816  {
4818  return NULL;
4819  }
4820  This->decls = convertedDecls;
4821  This->declArraySize += grow;
4822  }
4823 
4824  memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low));
4825  convertedDecls[low].decl = pDecl;
4826  convertedDecls[low].fvf = fvf;
4827  This->numConvertedDecls++;
4828 
4829  TRACE("Returning %p. %d decls in array\n", pDecl, This->numConvertedDecls);
4830  return pDecl;
4831 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define max(a, b)
Definition: svc.c:63
HRESULT hr
Definition: shlfolder.c:183
struct wined3d_vertex_declaration * decl
Definition: ddraw_private.h:51
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
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)
smooth NULL
Definition: ftsmooth.c:416
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
Definition: ddraw.c:83
GLfloat GLfloat p
Definition: glext.h:8902
DWORD fvf
Definition: d3d8_private.h:87

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 {
158  struct ddraw_handle_entry *entry;
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 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define WARN(fmt,...)
Definition: debug.h:111
GLdouble GLdouble t
Definition: gl.h:2047
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
#define DDRAW_INVALID_HANDLE
uint32_t entry
Definition: isohybrid.c:63
void * object
Definition: jmemsys.h:48

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

◆ ddraw_get_d3dcaps()

HRESULT ddraw_get_d3dcaps ( const struct ddraw ddraw,
D3DDEVICEDESC7 caps 
)

Definition at line 1248 of file ddraw.c.

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

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 {
184  struct ddraw_handle_entry *entry;
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 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define WARN(fmt,...)
Definition: debug.h:111
GLdouble GLdouble t
Definition: gl.h:2047
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
#define DDRAW_INVALID_HANDLE
uint32_t entry
Definition: isohybrid.c:63

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 }
GLdouble GLdouble t
Definition: gl.h:2047
#define memset(x, y, z)
Definition: compat.h:39
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 }
#define TRUE
Definition: types.h:120
GLdouble GLdouble t
Definition: gl.h:2047
smooth NULL
Definition: ftsmooth.c:416
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by d3d_device_init().

◆ ddraw_init()

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

Definition at line 5032 of file ddraw.c.

5033 {
5034  WINED3DCAPS caps;
5035  HRESULT hr;
5036 
5038  ddraw->IDirectDraw_iface.lpVtbl = &ddraw1_vtbl;
5041  ddraw->IDirect3D_iface.lpVtbl = &d3d1_vtbl;
5042  ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl;
5043  ddraw->IDirect3D3_iface.lpVtbl = &d3d3_vtbl;
5044  ddraw->IDirect3D7_iface.lpVtbl = &d3d7_vtbl;
5046  ddraw->numIfaces = 1;
5047  ddraw->ref7 = 1;
5048 
5050  if (!(ddraw->wined3d = wined3d_create(flags)))
5051  {
5052  flags |= WINED3D_NO3D;
5053  if (!(ddraw->wined3d = wined3d_create(flags)))
5054  {
5055  WARN("Failed to create a wined3d object.\n");
5056  return E_FAIL;
5057  }
5058  }
5059 
5061  {
5062  ERR("Failed to get device caps, hr %#x.\n", hr);
5064  return E_FAIL;
5065  }
5066 
5067  if (!(caps.ddraw_caps.caps & WINEDDCAPS_3D))
5068  {
5069  WARN("Created a wined3d object without 3D support.\n");
5070  ddraw->flags |= DDRAW_NO3D;
5071  }
5072 
5075  {
5076  WARN("Failed to create a wined3d device, hr %#x.\n", hr);
5078  return hr;
5079  }
5080 
5082 
5083  return DD_OK;
5084 }
static const struct IDirect3DVtbl d3d1_vtbl
Definition: ddraw.c:4747
static const struct IDirect3D7Vtbl d3d7_vtbl
Definition: ddraw.c:4700
static const struct IDirect3D2Vtbl d3d2_vtbl
Definition: ddraw.c:4732
HRESULT hr
Definition: shlfolder.c:183
static const struct IDirectDraw7Vtbl ddraw7_vtbl
Definition: ddraw.c:4563
struct wined3d * wined3d
Definition: ddraw_private.h:92
#define WARN(fmt,...)
Definition: debug.h:111
device_type
IDirect3D7 IDirect3D7_iface
Definition: ddraw_private.h:83
IDirectDraw2 IDirectDraw2_iface
Definition: ddraw_private.h:81
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
#define DDRAW_STRIDE_ALIGNMENT
Definition: ddraw_private.h:62
#define E_FAIL
Definition: ddrawi.h:102
IDirect3D2 IDirect3D2_iface
Definition: ddraw_private.h:85
static const struct IDirectDraw2Vtbl ddraw2_vtbl
Definition: ddraw.c:4640
struct wined3d *CDECL wined3d_create(DWORD flags)
Definition: wined3d_main.c:97
struct wined3d_ddraw_caps ddraw_caps
Definition: wined3d.h:1973
#define DD_OK
Definition: ddraw.h:186
smooth NULL
Definition: ftsmooth.c:416
IDirectDraw IDirectDraw_iface
Definition: ddraw_private.h:82
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
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
Definition: directx.c:465
LONG HRESULT
Definition: typedefs.h:77
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops
Definition: ddraw.c:5021
struct wined3d_device_parent device_parent
Definition: ddraw_private.h:87
GLbitfield flags
Definition: glext.h:7161
#define WINEDDCAPS_3D
Definition: wined3d.h:1495
struct list surface_list
#define WINED3DADAPTER_DEFAULT
Definition: wined3d.h:857
static const struct IDirect3D3Vtbl d3d3_vtbl
Definition: ddraw.c:4714
IDirectDraw4 IDirectDraw4_iface
Definition: ddraw_private.h:80
#define DDRAW_WINED3D_FLAGS
Definition: ddraw_private.h:64
LONG numIfaces
Definition: ddraw_private.h:90
#define ERR(fmt,...)
Definition: debug.h:109
DWORD flags
Definition: ddraw_private.h:94
static struct IDirectDrawVtbl ddraw1_vtbl
Definition: ddraw.c:4671
IDirect3D IDirect3D_iface
Definition: ddraw_private.h:86
#define DDRAW_NO3D
Definition: ddraw_private.h:57
LONG ref7
Definition: ddraw_private.h:90
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
IDirect3D3 IDirect3D3_iface
Definition: ddraw_private.h:84
struct wined3d_device * wined3d_device
Definition: ddraw_private.h:93
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:79
static const struct IDirectDraw4Vtbl ddraw4_vtbl
Definition: ddraw.c:4603
#define WINED3D_NO3D
Definition: wined3d.h:1316

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;
273  if (flags & DDPCAPS_ALLOW256)
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 }
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
#define WINED3D_PALETTE_ALPHA
Definition: wined3d.h:1556
#define WINED3D_PALETTE_8BIT_ENTRIES
Definition: wined3d.h:1554
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
#define DDPCAPS_8BITENTRIES
Definition: ddraw.h:454
#define DDPCAPS_ALLOW256
Definition: ddraw.h:458
#define DD_OK
Definition: ddraw.h:186
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
static unsigned int palette_size(DWORD flags)
Definition: palette.c:241
static const struct IDirectDrawPaletteVtbl ddraw_palette_vtbl
Definition: palette.c:221
static HPALETTE palette
Definition: clipboard.c:1345
#define DDPCAPS_ALPHA
Definition: ddraw.h:462
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
struct wined3d_device * wined3d_device
Definition: ddraw_private.h:93
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:79
#define WINED3D_PALETTE_ALLOW_256
Definition: wined3d.h:1555
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79

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 }
HWND swapchain_window
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
static IHTMLWindow2 * window
Definition: events.c:77

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;
5798  struct wined3d_display_mode mode;
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");
5835  heap_free(texture);
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");
5842  heap_free(texture);
5843  return DDERR_INVALIDCAPS;
5844  }
5845 
5846  if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
5847  {
5848  WARN("Tried to create a flippable cubemap.\n");
5849  heap_free(texture);
5850  return DDERR_INVALIDPARAMS;
5851  }
5852 
5853  if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
5854  {
5855  FIXME("Flippable textures not implemented.\n");
5856  heap_free(texture);
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");
5866  heap_free(texture);
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");
5876  heap_free(texture);
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");
5883  heap_free(texture);
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");
5890  heap_free(texture);
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");
5900  heap_free(texture);
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);
5908  heap_free(texture);
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");
5916  heap_free(texture);
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");
5924  heap_free(texture);
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");
5937  heap_free(texture);
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");
5944  heap_free(texture);
5945  return DDERR_INVALIDCAPS;
5946  }
5947  }
5948 
5950  {
5951  ERR("Failed to get display mode, hr %#x.\n", hr);
5952  heap_free(texture);
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");
5969  heap_free(texture);
5970  return DDERR_INVALIDPIXELFORMAT;
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");
5979  heap_free(texture);
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  {
5990  heap_free(texture);
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");
6015  heap_free(texture);
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  {
6049  heap_free(texture);
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");
6110  heap_free(texture);
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) &&