ReactOS 0.4.17-dev-1037-g720d112
ddraw_private.h File Reference
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include "wine/debug.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 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_SWAPPED   0x00000040
 
#define DDRAW_STRIDE_ALIGNMENT   8
 
#define DDRAW_WINED3D_FLAGS
 
#define DDRAW_WINED3D_SWAPCHAIN_FLAGS
 
#define DDRAW_MAX_ACTIVE_LIGHTS   32
 
#define DDRAW_MAX_TEXTURES   8
 
#define DDRAW_WINDOW_CLASS_NAME   "DirectDrawDeviceWnd"
 
#define DDRAW_SURFACE_LOCATION_DEFAULT   0x00000001
 
#define DDRAW_SURFACE_LOCATION_DRAW   0x00000002
 
#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 DDRAW_SURFACE_READ   0x00000001
 
#define DDRAW_SURFACE_WRITE   0x00000002
 
#define DDRAW_SURFACE_RW   (DDRAW_SURFACE_READ | DDRAW_SURFACE_WRITE)
 
#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
}
 
enum  ddraw_viewport_version { DDRAW_VIEWPORT_VERSION_NONE , DDRAW_VIEWPORT_VERSION_1 , DDRAW_VIEWPORT_VERSION_2 }
 

Functions

HRESULT ddraw_init (struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type)
 
void ddraw_d3dcaps1_from_7 (D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7)
 
HRESULT ddraw_get_d3dcaps (const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
 
void ddraw_update_lost_surfaces (struct ddraw *ddraw)
 
static void ddraw_set_swapchain_window (struct ddraw *ddraw, HWND window)
 
void DDRAW_Convert_DDSCAPS_1_To_2 (const DDSCAPS *pIn, DDSCAPS2 *pOut)
 
void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1 (const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut)
 
struct wined3d_vertex_declaration * ddraw_find_decl (struct ddraw *ddraw, DWORD fvf)
 
HRESULT ddraw_surface_create (struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version)
 
struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view (struct ddraw_surface *surface)
 
HRESULT ddraw_surface_update_frontbuffer (struct ddraw_surface *surface, const RECT *rect, BOOL read, unsigned int swap_interval)
 
static struct ddraw_surface * impl_from_IDirect3DTexture (IDirect3DTexture *iface)
 
static struct ddraw_surface * impl_from_IDirect3DTexture2 (IDirect3DTexture2 *iface)
 
static struct ddraw_surface * impl_from_IDirectDrawSurface (IDirectDrawSurface *iface)
 
static struct ddraw_surface * impl_from_IDirectDrawSurface2 (IDirectDrawSurface2 *iface)
 
static struct ddraw_surface * impl_from_IDirectDrawSurface3 (IDirectDrawSurface3 *iface)
 
static struct ddraw_surface * impl_from_IDirectDrawSurface4 (IDirectDrawSurface4 *iface)
 
static struct ddraw_surface * impl_from_IDirectDrawSurface7 (IDirectDrawSurface7 *iface)
 
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface (IDirectDrawSurface *iface)
 
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface4 (IDirectDrawSurface4 *iface)
 
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface7 (IDirectDrawSurface7 *iface)
 
struct ddraw_surface * unsafe_impl_from_IDirect3DTexture (IDirect3DTexture *iface)
 
struct ddraw_surface * unsafe_impl_from_IDirect3DTexture2 (IDirect3DTexture2 *iface)
 
BOOL ddraw_handle_table_init (struct ddraw_handle_table *t, UINT initial_size)
 
void ddraw_handle_table_destroy (struct ddraw_handle_table *t)
 
DWORD ddraw_allocate_handle (struct ddraw_handle_table *t, void *object, enum ddraw_handle_type type)
 
void * ddraw_free_handle (struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
 
void * ddraw_get_object (struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
 
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)
 
enum wined3d_depth_buffer_type d3d_device_update_depth_stencil (struct d3d_device *device)
 
static struct d3d_device * impl_from_IDirect3DDevice (IDirect3DDevice *iface)
 
static struct d3d_device * impl_from_IDirect3DDevice2 (IDirect3DDevice2 *iface)
 
static struct d3d_device * impl_from_IDirect3DDevice3 (IDirect3DDevice3 *iface)
 
static struct d3d_device * impl_from_IDirect3DDevice7 (IDirect3DDevice7 *iface)
 
struct d3d_device * unsafe_impl_from_IDirect3DDevice (IDirect3DDevice *iface)
 
struct d3d_device * unsafe_impl_from_IDirect3DDevice2 (IDirect3DDevice2 *iface)
 
struct d3d_device * unsafe_impl_from_IDirect3DDevice3 (IDirect3DDevice3 *iface)
 
struct d3d_device * unsafe_impl_from_IDirect3DDevice7 (IDirect3DDevice7 *iface)
 
HRESULT ddraw_clipper_init (struct ddraw_clipper *clipper)
 
struct ddraw_clipper * unsafe_impl_from_IDirectDrawClipper (IDirectDrawClipper *iface)
 
BOOL ddraw_clipper_is_valid (const struct ddraw_clipper *clipper)
 
static struct ddraw_palette * impl_from_IDirectDrawPalette (IDirectDrawPalette *iface)
 
struct ddraw_palette * unsafe_impl_from_IDirectDrawPalette (IDirectDrawPalette *iface)
 
HRESULT ddraw_palette_init (struct ddraw_palette *palette, struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries)
 
void light_activate (struct d3d_light *light)
 
void light_deactivate (struct d3d_light *light)
 
void d3d_light_init (struct d3d_light *light, struct ddraw *ddraw)
 
struct d3d_light * unsafe_impl_from_IDirect3DLight (IDirect3DLight *iface)
 
void material_activate (struct d3d_material *material)
 
struct d3d_material * d3d_material_create (struct ddraw *ddraw)
 
struct d3d_viewport * unsafe_impl_from_IDirect3DViewport3 (IDirect3DViewport3 *iface)
 
struct d3d_viewport * unsafe_impl_from_IDirect3DViewport2 (IDirect3DViewport2 *iface)
 
struct d3d_viewport * unsafe_impl_from_IDirect3DViewport (IDirect3DViewport *iface)
 
void viewport_activate (struct d3d_viewport *viewport, BOOL ignore_lights)
 
void viewport_deactivate (struct d3d_viewport *viewport)
 
void d3d_viewport_init (struct d3d_viewport *viewport, struct ddraw *ddraw)
 
HRESULT d3d_execute_buffer_init (struct d3d_execute_buffer *execute_buffer, struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc)
 
struct d3d_execute_buffer * unsafe_impl_from_IDirect3DExecuteBuffer (IDirect3DExecuteBuffer *iface)
 
HRESULT d3d_execute_buffer_execute (struct d3d_execute_buffer *execute_buffer, struct d3d_device *device)
 
HRESULT d3d_vertex_buffer_create (struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc)
 
struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer (IDirect3DVertexBuffer *iface)
 
struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer7 (IDirect3DVertexBuffer7 *iface)
 
void ddrawformat_from_wined3dformat (DDPIXELFORMAT *ddraw_format, enum wined3d_format_id wined3d_format)
 
BOOL wined3d_colour_from_ddraw_colour (const DDPIXELFORMAT *pf, const struct ddraw_palette *palette, DWORD colour, struct wined3d_color *wined3d_colour)
 
enum wined3d_format_id wined3dformat_from_ddrawformat (const DDPIXELFORMAT *format)
 
unsigned int wined3dmapflags_from_ddrawmapflags (unsigned int flags)
 
void DDRAW_dump_surface_desc (const DDSURFACEDESC2 *lpddsd)
 
void dump_D3DMATRIX (const D3DMATRIX *mat)
 
void DDRAW_dump_DDCAPS (const DDCAPS *lpcaps)
 
DWORD get_flexible_vertex_size (DWORD d3dvtVertexType)
 
void DDRAW_dump_DDSCAPS2 (const DDSCAPS2 *in)
 
void DDRAW_dump_cooperativelevel (DWORD cooplevel)
 
void DDSD_to_DDSD2 (const DDSURFACEDESC *in, DDSURFACEDESC2 *out)
 
void DDSD2_to_DDSD (const DDSURFACEDESC2 *in, DDSURFACEDESC *out)
 
void multiply_matrix (struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
 
static BOOL format_is_compressed (const DDPIXELFORMAT *format)
 
static BOOL format_is_paletteindexed (const DDPIXELFORMAT *fmt)
 
static BOOL ddraw_surface_can_be_lost (const struct ddraw_surface *surface)
 
static struct wined3d_texture * ddraw_surface_get_default_texture (struct ddraw_surface *surface, unsigned int flags)
 
static struct wined3d_texture * ddraw_surface_get_draw_texture (struct ddraw_surface *surface, unsigned int flags)
 
static struct wined3d_texture * ddraw_surface_get_any_texture (struct ddraw_surface *surface, unsigned int flags)
 
void d3d_device_sync_surfaces (struct d3d_device *device)
 
void d3d_device_apply_state (struct d3d_device *device, BOOL clear_state)
 
HRESULT hr_ddraw_from_wined3d (HRESULT hr)
 
void viewport_alloc_active_light_index (struct d3d_light *light)
 
void viewport_free_active_light_index (struct d3d_light *light)
 

Variables

const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
 
DWORD force_refresh_rate
 
struct ddraw_handle_table global_handle_table
 
const GUID IID_D3DDEVICE_WineD3D
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 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 748 of file ddraw_private.h.

◆ DD_STRUCT_COPY_BYSIZE_

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

Definition at line 737 of file ddraw_private.h.

◆ DDRAW_D3D_INITIALIZED

#define DDRAW_D3D_INITIALIZED   0x00000002

Definition at line 54 of file ddraw_private.h.

◆ DDRAW_INITIALIZED

#define DDRAW_INITIALIZED   0x00000001

Definition at line 53 of file ddraw_private.h.

◆ DDRAW_INVALID_HANDLE

#define DDRAW_INVALID_HANDLE   ~0U

Definition at line 282 of file ddraw_private.h.

◆ DDRAW_MAX_ACTIVE_LIGHTS

#define DDRAW_MAX_ACTIVE_LIGHTS   32

Definition at line 70 of file ddraw_private.h.

◆ DDRAW_MAX_TEXTURES

#define DDRAW_MAX_TEXTURES   8

Definition at line 71 of file ddraw_private.h.

◆ DDRAW_NO3D

#define DDRAW_NO3D   0x00000008

Definition at line 56 of file ddraw_private.h.

◆ DDRAW_RESTORE_MODE

#define DDRAW_RESTORE_MODE   0x00000004

Definition at line 55 of file ddraw_private.h.

◆ DDRAW_SCL_DDRAW1

#define DDRAW_SCL_DDRAW1   0x00000010

Definition at line 57 of file ddraw_private.h.

◆ DDRAW_SCL_RECURSIVE

#define DDRAW_SCL_RECURSIVE   0x00000020

Definition at line 58 of file ddraw_private.h.

◆ DDRAW_STRIDE_ALIGNMENT

#define DDRAW_STRIDE_ALIGNMENT   8

Definition at line 61 of file ddraw_private.h.

◆ DDRAW_SURFACE_LOCATION_DEFAULT

#define DDRAW_SURFACE_LOCATION_DEFAULT   0x00000001

Definition at line 159 of file ddraw_private.h.

◆ DDRAW_SURFACE_LOCATION_DRAW

#define DDRAW_SURFACE_LOCATION_DRAW   0x00000002

Definition at line 160 of file ddraw_private.h.

◆ DDRAW_SURFACE_READ

#define DDRAW_SURFACE_READ   0x00000001

Definition at line 663 of file ddraw_private.h.

◆ DDRAW_SURFACE_RW

#define DDRAW_SURFACE_RW   (DDRAW_SURFACE_READ | DDRAW_SURFACE_WRITE)

Definition at line 665 of file ddraw_private.h.

◆ DDRAW_SURFACE_WRITE

#define DDRAW_SURFACE_WRITE   0x00000002

Definition at line 664 of file ddraw_private.h.

◆ DDRAW_SWAPPED

#define DDRAW_SWAPPED   0x00000040

Definition at line 59 of file ddraw_private.h.

◆ DDRAW_WINDOW_CLASS_NAME

#define DDRAW_WINDOW_CLASS_NAME   "DirectDrawDeviceWnd"

Definition at line 140 of file ddraw_private.h.

◆ DDRAW_WINED3D_FLAGS

#define DDRAW_WINED3D_FLAGS
Value:
#define WINED3D_RESTORE_MODE_ON_ACTIVATE
Definition: wined3d.h:1325
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1331
#define WINED3D_NO_PRIMITIVE_RESTART
Definition: wined3d.h:1332
#define WINED3D_LEGACY_DEPTH_BIAS
Definition: wined3d.h:1322
#define WINED3D_NO_DRAW_INDIRECT
Definition: wined3d.h:1335
#define WINED3D_FOCUS_MESSAGES
Definition: wined3d.h:1326
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1328
#define WINED3D_LEGACY_CUBEMAP_FILTERING
Definition: wined3d.h:1333

Definition at line 63 of file ddraw_private.h.

◆ DDRAW_WINED3D_SWAPCHAIN_FLAGS

#define DDRAW_WINED3D_SWAPCHAIN_FLAGS
Value:
#define WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
Definition: wined3d.h:897
#define WINED3D_SWAPCHAIN_IMPLICIT
Definition: wined3d.h:901
#define WINED3D_SWAPCHAIN_REGISTER_TOPMOST_TIMER
Definition: wined3d.h:905

Definition at line 67 of file ddraw_private.h.

◆ FE

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

Definition at line 724 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 615 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 612 of file ddraw_private.h.

◆ MAX_COMPLEX_ATTACHED

#define MAX_COMPLEX_ATTACHED   6

Definition at line 200 of file ddraw_private.h.

◆ ME

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

Definition at line 735 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 73 of file ddraw_private.h.

74{
78};
@ DDRAW_DEVICE_STATE_LOST
Definition: ddraw_private.h:76
@ DDRAW_DEVICE_STATE_NOT_RESTORED
Definition: ddraw_private.h:77
@ DDRAW_DEVICE_STATE_OK
Definition: ddraw_private.h:75

◆ ddraw_handle_type

Enumerator
DDRAW_HANDLE_FREE 
DDRAW_HANDLE_MATERIAL 
DDRAW_HANDLE_MATRIX 
DDRAW_HANDLE_STATEBLOCK 
DDRAW_HANDLE_SURFACE 

Definition at line 284 of file ddraw_private.h.

285{
291};
@ DDRAW_HANDLE_STATEBLOCK
@ DDRAW_HANDLE_SURFACE
@ DDRAW_HANDLE_MATRIX
@ DDRAW_HANDLE_MATERIAL
@ DDRAW_HANDLE_FREE

◆ ddraw_viewport_version

Enumerator
DDRAW_VIEWPORT_VERSION_NONE 
DDRAW_VIEWPORT_VERSION_1 
DDRAW_VIEWPORT_VERSION_2 

Definition at line 501 of file ddraw_private.h.

502{
506};
@ DDRAW_VIEWPORT_VERSION_1
@ DDRAW_VIEWPORT_VERSION_NONE
@ DDRAW_VIEWPORT_VERSION_2

Function Documentation

◆ d3d_device_apply_state()

void d3d_device_apply_state ( struct d3d_device *  device,
BOOL  clear_state 
)

Definition at line 3454 of file device.c.

3455{
3456 if (device->ddraw && device->ddraw->device_last_applied_state != device)
3457 {
3459 device->ddraw->device_last_applied_state = device;
3460 }
3461 if (clear_state)
3462 wined3d_stateblock_apply_clear_state(device->state, device->wined3d_device);
3463 else
3464 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
3466}
void d3d_device_sync_surfaces(struct d3d_device *device)
Definition: device.c:3427
Definition: devices.h:37
void CDECL wined3d_stateblock_primary_dirtify_all_states(struct wined3d_device *device, struct wined3d_stateblock *stateblock)
Definition: stateblock.c:313
void CDECL wined3d_stateblock_apply_clear_state(struct wined3d_stateblock *stateblock, struct wined3d_device *device)
Definition: stateblock.c:2917
void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wined3d_stateblock *stateblock)
Definition: stateblock.c:3038

Referenced by d3d_device7_Clear(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), and d3d_device7_DrawPrimitiveVB().

◆ 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 6959 of file device.c.

6961{
6962 struct d3d_device *object;
6963 HRESULT hr;
6964
6965 TRACE("ddraw %p, guid %s, target %p, version %u, device %p, outer_unknown %p.\n",
6967
6968 if (!(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
6969 || (target->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
6970 {
6971 WARN("Surface %p is not a render target.\n", target);
6972 return DDERR_INVALIDCAPS;
6973 }
6974
6976 {
6977 WARN("Surface %p has an indexed pixel format, but no palette.\n", target);
6979 }
6980
6981 if (ddraw->flags & DDRAW_NO3D)
6982 {
6983 ERR_(winediag)("The application wants to create a Direct3D device, "
6984 "but the current DirectDrawRenderer does not support this.\n");
6985
6986 return DDERR_OUTOFMEMORY;
6987 }
6988
6989 if (!(object = calloc(1, sizeof(*object))))
6990 {
6991 ERR("Failed to allocate device memory.\n");
6992 return DDERR_OUTOFMEMORY;
6993 }
6994
6996 {
6997 WARN("Failed to initialize device, hr %#lx.\n", hr);
6998 free(object);
6999 return hr;
7000 }
7001
7002 TRACE("Created device %p.\n", object);
7003 *device = object;
7004
7005 return D3D_OK;
7006}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define D3D_OK
Definition: d3d.h:106
#define DDRAW_NO3D
Definition: ddraw_private.h:56
#define free
Definition: debug_ros.c:5
HRESULT hr
Definition: delayimp.cpp:582
static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, const GUID *guid, struct ddraw_surface *target, IUnknown *rt_iface, UINT version, IUnknown *outer_unknown)
Definition: device.c:6858
static BOOL validate_surface_palette(struct ddraw_surface *surface)
Definition: device.c:1830
static const WCHAR version[]
Definition: asmname.c:66
GUID guid
Definition: version.c:147
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define calloc
Definition: rosglue.h:14
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:269
#define DDERR_INVALIDCAPS
Definition: ddraw.h:77
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:113
#define DDERR_NOPALETTEATTACHED
Definition: ddraw.h:148
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:265
#define ERR_(ch,...)
Definition: debug.h:156
#define TRACE(s)
Definition: solgame.cpp:4
IUnknown * outer_unknown
IUnknown * rt_iface
DWORD flags
Definition: tools.h:99

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

◆ d3d_device_sync_surfaces()

void d3d_device_sync_surfaces ( struct d3d_device *  device)

Definition at line 3427 of file device.c.

3428{
3429 const struct wined3d_stateblock_state *state = device->stateblock_state;
3430 struct ddraw_surface *surface;
3431 unsigned int i, j;
3432
3434
3435 if (!device->have_draw_textures)
3436 return;
3437
3438 for (i = 0; i < ARRAY_SIZE(state->textures); ++i)
3439 {
3440 if (!state->textures[i])
3441 continue;
3442
3443 j = 0;
3444 while ((surface = wined3d_texture_get_sub_resource_parent(state->textures[i], j)))
3445 {
3446 if (!surface->draw_texture)
3447 break;
3449 ++j;
3450 }
3451 }
3452}
static int state
Definition: maze.c:121
#define ARRAY_SIZE(A)
Definition: main.h:20
#define DDRAW_SURFACE_READ
static struct wined3d_texture * ddraw_surface_get_draw_texture(struct ddraw_surface *surface, unsigned int flags)
static void d3d_device_sync_rendertarget(struct d3d_device *device)
Definition: device.c:3392
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:4033
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
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
struct wined3d_texture * draw_texture

Referenced by d3d_device_apply_state().

◆ d3d_device_update_depth_stencil()

enum wined3d_depth_buffer_type d3d_device_update_depth_stencil ( struct d3d_device *  device)

Definition at line 6817 of file device.c.

6818{
6819 IDirectDrawSurface7 *depthStencil = NULL;
6820 IDirectDrawSurface7 *render_target;
6821 static DDSCAPS2 depthcaps = { DDSCAPS_ZBUFFER, 0, 0, {0} };
6822
6823 if (device->rt_iface && SUCCEEDED(IUnknown_QueryInterface(device->rt_iface,
6824 &IID_IDirectDrawSurface7, (void **)&render_target)))
6825 {
6826 IDirectDrawSurface7_GetAttachedSurface(render_target, &depthcaps, &depthStencil);
6827 IDirectDrawSurface7_Release(render_target);
6828 }
6829 if (!depthStencil)
6830 {
6831 TRACE("Setting wined3d depth stencil to NULL\n");
6834 device->target_ds = NULL;
6835 return WINED3D_ZB_FALSE;
6836 }
6837
6838 device->target_ds = impl_from_IDirectDrawSurface7(depthStencil);
6842
6843 IDirectDrawSurface7_Release(depthStencil);
6844 return WINED3D_ZB_TRUE;
6845}
struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface)
Definition: surface.c:7053
static struct ddraw_surface * impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
#define NULL
Definition: types.h:112
HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context, struct wined3d_rendertarget_view *view)
Definition: device.c:2453
#define SUCCEEDED(hr)
Definition: intsafe.h:50
DWORD IDirectDrawSurface7
Definition: vmrender.idl:20
void CDECL wined3d_stateblock_depth_buffer_changed(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:4043
@ WINED3D_ZB_TRUE
Definition: wined3d.h:474
@ WINED3D_ZB_FALSE
Definition: wined3d.h:473

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 
)

Definition at line 48 of file executebuffer.c.

49{
50 DWORD is = buffer->data.dwInstructionOffset;
51 char *instr = (char *)buffer->desc.lpData + is;
52 unsigned int i, primitive_size;
53 struct wined3d_map_desc map_desc;
54 struct wined3d_box box = {0};
55 HRESULT hr;
56
57 TRACE("ExecuteData :\n");
58 if (TRACE_ON(ddraw))
59 _dump_executedata(&(buffer->data));
60
61 for (;;)
62 {
64 BYTE size;
65 WORD count;
66
67 count = current->wCount;
68 size = current->bSize;
69 instr += sizeof(*current);
70 primitive_size = 0;
71
72 switch (current->bOpcode)
73 {
74 case D3DOP_POINT:
75 {
76 const D3DPOINT *p = (D3DPOINT *)instr;
79 buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
82
84 for (i = 0; i < count; ++i)
85 wined3d_device_context_draw(device->immediate_context, p[i].wFirst, p[i].wCount, 0, 0);
86
87 instr += sizeof(*p) * count;
88 break;
89 }
90
91 case D3DOP_LINE:
92 primitive_size = 2;
94 /* Drop through. */
95 case D3DOP_TRIANGLE:
96 {
98 unsigned int index_pos = buffer->index_pos, index_count;
99 TRACE("TRIANGLE (%d)\n", count);
100
101 if (!count)
102 break;
103
104 if (!primitive_size)
105 {
107 primitive_size = 3;
108 }
109
110 index_count = count * primitive_size;
111 if (buffer->index_size < index_count)
112 {
113 unsigned int new_size = max(buffer->index_size * 2, index_count);
114 struct wined3d_buffer *new_buffer;
116
117 desc.byte_width = new_size * sizeof(*indices);
119 desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
121 desc.misc_flags = 0;
122 desc.structure_byte_stride = 0;
123
124 if (FAILED(hr = wined3d_buffer_create(device->wined3d_device, &desc,
125 NULL, NULL, &ddraw_null_wined3d_parent_ops, &new_buffer)))
126 return hr;
127
128 buffer->index_size = new_size;
129 if (buffer->index_buffer)
130 wined3d_buffer_decref(buffer->index_buffer);
131 buffer->index_buffer = new_buffer;
132 index_pos = 0;
133 }
134 else if (buffer->index_size - index_count < index_pos)
135 {
136 index_pos = 0;
137 }
138
139 box.left = index_pos * sizeof(*indices);
140 box.right = (index_pos + index_count) * sizeof(*indices);
141 if (FAILED(hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->index_buffer), 0, &map_desc,
143 return hr;
144 indices = map_desc.data;
145
146 for (i = 0; i < count; ++i)
147 {
148 D3DTRIANGLE *ci = (D3DTRIANGLE *)instr;
149 TRACE(" v1: %d v2: %d v3: %d\n",ci->v1, ci->v2, ci->v3);
150 TRACE(" Flags : ");
151 if (TRACE_ON(ddraw))
152 {
153 /* Wireframe */
155 TRACE("EDGEENABLE1 ");
157 TRACE("EDGEENABLE2 ");
159 TRACE("EDGEENABLE3 ");
160 /* Strips / Fans */
161 if (ci->wFlags == D3DTRIFLAG_EVEN)
162 TRACE("EVEN ");
163 if (ci->wFlags == D3DTRIFLAG_ODD)
164 TRACE("ODD ");
165 if (ci->wFlags == D3DTRIFLAG_START)
166 TRACE("START ");
167 if ((ci->wFlags > 0) && (ci->wFlags < 30))
168 TRACE("STARTFLAT(%u) ", ci->wFlags);
169 TRACE("\n");
170 }
171
172 switch (primitive_size)
173 {
174 case 3:
175 indices[(i * primitive_size) + 2] = ci->v3;
176 /* Drop through. */
177 case 2:
178 indices[(i * primitive_size) + 1] = ci->v2;
179 indices[(i * primitive_size) ] = ci->v1;
180 }
181 instr += size;
182 }
183
185
187 buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
192 wined3d_device_context_draw_indexed(device->immediate_context, 0, index_pos, index_count, 0, 0);
193
194 buffer->index_pos = index_pos + index_count;
195 break;
196 }
197
198 case D3DOP_MATRIXLOAD:
199 WARN("MATRIXLOAD-s (%u)\n", count);
200 instr += count * size;
201 break;
202
204 TRACE("MATRIXMULTIPLY (%d)\n", count);
205 for (i = 0; i < count; ++i)
206 {
208 struct wined3d_matrix *a, *b, *c;
209
213
214 if (!a || !b || !c)
215 {
216 ERR("Invalid matrix handle (a %#lx -> %p, b %#lx -> %p, c %#lx -> %p).\n",
217 ci->hDestMatrix, a, ci->hSrcMatrix1, b, ci->hSrcMatrix2, c);
218 }
219 else
220 {
221 TRACE("dst %p, src1 %p, src2 %p.\n", a, b, c);
222 multiply_matrix(a, c, b);
223 }
224
225 instr += size;
226 }
227 break;
228
230 TRACE("STATETRANSFORM (%d)\n", count);
231 for (i = 0; i < count; ++i)
232 {
233 D3DSTATE *ci = (D3DSTATE *)instr;
234 D3DMATRIX *m;
235
237 if (!m)
238 {
239 ERR("Invalid matrix handle %#lx.\n", ci->dwArg[0]);
240 }
241 else
242 {
244 device->world = ci->dwArg[0];
246 device->view = ci->dwArg[0];
248 device->proj = ci->dwArg[0];
249 IDirect3DDevice3_SetTransform(&device->IDirect3DDevice3_iface,
251 }
252
253 instr += size;
254 }
255 break;
256
257 case D3DOP_STATELIGHT:
258 TRACE("STATELIGHT (%d)\n", count);
259 for (i = 0; i < count; ++i)
260 {
261 D3DSTATE *ci = (D3DSTATE *)instr;
262
263 if (FAILED(IDirect3DDevice3_SetLightState(&device->IDirect3DDevice3_iface,
264 ci->dlstLightStateType, ci->dwArg[0])))
265 WARN("Failed to set light state.\n");
266
267 instr += size;
268 }
269 break;
270
272 TRACE("STATERENDER (%d)\n", count);
273 for (i = 0; i < count; ++i)
274 {
275 D3DSTATE *ci = (D3DSTATE *)instr;
276
277 if (FAILED(IDirect3DDevice3_SetRenderState(&device->IDirect3DDevice3_iface,
278 ci->drstRenderStateType, ci->dwArg[0])))
279 WARN("Failed to set render state.\n");
280
281 instr += size;
282 }
283 break;
284
286 TRACE("PROCESSVERTICES (%d)\n", count);
287
288 for (i = 0; i < count; ++i)
289 {
292
293 TRACE(" start %u, dest %u, count %lu, flags %#lx.\n",
294 ci->wStart, ci->wDest, ci->dwCount, ci->dwFlags);
295
297 FIXME("D3DPROCESSVERTICES_UPDATEEXTENTS not implemented.\n");
299 FIXME("D3DPROCESSVERTICES_NOCOLOR not implemented.\n");
300
301 switch (op)
302 {
306 buffer->src_vertex_buffer, buffer->src_vertex_pos * sizeof(D3DVERTEX), sizeof(D3DVERTEX));
313 wined3d_device_process_vertices(device->wined3d_device, device->state, ci->wStart,
314 ci->wDest, ci->dwCount, buffer->dst_vertex_buffer, NULL, 0, D3DFVF_TLVERTEX);
315 break;
316
318 box.left = (buffer->src_vertex_pos + ci->wStart) * sizeof(D3DTLVERTEX);
319 box.right = box.left + ci->dwCount * sizeof(D3DTLVERTEX);
320 box.top = box.front = 0;
321 box.bottom = box.back = 1;
323 wined3d_buffer_get_resource(buffer->dst_vertex_buffer), 0,
324 ci->wDest * sizeof(D3DTLVERTEX), 0, 0,
325 wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0, &box, 0);
326 break;
327
328 default:
329 FIXME("Unhandled vertex processing op %#lx.\n", op);
330 break;
331 }
332
333 instr += size;
334 }
335 break;
336
338 TRACE("TEXTURELOAD (%u)\n", count);
339
340 for (i = 0; i < count; ++i)
341 {
342 D3DTEXTURELOAD *ci = (D3DTEXTURELOAD *)instr;
343 struct ddraw_surface *dst, *src;
344
345 instr += size;
346
348 {
349 WARN("Invalid destination texture handle %#lx.\n", ci->hDestTexture);
350 continue;
351 }
353 {
354 WARN("Invalid source texture handle %#lx.\n", ci->hSrcTexture);
355 continue;
356 }
357
358 IDirect3DTexture2_Load(&dst->IDirect3DTexture2_iface, &src->IDirect3DTexture2_iface);
359 }
360 break;
361
362 case D3DOP_EXIT:
363 TRACE("EXIT (%u)\n", count);
364 instr += size;
365 goto end_of_buffer;
366
368 TRACE("BRANCHFORWARD (%d)\n", count);
369 for (i = 0; i < count; ++i)
370 {
371 D3DBRANCH *ci = (D3DBRANCH *)instr;
372
373 if ((buffer->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue)
374 {
375 if (!ci->bNegate)
376 {
377 TRACE(" Branch to %ld\n", ci->dwOffset);
378 if (ci->dwOffset) {
379 instr = (char*)current + ci->dwOffset;
380 break;
381 }
382 }
383 }
384 else
385 {
386 if (ci->bNegate)
387 {
388 TRACE(" Branch to %ld\n", ci->dwOffset);
389 if (ci->dwOffset) {
390 instr = (char*)current + ci->dwOffset;
391 break;
392 }
393 }
394 }
395
396 instr += size;
397 }
398 break;
399
400 case D3DOP_SPAN:
401 WARN("SPAN-s (%u)\n", count);
402 instr += count * size;
403 break;
404
405 case D3DOP_SETSTATUS:
406 TRACE("SETSTATUS (%d)\n", count);
407 for (i = 0; i < count; ++i)
408 {
409 buffer->data.dsStatus = *(D3DSTATUS *)instr;
410 instr += size;
411 }
412 break;
413
414 default:
415 ERR("Unhandled OpCode %#x.\n",current->bOpcode);
416 instr += count * size;
417 break;
418 }
419 }
420
421end_of_buffer:
422 return D3D_OK;
423}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define IDirect3DDevice3_SetRenderState(p, a, b)
Definition: d3d.h:1213
#define IDirect3DDevice3_SetLightState(p, a, b)
Definition: d3d.h:1215
#define IDirect3DTexture2_Load(p, a)
Definition: d3d.h:632
#define IDirect3DDevice3_SetTransform(p, a, b)
Definition: d3d.h:1216
@ D3DOP_STATELIGHT
Definition: d3dtypes.h:650
@ D3DOP_TEXTURELOAD
Definition: d3dtypes.h:653
@ D3DOP_MATRIXMULTIPLY
Definition: d3dtypes.h:648
@ D3DOP_PROCESSVERTICES
Definition: d3dtypes.h:652
@ D3DOP_MATRIXLOAD
Definition: d3dtypes.h:647
@ D3DOP_STATETRANSFORM
Definition: d3dtypes.h:649
@ D3DOP_TRIANGLE
Definition: d3dtypes.h:646
@ D3DOP_SPAN
Definition: d3dtypes.h:656
@ D3DOP_LINE
Definition: d3dtypes.h:645
@ D3DOP_STATERENDER
Definition: d3dtypes.h:651
@ D3DOP_SETSTATUS
Definition: d3dtypes.h:657
@ D3DOP_POINT
Definition: d3dtypes.h:644
@ D3DOP_EXIT
Definition: d3dtypes.h:654
@ D3DOP_BRANCHFORWARD
Definition: d3dtypes.h:655
#define D3DTRIFLAG_ODD
Definition: d3dtypes.h:1172
#define D3DTRIFLAG_START
Definition: d3dtypes.h:1170
#define D3DTRIFLAG_EDGEENABLE1
Definition: d3dtypes.h:1175
#define D3DFVF_VERTEX
Definition: d3dtypes.h:1328
#define D3DPROCESSVERTICES_COPY
Definition: d3dtypes.h:1056
#define D3DTRIFLAG_EVEN
Definition: d3dtypes.h:1173
#define D3DPROCESSVERTICES_OPMASK
Definition: d3dtypes.h:1057
#define D3DPROCESSVERTICES_NOCOLOR
Definition: d3dtypes.h:1060
#define D3DFVF_LVERTEX
Definition: d3dtypes.h:1329
#define D3DFVF_TLVERTEX
Definition: d3dtypes.h:1331
struct _D3DTLVERTEX D3DTLVERTEX
#define D3DPROCESSVERTICES_UPDATEEXTENTS
Definition: d3dtypes.h:1059
#define D3DPROCESSVERTICES_TRANSFORMLIGHT
Definition: d3dtypes.h:1054
#define D3DPROCESSVERTICES_TRANSFORM
Definition: d3dtypes.h:1055
#define D3DTRIFLAG_EDGEENABLE2
Definition: d3dtypes.h:1176
void d3d_device_apply_state(struct d3d_device *device, BOOL clear_state)
Definition: device.c:3454
void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
Definition: utils.c:1153
void * ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
Definition: main.c:213
void d3d_device_sync_surfaces(struct d3d_device *device)
Definition: device.c:3427
#define FALSE
Definition: types.h:117
UINT op
Definition: effect.c:235
struct wined3d_vertex_declaration * ddraw_find_decl(struct ddraw *This, DWORD fvf)
Definition: ddraw.c:4917
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
Definition: ddraw.c:82
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:1329
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:459
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:520
void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, unsigned int start_vertex, unsigned int vertex_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2635
void CDECL wined3d_device_context_set_primitive_type(struct wined3d_device_context *context, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count)
Definition: device.c:3779
HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context, 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, unsigned int flags)
Definition: device.c:4220
void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *context, int base_vertex_index, unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2649
HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_stateblock *stateblock, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, uint32_t flags, uint32_t dst_fvf)
Definition: device.c:3598
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:304
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, uint32_t flags)
Definition: resource.c:295
#define TRACE_ON(x)
Definition: compat.h:75
#define D3DTRANSFORMSTATE_WORLD
Definition: dx7todx8.h:22
#define D3DTRANSFORMSTATE_VIEW
Definition: dx7todx8.h:21
#define D3DTRANSFORMSTATE_PROJECTION
Definition: dx7todx8.h:12
static void _dump_executedata(const D3DEXECUTEDATA *lpData)
Definition: executebuffer.c:33
size_t const new_size
Definition: expand.cpp:66
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLenum src
Definition: glext.h:6340
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLenum dst
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
const GLfloat * m
Definition: glext.h:10848
#define a
Definition: ke_i.h:78
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79
struct task_struct * current
Definition: linux.c:32
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
BOOL bNegate
Definition: d3dtypes.h:1221
DWORD dwOffset
Definition: d3dtypes.h:1222
DWORD dwValue
Definition: d3dtypes.h:1220
DWORD dwMask
Definition: d3dtypes.h:1219
D3DMATRIXHANDLE hDestMatrix
Definition: d3dtypes.h:1041
D3DMATRIXHANDLE hSrcMatrix1
Definition: d3dtypes.h:1042
D3DMATRIXHANDLE hSrcMatrix2
Definition: d3dtypes.h:1043
DWORD dwArg[1]
Definition: d3dtypes.h:1030
D3DLIGHTSTATETYPE dlstLightStateType
Definition: d3dtypes.h:1026
D3DTRANSFORMSTATETYPE dtstTransformStateType
Definition: d3dtypes.h:1025
D3DRENDERSTATETYPE drstRenderStateType
Definition: d3dtypes.h:1027
D3DTEXTUREHANDLE hSrcTexture
Definition: d3dtypes.h:670
D3DTEXTUREHANDLE hDestTexture
Definition: d3dtypes.h:669
Definition: palette.c:466
#define max(a, b)
Definition: svc.c:63
void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock, struct wined3d_vertex_declaration *declaration)
Definition: stateblock.c:1571
void CDECL wined3d_stateblock_set_index_buffer(struct wined3d_stateblock *stateblock, struct wined3d_buffer *buffer, enum wined3d_format_id format_id)
Definition: stateblock.c:1918
void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock, enum wined3d_render_state state, unsigned int value)
Definition: stateblock.c:1623
HRESULT CDECL wined3d_stateblock_set_stream_source(struct wined3d_stateblock *stateblock, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: stateblock.c:1939
@ WINED3D_RS_LIGHTING
Definition: wined3d.h:347
@ WINED3D_PT_LINELIST
Definition: wined3d.h:77
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:76
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:79
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:214
#define WINED3D_MAP_DISCARD
Definition: wined3d.h:953
#define WINED3D_MAP_WRITE
Definition: wined3d.h:956
#define WINED3D_MAP_NOOVERWRITE
Definition: wined3d.h:952
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:924
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:936
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:910
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54
unsigned char BYTE
Definition: xxhash.c:193

Referenced by d3d_device1_Execute().

◆ d3d_execute_buffer_init()

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

Definition at line 756 of file executebuffer.c.

758{
760 execute_buffer->ref = 1;
761 execute_buffer->d3ddev = device;
762
763 /* Initializes memory */
764 memcpy(&execute_buffer->desc, desc, desc->dwSize);
765
766 /* No buffer given */
767 if (!(execute_buffer->desc.dwFlags & D3DDEB_LPDATA))
768 execute_buffer->desc.lpData = NULL;
769
770 /* No buffer size given */
771 if (!(execute_buffer->desc.dwFlags & D3DDEB_BUFSIZE))
772 execute_buffer->desc.dwBufferSize = 0;
773
774 /* Create buffer if asked */
775 if (!execute_buffer->desc.lpData && execute_buffer->desc.dwBufferSize)
776 {
777 execute_buffer->need_free = TRUE;
778 if (!(execute_buffer->desc.lpData = calloc(1, execute_buffer->desc.dwBufferSize)))
779 {
780 ERR("Failed to allocate execute buffer data.\n");
781 return DDERR_OUTOFMEMORY;
782 }
783 }
784
785 execute_buffer->desc.dwFlags |= D3DDEB_LPDATA;
786
787 return D3D_OK;
788}
#define TRUE
Definition: types.h:120
#define D3DDEB_BUFSIZE
Definition: d3dcaps.h:142
#define D3DDEB_LPDATA
Definition: d3dcaps.h:144
static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface
D3DEXECUTEBUFFERDESC desc
struct d3d_device * d3ddev

Referenced by d3d_device1_CreateExecuteBuffer().

◆ d3d_light_init()

void d3d_light_init ( struct d3d_light *  light,
struct ddraw *  ddraw 
)

Definition at line 250 of file light.c.

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

Referenced by d3d3_CreateLight().

◆ d3d_material_create()

struct d3d_material * d3d_material_create ( struct ddraw *  ddraw)

Definition at line 498 of file material.c.

499{
500 struct d3d_material *material;
501
502 if (!(material = calloc(1, sizeof(*material))))
503 return NULL;
504
508 material->ref = 1;
509 material->ddraw = ddraw;
510
511 return material;
512}
static const struct IDirect3DMaterial3Vtbl d3d_material3_vtbl
Definition: material.c:459
static const struct IDirect3DMaterialVtbl d3d_material1_vtbl
Definition: material.c:483
static const struct IDirect3DMaterial2Vtbl d3d_material2_vtbl
Definition: material.c:471
IDirect3DMaterial IDirect3DMaterial_iface
struct ddraw * ddraw
IDirect3DMaterial2 IDirect3DMaterial2_iface
IDirect3DMaterial3 IDirect3DMaterial3_iface

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

◆ d3d_vertex_buffer_create()

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

Definition at line 443 of file vertexbuffer.c.

445{
447 HRESULT hr = D3D_OK;
448
449 TRACE("Vertex buffer description:\n");
450 TRACE(" dwSize %lu\n", desc->dwSize);
451 TRACE(" dwCaps %#lx\n", desc->dwCaps);
452 TRACE(" FVF %#lx\n", desc->dwFVF);
453 TRACE(" dwNumVertices %lu\n", desc->dwNumVertices);
454
455 if (!(buffer = calloc(1, sizeof(*buffer))))
456 return DDERR_OUTOFMEMORY;
457
458 buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
459 buffer->ref = 1;
460 buffer->version = ddraw->d3dversion;
461 if (buffer->version == 7)
462 IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface);
463 buffer->ddraw = ddraw;
464 buffer->Caps = desc->dwCaps;
465 buffer->fvf = desc->dwFVF;
466 buffer->size = get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices;
467
468 /* ddraw4 vertex buffers ignore DISCARD and NOOVERWRITE, even on
469 * pretransformed geometry, which means that a GPU-based buffer cannot
470 * perform well.
471 *
472 * While at least one contemporaneous card (Geforce 4) does seem to show a
473 * difference in its performance characteristics based on whether
474 * D3DVBCAPS_SYSTEMMEMORY is set, it also doesn't *improve* performance to
475 * use a non-SYSTEMMEMORY buffer with ddraw4. For wined3d it should always
476 * be better to use sysmem.
477 *
478 * This improves performance in Prince of Persia 3D. */
479 buffer->sysmem = ((buffer->Caps & D3DVBCAPS_SYSTEMMEMORY) || buffer->version < 7);
480
482
484 {
485 WARN("Failed to create wined3d vertex buffer, hr %#lx.\n", hr);
488 goto end;
489 }
490
491 if (!(buffer->wined3d_declaration = ddraw_find_decl(ddraw, desc->dwFVF)))
492 {
493 ERR("Failed to find vertex declaration for fvf %#lx.\n", desc->dwFVF);
494 wined3d_buffer_decref(buffer->wined3d_buffer);
496 goto end;
497 }
498 wined3d_vertex_declaration_incref(buffer->wined3d_declaration);
499
500end:
502 if (hr == D3D_OK)
503 *vertex_buf = buffer;
504 else
505 free(buffer);
506
507 return hr;
508}
#define D3DVBCAPS_SYSTEMMEMORY
Definition: d3dtypes.h:1280
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType)
Definition: utils.c:915
GLuint GLuint end
Definition: gl.h:1545
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:81
struct ddraw * ddraw
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:83
int d3dversion
static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer *buffer, BOOL dynamic, struct wined3d_buffer **wined3d_buffer)
Definition: vertexbuffer.c:113
static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl
Definition: vertexbuffer.c:430
ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration)
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:44
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539

Referenced by d3d3_CreateVertexBuffer(), and d3d7_CreateVertexBuffer().

◆ d3d_viewport_init()

void d3d_viewport_init ( struct d3d_viewport *  viewport,
struct ddraw *  ddraw 
)

Definition at line 1232 of file viewport.c.

1233{
1234 viewport->IDirect3DViewport3_iface.lpVtbl = &d3d_viewport_vtbl;
1235 viewport->ref = 1;
1236 viewport->ddraw = ddraw;
1238 list_init(&viewport->light_list);
1239}
static void list_init(struct list_entry *head)
Definition: list.h:51
static const struct IDirect3DViewport3Vtbl d3d_viewport_vtbl
Definition: viewport.c:1180
struct list light_list
enum ddraw_viewport_version version
struct ddraw * ddraw
IDirect3DViewport3 IDirect3DViewport3_iface

Referenced by d3d3_CreateViewport().

◆ ddraw_allocate_handle()

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

Definition at line 138 of file main.c.

139{
141
142 if (!t)
144
145 if (t->free_entries)
146 {
147 DWORD idx = t->free_entries - t->entries;
148 /* Use a free handle */
149 entry = t->free_entries;
150 if (entry->type != DDRAW_HANDLE_FREE)
151 {
152 ERR("Handle %#lx (%p) is in the free list, but has type %#x.\n", idx, entry->object, entry->type);
154 }
155 t->free_entries = entry->object;
156 entry->object = object;
157 entry->type = type;
158
159 return idx;
160 }
161
162 if (!(t->entry_count < t->table_size))
163 {
164 /* Grow the table */
165 UINT new_size = t->table_size + (t->table_size >> 1);
166 struct ddraw_handle_entry *new_entries;
167
168 if (!(new_entries = realloc(t->entries, new_size * sizeof(*t->entries))))
169 {
170 ERR("Failed to grow the handle table.\n");
172 }
173 t->entries = new_entries;
174 t->table_size = new_size;
175 }
176
177 entry = &t->entries[t->entry_count];
178 entry->object = object;
179 entry->type = type;
180
181 return t->entry_count++;
182}
#define DDRAW_INVALID_HANDLE
#define realloc
Definition: debug_ros.c:6
struct ddraw_handle_table global_handle_table
Definition: main.c:40
unsigned int idx
Definition: utils.c:40
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble t
Definition: gl.h:2047
unsigned int UINT
Definition: sysinfo.c:13
uint32_t entry
Definition: isohybrid.c:63
void * object

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

◆ ddraw_clipper_init()

HRESULT ddraw_clipper_init ( struct ddraw_clipper *  clipper)

Definition at line 381 of file clipper.c.

382{
384 clipper->ref = 1;
385
386 return DD_OK;
387}
static const struct IDirectDrawClipperVtbl ddraw_clipper_vtbl
Definition: clipper.c:26
#define DD_OK
Definition: ddraw.h:188
IDirectDrawClipper IDirectDrawClipper_iface

Referenced by DirectDrawCreateClipper().

◆ ddraw_clipper_is_valid()

BOOL ddraw_clipper_is_valid ( const struct ddraw_clipper *  clipper)

Definition at line 33 of file clipper.c.

34{
35 /* Native is very lenient when you invoke the clipper methods with a clipper pointer that
36 * points to something that is either not accessible or not a clipper, or if you break
37 * a clipper after assigning it to a surface. Deus Ex: Goty depends on this. */
38
39 if (IsBadReadPtr(clipper, sizeof(*clipper)))
40 {
41 WARN("The application gave us an invalid clipper pointer %p.\n", clipper);
42 return FALSE;
43 }
44 if (clipper->IDirectDrawClipper_iface.lpVtbl != &ddraw_clipper_vtbl)
45 {
46 WARN("The clipper vtable is modified: %p, expected %p.\n",
48 return FALSE;
49 }
50
51 return TRUE;
52}
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:805

Referenced by ddraw_clipper_AddRef(), ddraw_clipper_GetClipList(), ddraw_clipper_GetHWnd(), ddraw_clipper_Initialize(), ddraw_clipper_IsClipListChanged(), ddraw_clipper_QueryInterface(), ddraw_clipper_Release(), ddraw_clipper_SetClipList(), ddraw_clipper_SetHWnd(), ddraw_surface7_GetClipper(), ddraw_surface7_SetClipper(), ddraw_surface_blt_clipped(), and ddraw_surface_wined3d_object_destroyed().

◆ DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1()

void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1 ( const DDDEVICEIDENTIFIER2 *  pIn,
DDDEVICEIDENTIFIER *  pOut 
)

Definition at line 953 of file utils.c.

954{
955 /* 2 adds a dwWHQLLevel field to the end. Both structures are
956 * unversioned. */
957 memcpy(pOut, pIn, sizeof(*pOut));
958}

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 943 of file utils.c.

944{
945 /* 2 adds three additional caps fields to the end. Both versions
946 * are unversioned. */
947 pOut->dwCaps = pIn->dwCaps;
948 pOut->dwCaps2 = 0;
949 pOut->dwCaps3 = 0;
950 pOut->dwCaps4 = 0;
951}
DWORD dwCaps4
Definition: ddraw.h:739
DWORD dwCaps3
Definition: ddraw.h:736
DWORD dwCaps2
Definition: ddraw.h:735
DWORD dwCaps
Definition: ddraw.h:734
DWORD dwCaps
Definition: ddraw.h:729

Referenced by ddraw2_GetAvailableVidMem().

◆ ddraw_d3dcaps1_from_7()

void ddraw_d3dcaps1_from_7 ( D3DDEVICEDESC *  caps1,
D3DDEVICEDESC7 *  caps7 
)

Definition at line 1203 of file ddraw.c.

1204{
1205 memset(caps1, 0, sizeof(*caps1));
1206 caps1->dwSize = sizeof(*caps1);
1207 caps1->dwFlags = D3DDD_COLORMODEL
1218 caps1->dcmColorModel = D3DCOLOR_RGB;
1219 caps1->dwDevCaps = caps7->dwDevCaps;
1220 caps1->dtcTransformCaps.dwSize = sizeof(caps1->dtcTransformCaps);
1222 caps1->bClipping = TRUE;
1223 caps1->dlcLightingCaps.dwSize = sizeof(caps1->dlcLightingCaps);
1230 caps1->dpcLineCaps = caps7->dpcLineCaps;
1231 caps1->dpcTriCaps = caps7->dpcTriCaps;
1234
1235 /* This value is zero on all Windows drivers we have seen so far. */
1236 caps1->dwMaxBufferSize = 0;
1237
1238 /* AMD GPUs on Windows XP and newer report 1024 for HAL devices.
1239 * Nvidia GPUs report 65534. On Windows 9x we have seen 2048 on
1240 * AMD cards and 32768 on Nvidia. The API defined limit is 65536
1241 * because ddraw only supports 16 bit indices.
1242 *
1243 * Some games, for example Prince of Persia 3D (bug 44863), create a
1244 * vertex buffer to hold as many vertices as we report here. The
1245 * game requests a video memory buffer, maps it, writes a handful
1246 * of vertices and draws. Because IDirect3DVertexBuffer::Lock does
1247 * not allow passing a range, and prior to d3d7 doesn't support
1248 * NOOVERWRITE/DISCARD, the upload becomes slow if the buffer is too
1249 * large. So we don't want to report a value that's too high here.
1250 *
1251 * Why 2048? Windows 9x was the contemporaneous system when d3d 1-4
1252 * titles were written.
1253 *
1254 * Regardless of this value, we put ddraw4 vertex buffers into
1255 * system memory because games are using them poorly. This mitigates
1256 * negative effects of a large vertex count.
1257 *
1258 * Windows doesn't enforce this limit. A larger vertex buffer can
1259 * be created and used in draws. More vertices than dwMaxVertexCount
1260 * can be rendered in one draw call. SetExecuteData with a vertex
1261 * count exceeding dwMaxVertexCount succeeds too. */
1262 caps1->dwMaxVertexCount = 2048;
1263
1264 caps1->dwMinTextureWidth = caps7->dwMinTextureWidth;
1265 caps1->dwMinTextureHeight = caps7->dwMinTextureHeight;
1266 caps1->dwMaxTextureWidth = caps7->dwMaxTextureWidth;
1267 caps1->dwMaxTextureHeight = caps7->dwMaxTextureHeight;
1268 caps1->dwMinStippleWidth = 1;
1269 caps1->dwMinStippleHeight = 1;
1270 caps1->dwMaxStippleWidth = 32;
1271 caps1->dwMaxStippleHeight = 32;
1272 caps1->dwMaxTextureRepeat = caps7->dwMaxTextureRepeat;
1274 caps1->dwMaxAnisotropy = caps7->dwMaxAnisotropy;
1275 caps1->dvGuardBandLeft = caps7->dvGuardBandLeft;
1276 caps1->dvGuardBandTop = caps7->dvGuardBandTop;
1277 caps1->dvGuardBandRight = caps7->dvGuardBandRight;
1278 caps1->dvGuardBandBottom = caps7->dvGuardBandBottom;
1279 caps1->dvExtentsAdjust = caps7->dvExtentsAdjust;
1280 caps1->dwStencilCaps = caps7->dwStencilCaps;
1281 caps1->dwFVFCaps = caps7->dwFVFCaps;
1282 caps1->dwTextureOpCaps = caps7->dwTextureOpCaps;
1285}
#define D3DCOLOR_RGB
Definition: d3dtypes.h:627
#define D3DDD_LIGHTINGCAPS
Definition: d3dcaps.h:108
#define D3DDD_MAXBUFFERSIZE
Definition: d3dcaps.h:114
#define D3DDD_LINECAPS
Definition: d3dcaps.h:110
#define D3DDD_DEVICEZBUFFERBITDEPTH
Definition: d3dcaps.h:113
#define D3DLIGHTCAPS_DIRECTIONAL
Definition: d3dcaps.h:20
#define D3DDD_COLORMODEL
Definition: d3dcaps.h:105
#define D3DLIGHTCAPS_POINT
Definition: d3dcaps.h:18
#define D3DDD_DEVICERENDERBITDEPTH
Definition: d3dcaps.h:112
#define D3DLIGHTCAPS_SPOT
Definition: d3dcaps.h:19
#define D3DDD_TRANSFORMCAPS
Definition: d3dcaps.h:107
#define D3DDD_TRICAPS
Definition: d3dcaps.h:111
#define D3DDD_DEVCAPS
Definition: d3dcaps.h:106
#define D3DDD_BCLIPPING
Definition: d3dcaps.h:109
#define D3DTRANSFORMCAPS_CLIP
Definition: d3dcaps.h:15
#define D3DDD_MAXVERTEXCOUNT
Definition: d3dcaps.h:115
#define D3DLIGHTINGMODEL_RGB
Definition: d3dcaps.h:16
#define D3DLIGHTCAPS_PARALLELPOINT
Definition: dump.c:16
#define memset(x, y, z)
Definition: compat.h:39
D3DPRIMCAPS dpcTriCaps
Definition: d3dcaps.h:360
WORD wMaxSimultaneousTextures
Definition: d3dcaps.h:379
DWORD dwMaxTextureAspectRatio
Definition: d3dcaps.h:368
DWORD dwMaxTextureHeight
Definition: d3dcaps.h:366
DWORD dwFVFCaps
Definition: d3dcaps.h:376
D3DPRIMCAPS dpcLineCaps
Definition: d3dcaps.h:359
DWORD dwMinTextureHeight
Definition: d3dcaps.h:364
DWORD dwMaxAnisotropy
Definition: d3dcaps.h:369
DWORD dwDeviceRenderBitDepth
Definition: d3dcaps.h:361
DWORD dwStencilCaps
Definition: d3dcaps.h:375
DWORD dwMaxActiveLights
Definition: d3dcaps.h:380
DWORD dwMaxTextureRepeat
Definition: d3dcaps.h:367
DWORD dwDeviceZBufferBitDepth
Definition: d3dcaps.h:362
DWORD dwTextureOpCaps
Definition: d3dcaps.h:377
D3DVALUE dvGuardBandRight
Definition: d3dcaps.h:372
D3DVALUE dvGuardBandBottom
Definition: d3dcaps.h:373
WORD wMaxTextureBlendStages
Definition: d3dcaps.h:378
DWORD dwDevCaps
Definition: d3dcaps.h:358
D3DVALUE dvGuardBandTop
Definition: d3dcaps.h:371
DWORD dwMinTextureWidth
Definition: d3dcaps.h:363
D3DVALUE dvExtentsAdjust
Definition: d3dcaps.h:374
DWORD dwMaxTextureWidth
Definition: d3dcaps.h:365
D3DVALUE dvGuardBandLeft
Definition: d3dcaps.h:370
DWORD dwMaxStippleWidth
Definition: d3dcaps.h:334
D3DVALUE dvGuardBandTop
Definition: d3dcaps.h:343
D3DPRIMCAPS dpcTriCaps
Definition: d3dcaps.h:326
DWORD dwDeviceZBufferBitDepth
Definition: d3dcaps.h:328
DWORD dwSize
Definition: d3dcaps.h:318
DWORD dwMaxTextureWidth
Definition: d3dcaps.h:333
D3DTRANSFORMCAPS dtcTransformCaps
Definition: d3dcaps.h:322
DWORD dwStencilCaps
Definition: d3dcaps.h:347
BOOL bClipping
Definition: d3dcaps.h:323
D3DVALUE dvGuardBandRight
Definition: d3dcaps.h:344
DWORD dwFlags
Definition: d3dcaps.h:319
DWORD dwMaxTextureAspectRatio
Definition: d3dcaps.h:340
DWORD dwMaxTextureRepeat
Definition: d3dcaps.h:339
DWORD dwDeviceRenderBitDepth
Definition: d3dcaps.h:327
DWORD dwMaxBufferSize
Definition: d3dcaps.h:329
DWORD dwMaxVertexCount
Definition: d3dcaps.h:330
DWORD dwMaxStippleHeight
Definition: d3dcaps.h:335
DWORD dwDevCaps
Definition: d3dcaps.h:321
D3DPRIMCAPS dpcLineCaps
Definition: d3dcaps.h:325
DWORD dwMaxTextureHeight
Definition: d3dcaps.h:333
WORD wMaxTextureBlendStages
Definition: d3dcaps.h:350
D3DVALUE dvExtentsAdjust
Definition: d3dcaps.h:346
D3DCOLORMODEL dcmColorModel
Definition: d3dcaps.h:320
DWORD dwMaxAnisotropy
Definition: d3dcaps.h:341
DWORD dwMinStippleWidth
Definition: d3dcaps.h:334
DWORD dwMinStippleHeight
Definition: d3dcaps.h:335
DWORD dwTextureOpCaps
Definition: d3dcaps.h:349
DWORD dwMinTextureWidth
Definition: d3dcaps.h:332
D3DVALUE dvGuardBandBottom
Definition: d3dcaps.h:345
D3DVALUE dvGuardBandLeft
Definition: d3dcaps.h:342
DWORD dwMinTextureHeight
Definition: d3dcaps.h:332
WORD wMaxSimultaneousTextures
Definition: d3dcaps.h:351
DWORD dwFVFCaps
Definition: d3dcaps.h:348
D3DLIGHTINGCAPS dlcLightingCaps
Definition: d3dcaps.h:324
DWORD dwNumLights
Definition: d3dcaps.h:259
DWORD dwLightingModel
Definition: d3dcaps.h:258

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

◆ DDRAW_dump_cooperativelevel()

void DDRAW_dump_cooperativelevel ( DWORD  cooplevel)

Definition at line 960 of file utils.c.

961{
962 static const struct flag_info flags[] =
963 {
973 };
974
975 if (TRACE_ON(ddraw))
976 {
977 TRACE(" - ");
979 }
980}
#define FE(x)
static void DDRAW_dump_flags(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:704
GLbitfield flags
Definition: glext.h:7161
#define DDSCL_SETDEVICEWINDOW
Definition: ddraw.h:541
#define DDSCL_SETFOCUSWINDOW
Definition: ddraw.h:540
#define DDSCL_NORMAL
Definition: ddraw.h:537
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:538
#define DDSCL_ALLOWREBOOT
Definition: ddraw.h:535
#define DDSCL_CREATEDEVICEWINDOW
Definition: ddraw.h:542
#define DDSCL_NOWINDOWCHANGES
Definition: ddraw.h:536
#define DDSCL_ALLOWMODEX
Definition: ddraw.h:539
#define DDSCL_FULLSCREEN
Definition: ddraw.h:534

Referenced by ddraw_set_cooperative_level().

◆ DDRAW_dump_DDCAPS()

void DDRAW_dump_DDCAPS ( const DDCAPS *  lpcaps)

Definition at line 982 of file utils.c.

983{
984 static const struct flag_info flags1[] =
985 {
986 FE(DDCAPS_3D),
992 FE(DDCAPS_BLT),
996 FE(DDCAPS_GDI),
1005 FE(DDCAPS_VBI),
1018 };
1019 static const struct flag_info flags2[] =
1020 {
1046 };
1047 static const struct flag_info flags3[] =
1048 {
1068 };
1069 static const struct flag_info flags4[] =
1070 {
1099 };
1100 static const struct flag_info flags5[] =
1101 {
1112 };
1113 static const struct flag_info flags6[] =
1114 {
1126 };
1127 static const struct flag_info flags7[] =
1128 {
1134 };
1135
1136 TRACE(" - dwSize : %lu\n", lpcaps->dwSize);
1137 TRACE(" - dwCaps : "); DDRAW_dump_flags(lpcaps->dwCaps, flags1, ARRAY_SIZE(flags1));
1138 TRACE(" - dwCaps2 : "); DDRAW_dump_flags(lpcaps->dwCaps2, flags2, ARRAY_SIZE(flags2));
1139 TRACE(" - dwCKeyCaps : "); DDRAW_dump_flags(lpcaps->dwCKeyCaps, flags3, ARRAY_SIZE(flags3));
1140 TRACE(" - dwFXCaps : "); DDRAW_dump_flags(lpcaps->dwFXCaps, flags4, ARRAY_SIZE(flags4));
1141 TRACE(" - dwFXAlphaCaps : "); DDRAW_dump_flags(lpcaps->dwFXAlphaCaps, flags5, ARRAY_SIZE(flags5));
1142 TRACE(" - dwPalCaps : "); DDRAW_dump_flags(lpcaps->dwPalCaps, flags6, ARRAY_SIZE(flags6));
1143 TRACE(" - dwSVCaps : "); DDRAW_dump_flags(lpcaps->dwSVCaps, flags7, ARRAY_SIZE(flags7));
1144 TRACE("...\n");
1145 TRACE(" - dwNumFourCCCodes : %lu\n", lpcaps->dwNumFourCCCodes);
1146 TRACE(" - dwCurrVisibleOverlays : %lu\n", lpcaps->dwCurrVisibleOverlays);
1147 TRACE(" - dwMinOverlayStretch : %lu\n", lpcaps->dwMinOverlayStretch);
1148 TRACE(" - dwMaxOverlayStretch : %lu\n", lpcaps->dwMaxOverlayStretch);
1149 TRACE("...\n");
1150 TRACE(" - ddsCaps : "); DDRAW_dump_DDSCAPS2(&lpcaps->ddsCaps);
1151}
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
Definition: utils.c:710
#define DDSVCAPS_RESERVED4
Definition: ddraw.h:442
#define DDFXCAPS_OVERLAYSHRINKXN
Definition: ddraw.h:425
#define DDCKEYCAPS_DESTBLTCLRSPACEYUV
Definition: ddraw.h:485
#define DDPCAPS_PRIMARYSURFACE
Definition: ddraw.h:458
#define DDCKEYCAPS_SRCBLTCLRSPACEYUV
Definition: ddraw.h:494
#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL
Definition: ddraw.h:388
#define DDCAPS_OVERLAYSTRETCH
Definition: ddraw.h:345
#define DDFXALPHACAPS_BLTALPHASURFACES
Definition: ddraw.h:397
#define DDCAPS_3D
Definition: ddraw.h:331
#define DDFXALPHACAPS_BLTALPHAPIXELS
Definition: ddraw.h:395
#define DDFXCAPS_BLTSHRINKYN
Definition: ddraw.h:418
#define DDCAPS_BLT
Definition: ddraw.h:337
#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG
Definition: ddraw.h:403
#define DDCAPS_ALIGNBOUNDARYSRC
Definition: ddraw.h:334
#define DDCAPS2_CANDROPZ16BIT
Definition: ddraw.h:372
#define DDCAPS_BLTDEPTHFILL
Definition: ddraw.h:359
#define DDCAPS2_FLIPINTERVAL
Definition: ddraw.h:383
#define DDCKEYCAPS_DESTBLT
Definition: ddraw.h:483
#define DDCKEYCAPS_SRCOVERLAYYUV
Definition: ddraw.h:500
#define DDCKEYCAPS_SRCBLTYUV
Definition: ddraw.h:495
#define DDSVCAPS_RESERVED3
Definition: ddraw.h:441
#define DDFXCAPS_BLTSHRINKX
Definition: ddraw.h:415
#define DDCAPS_ALIGNBOUNDARYDEST
Definition: ddraw.h:332
#define DDCAPS2_FLIPNOVSYNC
Definition: ddraw.h:384
#define DDCAPS_PALETTE
Definition: ddraw.h:346
#define DDPCAPS_VSYNC
Definition: ddraw.h:461
#define DDCAPS_OVERLAY
Definition: ddraw.h:342
#define DDFXALPHACAPS_OVERLAYALPHAPIXELS
Definition: ddraw.h:400
#define DDCAPS2_PRIMARYGAMMA
Definition: ddraw.h:380
#define DDCKEYCAPS_DESTOVERLAY
Definition: ddraw.h:487
#define DDCAPS_BLTQUEUE
Definition: ddraw.h:338
#define DDCAPS2_COLORCONTROLOVERLAY
Definition: ddraw.h:370
#define DDFXCAPS_OVERLAYARITHSTRETCHY
Definition: ddraw.h:423
#define DDPCAPS_ALLOW256
Definition: ddraw.h:460
#define DDCAPS2_CANRENDERWINDOWED
Definition: ddraw.h:381
#define DDCAPS_STEREOVIEW
Definition: ddraw.h:65
#define DDSVCAPS_RESERVED1
Definition: ddraw.h:439
#define DDCKEYCAPS_DESTBLTCLRSPACE
Definition: ddraw.h:484
#define DDCAPS2_NONLOCALVIDMEM
Definition: ddraw.h:373
#define DDCKEYCAPS_SRCOVERLAY
Definition: ddraw.h:496
#define DDPCAPS_8BITENTRIES
Definition: ddraw.h:456
#define DDFXCAPS_BLTSTRETCHYN
Definition: ddraw.h:422
#define DDFXCAPS_BLTMIRRORLEFTRIGHT
Definition: ddraw.h:411
#define DDFXCAPS_OVERLAYARITHSTRETCHYN
Definition: ddraw.h:408
#define DDCAPS_ALPHA
Definition: ddraw.h:354
#define DDCAPS_CANBLTSYSMEM
Definition: ddraw.h:362
#define DDCAPS_READSCANLINE
Definition: ddraw.h:348
#define DDFXCAPS_BLTMIRRORUPDOWN
Definition: ddraw.h:412
#define DDFXCAPS_OVERLAYSTRETCHXN
Definition: ddraw.h:429
#define DDCAPS2_CERTIFIED
Definition: ddraw.h:364
#define DDSVCAPS_STEREOSEQUENTIAL
Definition: ddraw.h:452
#define DDCAPS_OVERLAYFOURCC
Definition: ddraw.h:344
#define DDCAPS2_COLORCONTROLPRIMARY
Definition: ddraw.h:371
#define DDCKEYCAPS_DESTOVERLAYCLRSPACE
Definition: ddraw.h:488
#define DDCAPS2_NONLOCALVIDMEMCAPS
Definition: ddraw.h:374
#define DDCAPS_BLTSTRETCH
Definition: ddraw.h:340
#define DDFXCAPS_OVERLAYSHRINKX
Definition: ddraw.h:424
#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV
Definition: ddraw.h:498
#define DDFXCAPS_BLTSTRETCHXN
Definition: ddraw.h:420
#define DDFXALPHACAPS_OVERLAYALPHASURFACES
Definition: ddraw.h:402
#define DDCAPS_ALIGNSIZESRC
Definition: ddraw.h:335
#define DDCKEYCAPS_SRCBLT
Definition: ddraw.h:492
#define DDFXCAPS_BLTSTRETCHY
Definition: ddraw.h:421
#define DDCKEYCAPS_SRCOVERLAYONEACTIVE
Definition: ddraw.h:499
#define DDCAPS_OVERLAYCANTCLIP
Definition: ddraw.h:343
#define DDCAPS_CANCLIPSTRETCHED
Definition: ddraw.h:361
#define DDCAPS_ZBLTS
Definition: ddraw.h:351
#define DDFXCAPS_BLTARITHSTRETCHY
Definition: ddraw.h:409
#define DDCAPS2_CANBOBINTERLEAVED
Definition: ddraw.h:368
#define DDFXCAPS_BLTARITHSTRETCHYN
Definition: ddraw.h:410
#define DDCAPS_BANKSWITCHED
Definition: ddraw.h:358
#define DDPCAPS_1BIT
Definition: ddraw.h:462
#define DDCAPS2_CANBOBNONINTERLEAVED
Definition: ddraw.h:369
#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND
Definition: ddraw.h:399
#define DDCAPS_GDI
Definition: ddraw.h:341
#define DDFXCAPS_BLTSHRINKXN
Definition: ddraw.h:416
#define DDCAPS_VBI
Definition: ddraw.h:350
#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG
Definition: ddraw.h:401
#define DDCAPS2_CANCALIBRATEGAMMA
Definition: ddraw.h:382
#define DDCKEYCAPS_DESTOVERLAYONEACTIVE
Definition: ddraw.h:490
#define DDCAPS_CANCLIP
Definition: ddraw.h:360
#define DDPCAPS_2BIT
Definition: ddraw.h:463
#define DDCAPS_BLTCOLORFILL
Definition: ddraw.h:357
#define DDSVCAPS_RESERVED2
Definition: ddraw.h:440
#define DDFXCAPS_OVERLAYMIRRORUPDOWN
Definition: ddraw.h:433
#define DDCAPS2_WIDESURFACES
Definition: ddraw.h:376
#define DDCAPS2_COPYFOURCC
Definition: ddraw.h:379
#define DDFXCAPS_BLTSTRETCHX
Definition: ddraw.h:419
#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT
Definition: ddraw.h:432
#define DDCAPS_ALIGNSTRIDE
Definition: ddraw.h:336
#define DDPCAPS_8BIT
Definition: ddraw.h:457
#define DDFXALPHACAPS_BLTALPHAEDGEBLEND
Definition: ddraw.h:394
#define DDCKEYCAPS_DESTBLTYUV
Definition: ddraw.h:486
#define DDCAPS2_AUTOFLIPOVERLAY
Definition: ddraw.h:367
#define DDFXCAPS_OVERLAYSTRETCHY
Definition: ddraw.h:430
#define DDFXCAPS_BLTROTATION90
Definition: ddraw.h:414
#define DDFXCAPS_OVERLAYALPHA
Definition: ddraw.h:407
#define DDCAPS_COLORKEY
Definition: ddraw.h:353
#define DDFXCAPS_OVERLAYSTRETCHX
Definition: ddraw.h:428
#define DDCAPS2_CANFLIPODDEVEN
Definition: ddraw.h:377
#define DDCAPS_NOHARDWARE
Definition: ddraw.h:356
#define DDCAPS_BLTFOURCC
Definition: ddraw.h:339
#define DDPCAPS_PRIMARYSURFACELEFT
Definition: ddraw.h:459
#define DDCKEYCAPS_DESTOVERLAYYUV
Definition: ddraw.h:491
#define DDPCAPS_ALPHA
Definition: ddraw.h:464
#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV
Definition: ddraw.h:489
#define DDCAPS2_STEREO
Definition: ddraw.h:387
#define DDFXCAPS_OVERLAYSTRETCHYN
Definition: ddraw.h:431
#define DDCKEYCAPS_SRCOVERLAYCLRSPACE
Definition: ddraw.h:497
#define DDCAPS_ALIGNSIZEDEST
Definition: ddraw.h:333
#define DDFXALPHACAPS_BLTALPHAPIXELSNEG
Definition: ddraw.h:396
#define DDFXCAPS_BLTROTATION
Definition: ddraw.h:413
#define DDFXALPHACAPS_BLTALPHASURFACESNEG
Definition: ddraw.h:398
#define DDCKEYCAPS_SRCBLTCLRSPACE
Definition: ddraw.h:493
#define DDCAPS2_TEXMANINNONLOCALVIDMEM
Definition: ddraw.h:386
#define DDCAPS2_NOPAGELOCKREQUIRED
Definition: ddraw.h:375
#define DDFXCAPS_OVERLAYSHRINKYN
Definition: ddraw.h:427
#define DDCAPS2_CANBOBHARDWARE
Definition: ddraw.h:378
#define DDCAPS2_CANMANAGETEXTURE
Definition: ddraw.h:385
#define DDFXCAPS_BLTSHRINKY
Definition: ddraw.h:417
#define DDPCAPS_INITIALIZE
Definition: ddraw.h:454
#define DDCKEYCAPS_NOCOSTOVERLAY
Definition: ddraw.h:501
#define DDFXCAPS_OVERLAYSHRINKY
Definition: ddraw.h:426
#define DDCAPS_ZOVERLAYS
Definition: ddraw.h:352
#define DDCAPS_COLORKEYHWASSIST
Definition: ddraw.h:355
#define DDCAPS2_VIDEOPORT
Definition: ddraw.h:366
#define DDCAPS2_NO2DDURING3DSCENE
Definition: ddraw.h:365
#define DDCAPS_PALETTEVSYNC
Definition: ddraw.h:347
#define DDPCAPS_4BIT
Definition: ddraw.h:455
#define DDFXCAPS_BLTALPHA
Definition: ddraw.h:406

Referenced by ddraw7_GetCaps().

◆ DDRAW_dump_DDSCAPS2()

void DDRAW_dump_DDSCAPS2 ( const DDSCAPS2 *  in)

Definition at line 710 of file utils.c.

711{
712 static const struct flag_info flags[] =
713 {
744 };
745 static const struct flag_info flags2[] =
746 {
766 };
767
769 DDRAW_dump_flags(in->dwCaps2, flags2, ARRAY_SIZE(flags2));
770}
#define DDSCAPS_PALETTE
Definition: surface.c:97
#define DDSCAPS_ALPHA
Definition: surface.c:95
static void DDRAW_dump_flags_nolf(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:694
#define DDSCAPS2_CUBEMAP
Definition: ddsformat.c:64
GLuint in
Definition: glext.h:9616
#define DDSCAPS_MODEX
Definition: ddraw.h:273
#define DDSCAPS2_CUBEMAP_NEGATIVEZ
Definition: ddraw.h:298
#define DDSCAPS_FRONTBUFFER
Definition: ddraw.h:256
#define DDSCAPS_ALLOCONLOAD
Definition: ddraw.h:276
#define DDSCAPS2_OPAQUE
Definition: ddraw.h:290
#define DDSCAPS_OVERLAY
Definition: ddraw.h:258
#define DDSCAPS_VISIBLE
Definition: ddraw.h:267
#define DDSCAPS2_HARDWAREDEINTERLACE
Definition: ddraw.h:283
#define DDSCAPS2_RESERVED1
Definition: ddraw.h:288
#define DDSCAPS_HWCODEC
Definition: ddraw.h:272
#define DDSCAPS_RESERVED2
Definition: ddraw.h:275
#define DDSCAPS2_CUBEMAP_POSITIVEX
Definition: ddraw.h:293
#define DDSCAPS_MIPMAP
Definition: ddraw.h:274
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:260
#define DDSCAPS_WRITEONLY
Definition: ddraw.h:268
#define DDSCAPS_OPTIMIZED
Definition: ddraw.h:281
#define DDSCAPS_NONLOCALVIDMEM
Definition: ddraw.h:279
#define DDSCAPS_RESERVED1
Definition: ddraw.h:251
#define DDSCAPS2_MIPMAPSUBLEVEL
Definition: ddraw.h:306
#define DDSCAPS_LIVEVIDEO
Definition: ddraw.h:271
#define DDSCAPS2_D3DTEXTUREMANAGE
Definition: ddraw.h:307
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:257
#define DDSCAPS2_RESERVED2
Definition: ddraw.h:289
#define DDSCAPS_PRIMARYSURFACELEFT
Definition: ddraw.h:262
#define DDSCAPS_FLIP
Definition: ddraw.h:255
#define DDSCAPS2_HINTDYNAMIC
Definition: ddraw.h:285
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:253
#define DDSCAPS2_CUBEMAP_NEGATIVEY
Definition: ddraw.h:296
#define DDSCAPS2_CUBEMAP_POSITIVEY
Definition: ddraw.h:295
#define DDSCAPS2_CUBEMAP_NEGATIVEX
Definition: ddraw.h:294
#define DDSCAPS2_TEXTUREMANAGE
Definition: ddraw.h:287
#define DDSCAPS2_HINTANTIALIASING
Definition: ddraw.h:291
#define DDSCAPS2_CUBEMAP_POSITIVEZ
Definition: ddraw.h:297
#define DDSCAPS_TEXTURE
Definition: ddraw.h:264
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:266
#define DDSCAPS_LOCALVIDMEM
Definition: ddraw.h:278
#define DDSCAPS_OWNDC
Definition: ddraw.h:270
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:263
#define DDSCAPS2_HINTSTATIC
Definition: ddraw.h:286
#define DDSCAPS_VIDEOPORT
Definition: ddraw.h:277
#define DDSCAPS_STANDARDVGAMODE
Definition: ddraw.h:280
#define DDSCAPS2_STEREOSURFACELEFT
Definition: ddraw.h:309
#define DDSCAPS2_DONOTPERSIST
Definition: ddraw.h:308
#define DDSCAPS_COMPLEX
Definition: ddraw.h:254

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 857 of file utils.c.

858{
859#define STRUCT DDSURFACEDESC2
860 static const struct member_info members[] =
861 {
862 ME(DDSD_HEIGHT, DDRAW_dump_DWORD, dwHeight),
863 ME(DDSD_WIDTH, DDRAW_dump_DWORD, dwWidth),
870 ME(DDSD_LPSURFACE, DDRAW_dump_PTR, lpSurface),
872 ME(DDSD_CKDESTBLT, DDRAW_dump_DDCOLORKEY, ddckCKDestBlt),
873 ME(DDSD_CKSRCOVERLAY, DDRAW_dump_DDCOLORKEY, ddckCKSrcOverlay),
874 ME(DDSD_CKSRCBLT, DDRAW_dump_DDCOLORKEY, ddckCKSrcBlt),
876 };
877 static const struct member_info members_caps[] =
878 {
880 };
881 static const struct member_info members_caps2[] =
882 {
884 };
885#undef STRUCT
886
887 if (NULL == lpddsd)
888 {
889 TRACE("(null)\n");
890 }
891 else
892 {
893 if (lpddsd->dwSize >= sizeof(DDSURFACEDESC2))
894 {
895 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps2, 1);
896 }
897 else
898 {
899 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps, 1);
900 }
901 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members, ARRAY_SIZE(members));
902 }
903}
#define ME(x, f, e)
#define DDSD_LPSURFACE
Definition: ddrawex.h:22
static void DDRAW_dump_members(DWORD flags, const void *data, const struct member_info *mems, size_t num_mems)
Definition: utils.c:809
static void DDRAW_dump_PTR(const void *in)
Definition: utils.c:684
static void DDRAW_dump_DDSCAPS(const DDSCAPS *in)
Definition: utils.c:773
static void DDRAW_dump_DDCOLORKEY(const DDCOLORKEY *ddck)
Definition: utils.c:689
static void DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf)
Definition: utils.c:824
static void DDRAW_dump_DWORD(const void *in)
Definition: utils.c:679
#define DDSD_WIDTH
Definition: ddraw.h:212
#define DDSD_PIXELFORMAT
Definition: ddraw.h:218
DWORD dwAlphaBitDepth
Definition: ddraw.h:3
#define DDSD_PITCH
Definition: ddraw.h:213
#define DDSD_REFRESHRATE
Definition: ddraw.h:224
#define DDSD_MIPMAPCOUNT
Definition: ddraw.h:223
DWORD dwRefreshRate
Definition: ddraw.h:2
#define DDSD_ALPHABITDEPTH
Definition: ddraw.h:216
#define DDSD_HEIGHT
Definition: ddraw.h:211
DDPIXELFORMAT ddpfPixelFormat
Definition: ddraw.h:0
#define DDSD_CKDESTOVERLAY
Definition: ddraw.h:219
LONG lPitch
Definition: ddraw.h:0
DDCOLORKEY ddckCKDestOverlay
Definition: ddraw.h:0
DWORD dwBackBufferCount
Definition: ddraw.h:0
DWORD dwMipMapCount
Definition: ddraw.h:0
#define DDSD_CKSRCBLT
Definition: ddraw.h:222
#define DDSD_LINEARSIZE
Definition: ddraw.h:225
DWORD dwLinearSize
Definition: ddraw.h:1
#define DDSD_CAPS
Definition: ddraw.h:210
#define DDSD_CKDESTBLT
Definition: ddraw.h:220
#define DDSD_BACKBUFFERCOUNT
Definition: ddraw.h:214
#define DDSD_CKSRCOVERLAY
Definition: ddraw.h:221
DWORD dwFlags
Definition: ddraw.h:1155
DWORD dwSize
Definition: ddraw.h:1154

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

4918{
4919 struct wined3d_vertex_declaration *pDecl = NULL;
4920 HRESULT hr;
4921 int p, low, high; /* deliberately signed */
4922 struct FvfToDecl *convertedDecls = This->decls;
4923
4924 TRACE("Searching for declaration for fvf %08lx... ", fvf);
4925
4926 low = 0;
4927 high = This->numConvertedDecls - 1;
4928 while(low <= high) {
4929 p = (low + high) >> 1;
4930 TRACE("%d ", p);
4931 if(convertedDecls[p].fvf == fvf) {
4932 TRACE("found %p\n", convertedDecls[p].decl);
4933 return convertedDecls[p].decl;
4934 } else if(convertedDecls[p].fvf < fvf) {
4935 low = p + 1;
4936 } else {
4937 high = p - 1;
4938 }
4939 }
4940 TRACE("not found. Creating and inserting at position %d.\n", low);
4941
4944 if (hr != S_OK) return NULL;
4945
4946 if (This->declArraySize == This->numConvertedDecls)
4947 {
4948 unsigned int grow = max(This->declArraySize / 2, 8);
4949
4950 if (!(convertedDecls = realloc(convertedDecls,
4951 (This->numConvertedDecls + grow) * sizeof(*convertedDecls))))
4952 {
4954 return NULL;
4955 }
4956 This->decls = convertedDecls;
4957 This->declArraySize += grow;
4958 }
4959
4960 memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low));
4961 convertedDecls[low].decl = pDecl;
4962 convertedDecls[low].fvf = fvf;
4963 This->numConvertedDecls++;
4964
4965 TRACE("Returning %p. %d decls in array\n", pDecl, This->numConvertedDecls);
4966 return pDecl;
4967}
#define S_OK
Definition: intsafe.h:52
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
struct wined3d_vertex_declaration * decl
Definition: ddraw_private.h:50
DWORD fvf
Definition: d3d8_private.h:96
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
HRESULT CDECL wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *device, uint32_t fvf, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration)

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

◆ ddraw_free_handle()

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

Definition at line 184 of file main.c.

185{
187 void *object;
188
189 if (!t)
191
192 if (handle == DDRAW_INVALID_HANDLE || handle >= t->entry_count)
193 {
194 WARN("Invalid handle %#lx passed.\n", handle);
195 return NULL;
196 }
197
198 entry = &t->entries[handle];
199 if (entry->type != type)
200 {
201 WARN("Handle %#lx (%p) is not of type %#x.\n", handle, entry->object, type);
202 return NULL;
203 }
204
205 object = entry->object;
206 entry->object = t->free_entries;
207 entry->type = DDRAW_HANDLE_FREE;
208 t->free_entries = entry;
209
210 return object;
211}

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

1288{
1290 HRESULT hr;
1291
1292 TRACE("ddraw %p, caps %p.\n", ddraw, caps);
1293
1294 memset(&wined3d_caps, 0, sizeof(wined3d_caps));
1295
1299 if (FAILED(hr))
1300 {
1301 WARN("Failed to get device caps, hr %#lx.\n", hr);
1302 return hr;
1303 }
1304
1316
1319
1324
1329
1332
1335
1338
1339 /* Remove all non-d3d7 caps */
1340 caps->dwDevCaps &= (
1348
1349 caps->dwStencilCaps &= (
1353
1354 /* FVF caps ?*/
1355
1356 caps->dwTextureOpCaps &= (
1365
1366 caps->dwVertexProcessingCaps &= (
1369
1370 caps->dpcLineCaps.dwMiscCaps &= (
1374
1375 caps->dpcLineCaps.dwRasterCaps &= (
1389
1390 caps->dpcLineCaps.dwZCmpCaps &= (
1394
1395 caps->dpcLineCaps.dwSrcBlendCaps &= (
1401
1402 caps->dpcLineCaps.dwDestBlendCaps &= (
1408
1409 caps->dpcLineCaps.dwAlphaCmpCaps &= (
1413
1414 caps->dpcLineCaps.dwShadeCaps &= (
1422
1423 caps->dpcLineCaps.dwTextureCaps &= (
1428
1436
1440
1442 {
1443 /* DirectX7 always has the np2 flag set, no matter what the card
1444 * supports. Some old games (Rollcage) check the caps incorrectly.
1445 * If wined3d supports nonpow2 textures it also has np2 conditional
1446 * support. */
1448 }
1449
1450 /* Fill the missing members, and do some fixup */
1451 caps->dpcLineCaps.dwSize = sizeof(caps->dpcLineCaps);
1460 caps->dpcLineCaps.dwStippleWidth = 32;
1461 caps->dpcLineCaps.dwStippleHeight = 32;
1462 /* Use the same for the TriCaps */
1463 caps->dpcTriCaps = caps->dpcLineCaps;
1464
1467 caps->dwMinTextureWidth = 1;
1468 caps->dwMinTextureHeight = 1;
1469
1470 /* Convert DWORDs safely to WORDs */
1475
1476 caps->deviceGUID = IID_IDirect3DTnLHalDevice;
1477
1478 caps->dwReserved1 = 0;
1479 caps->dwReserved2 = 0;
1480 caps->dwReserved3 = 0;
1481 caps->dwReserved4 = 0;
1482
1483 return DD_OK;
1484}
#define D3DMAXUSERCLIPPLANES
Definition: d3d8types.h:75
#define D3DPCMPCAPS_EQUAL
Definition: d3d8caps.h:90
#define D3DPRASTERCAPS_ANTIALIASEDGES
Definition: d3d8caps.h:77
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
Definition: d3d8caps.h:171
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY
Definition: d3d8caps.h:36
#define D3DTEXOPCAPS_MODULATE2X
Definition: d3d8caps.h:156
#define D3DTEXOPCAPS_ADDSIGNED2X
Definition: d3d8caps.h:160
#define D3DPTADDRESSCAPS_MIRROR
Definition: d3d8caps.h:139
#define D3DPBLENDCAPS_SRCCOLOR
Definition: d3d8caps.h:98
#define D3DDEVCAPS_CANRENDERAFTERFLIP
Definition: d3d8caps.h:43
#define D3DTEXOPCAPS_SELECTARG1
Definition: d3d8caps.h:153
#define D3DVTXPCAPS_LOCALVIEWER
Definition: d3d8caps.h:185
#define D3DPTEXTURECAPS_PROJECTED
Definition: d3d8caps.h:120
#define D3DTEXOPCAPS_BLENDCURRENTALPHA
Definition: d3d8caps.h:167
#define D3DPRASTERCAPS_WBUFFER
Definition: d3d8caps.h:83
#define D3DPBLENDCAPS_DESTCOLOR
Definition: d3d8caps.h:104
#define D3DTEXOPCAPS_ADDSMOOTH
Definition: d3d8caps.h:162
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT
Definition: d3d8caps.h:48
#define D3DPTADDRESSCAPS_WRAP
Definition: d3d8caps.h:138
#define D3DPCMPCAPS_LESS
Definition: d3d8caps.h:89
#define D3DPMISCCAPS_CULLNONE
Definition: d3d8caps.h:58
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC
Definition: d3d8caps.h:136
#define D3DPTFILTERCAPS_MIPFLINEAR
Definition: d3d8caps.h:132
#define D3DPMISCCAPS_CULLCW
Definition: d3d8caps.h:59
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY
Definition: d3d8caps.h:41
#define D3DTEXOPCAPS_ADDSIGNED
Definition: d3d8caps.h:159
#define D3DDEVCAPS_DRAWPRIMITIVES2
Definition: d3d8caps.h:45
#define D3DPBLENDCAPS_INVSRCCOLOR
Definition: d3d8caps.h:99
#define D3DPBLENDCAPS_ZERO
Definition: d3d8caps.h:96
#define D3DSTENCILCAPS_DECR
Definition: d3d8caps.h:151
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM
Definition: d3d8caps.h:166
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY
Definition: d3d8caps.h:40
#define D3DPTFILTERCAPS_MINFANISOTROPIC
Definition: d3d8caps.h:130
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE
Definition: d3d8caps.h:117
#define D3DPBLENDCAPS_INVDESTCOLOR
Definition: d3d8caps.h:105
#define D3DTEXOPCAPS_SUBTRACT
Definition: d3d8caps.h:161
#define D3DPBLENDCAPS_INVDESTALPHA
Definition: d3d8caps.h:103
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
Definition: d3d8caps.h:170
#define D3DSTENCILCAPS_INVERT
Definition: d3d8caps.h:149
#define D3DVTXPCAPS_MATERIALSOURCE7
Definition: d3d8caps.h:182
#define D3DPTFILTERCAPS_MINFLINEAR
Definition: d3d8caps.h:129
#define D3DPTEXTURECAPS_SQUAREONLY
Definition: d3d8caps.h:116
#define D3DDEVCAPS_DRAWPRIMITIVES2EX
Definition: d3d8caps.h:47
#define D3DPTFILTERCAPS_MAGFANISOTROPIC
Definition: d3d8caps.h:135
#define D3DPTEXTURECAPS_ALPHAPALETTE
Definition: d3d8caps.h:118
#define D3DPSHADECAPS_COLORGOURAUDRGB
Definition: d3d8caps.h:109
#define D3DPRASTERCAPS_ZBUFFERLESSHSR
Definition: d3d8caps.h:80
#define D3DPBLENDCAPS_SRCALPHASAT
Definition: d3d8caps.h:106
#define D3DPBLENDCAPS_BOTHSRCALPHA
Definition: d3d8caps.h:107
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY
Definition: d3d8caps.h:37
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE
Definition: d3d8caps.h:174
#define D3DPRASTERCAPS_WFOG
Definition: d3d8caps.h:84
#define D3DPTADDRESSCAPS_BORDER
Definition: d3d8caps.h:141
#define D3DPTADDRESSCAPS_INDEPENDENTUV
Definition: d3d8caps.h:142
#define D3DPSHADECAPS_FOGGOURAUD
Definition: d3d8caps.h:112
#define D3DPTEXTURECAPS_ALPHA
Definition: d3d8caps.h:115
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES
Definition: d3d8caps.h:46
#define D3DTEXOPCAPS_DISABLE
Definition: d3d8caps.h:152
#define D3DPSHADECAPS_SPECULARGOURAUDRGB
Definition: d3d8caps.h:110
#define D3DPMISCCAPS_CULLCCW
Definition: d3d8caps.h:60
#define D3DTEXOPCAPS_SELECTARG2
Definition: d3d8caps.h:154
#define D3DPMISCCAPS_LINEPATTERNREP
Definition: d3d8caps.h:57
#define D3DPCMPCAPS_NOTEQUAL
Definition: d3d8caps.h:93
#define D3DSTENCILCAPS_DECRSAT
Definition: d3d8caps.h:148
#define D3DDEVCAPS_DRAWPRIMTLVERTEX
Definition: d3d8caps.h:42
#define D3DPRASTERCAPS_ANISOTROPY
Definition: d3d8caps.h:82
#define D3DVTXPCAPS_DIRECTIONALLIGHTS
Definition: d3d8caps.h:183
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY
Definition: d3d8caps.h:38
#define D3DPBLENDCAPS_INVSRCALPHA
Definition: d3d8caps.h:101
#define D3DSTENCILCAPS_ZERO
Definition: d3d8caps.h:145
#define D3DPRASTERCAPS_ZFOG
Definition: d3d8caps.h:85
#define D3DPCMPCAPS_GREATER
Definition: d3d8caps.h:92
#define D3DPBLENDCAPS_DESTALPHA
Definition: d3d8caps.h:102
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA
Definition: d3d8caps.h:164
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC
Definition: d3d8caps.h:137
#define D3DSTENCILCAPS_INCR
Definition: d3d8caps.h:150
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL
Definition: d3d8caps.h:119
#define D3DTEXOPCAPS_MODULATE
Definition: d3d8caps.h:155
#define D3DPRASTERCAPS_PAT
Definition: d3d8caps.h:73
#define D3DTEXOPCAPS_BUMPENVMAP
Definition: d3d8caps.h:173
#define D3DPCMPCAPS_ALWAYS
Definition: d3d8caps.h:95
#define D3DPRASTERCAPS_FOGRANGE
Definition: d3d8caps.h:81
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND
Definition: d3d8caps.h:111
#define D3DPTEXTURECAPS_PERSPECTIVE
Definition: d3d8caps.h:113
#define D3DPBLENDCAPS_SRCALPHA
Definition: d3d8caps.h:100
#define D3DDEVCAPS_HWRASTERIZATION
Definition: d3d8caps.h:50
#define D3DPBLENDCAPS_ONE
Definition: d3d8caps.h:97
#define D3DTEXOPCAPS_PREMODULATE
Definition: d3d8caps.h:168
#define D3DPRASTERCAPS_FOGVERTEX
Definition: d3d8caps.h:75
#define D3DTEXOPCAPS_BLENDFACTORALPHA
Definition: d3d8caps.h:165
#define D3DSTENCILCAPS_INCRSAT
Definition: d3d8caps.h:147
#define D3DPCMPCAPS_LESSEQUAL
Definition: d3d8caps.h:91
#define D3DPTFILTERCAPS_MAGFLINEAR
Definition: d3d8caps.h:134
#define D3DPTADDRESSCAPS_CLAMP
Definition: d3d8caps.h:140
#define D3DPTFILTERCAPS_MINFPOINT
Definition: d3d8caps.h:128
#define D3DPTEXTURECAPS_CUBEMAP
Definition: d3d8caps.h:121
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM
Definition: d3d8caps.h:44
#define D3DVTXPCAPS_TEXGEN
Definition: d3d8caps.h:181
#define D3DTEXOPCAPS_DOTPRODUCT3
Definition: d3d8caps.h:175
#define D3DPBLENDCAPS_BOTHINVSRCALPHA
Definition: d3d8caps.h:108
#define D3DPCMPCAPS_NEVER
Definition: d3d8caps.h:88
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL
Definition: d3d8caps.h:49
#define D3DPRASTERCAPS_FOGTABLE
Definition: d3d8caps.h:76
#define D3DSTENCILCAPS_KEEP
Definition: d3d8caps.h:144
#define D3DPTFILTERCAPS_MIPFPOINT
Definition: d3d8caps.h:131
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY
Definition: d3d8caps.h:39
#define D3DPMISCCAPS_MASKZ
Definition: d3d8caps.h:56
#define D3DPCMPCAPS_GREATEREQUAL
Definition: d3d8caps.h:94
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
Definition: d3d8caps.h:169
#define D3DPRASTERCAPS_ZTEST
Definition: d3d8caps.h:74
#define D3DVTXPCAPS_POSITIONALLIGHTS
Definition: d3d8caps.h:184
#define D3DPRASTERCAPS_ZBIAS
Definition: d3d8caps.h:79
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA
Definition: d3d8caps.h:172
#define D3DPTEXTURECAPS_POW2
Definition: d3d8caps.h:114
#define D3DTEXOPCAPS_ADD
Definition: d3d8caps.h:158
#define D3DSTENCILCAPS_REPLACE
Definition: d3d8caps.h:146
#define D3DPTFILTERCAPS_MAGFPOINT
Definition: d3d8caps.h:133
#define D3DPRASTERCAPS_MIPMAPLODBIAS
Definition: d3d8caps.h:78
#define D3DTEXOPCAPS_MODULATE4X
Definition: d3d8caps.h:157
#define D3DPRASTERCAPS_DITHER
Definition: d3d8caps.h:72
#define D3DPTBLENDCAPS_COPY
Definition: d3dcaps.h:99
#define D3DPTBLENDCAPS_MODULATEALPHA
Definition: d3dcaps.h:96
#define D3DPRASTERCAPS_ROP2
Definition: d3dcaps.h:30
#define D3DPTFILTERCAPS_LINEAR
Definition: d3dcaps.h:88
#define D3DPSHADECAPS_SPECULARFLATMONO
Definition: d3dcaps.h:66
#define D3DPTFILTERCAPS_LINEARMIPNEAREST
Definition: d3dcaps.h:91
#define D3DPTBLENDCAPS_MODULATEMASK
Definition: d3dcaps.h:98
#define D3DDEVCAPS_FLOATTLVERTEX
Definition: d3dcaps.h:116
#define D3DPTBLENDCAPS_MODULATE
Definition: d3dcaps.h:94
#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT
Definition: d3dcaps.h:159
#define D3DPRASTERCAPS_STIPPLE
Definition: d3dcaps.h:38
#define D3DPTEXTURECAPS_BORDER
Definition: d3dcaps.h:85
#define D3DPTFILTERCAPS_NEAREST
Definition: d3dcaps.h:87
#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED
Definition: d3dcaps.h:75
#define D3DPTBLENDCAPS_DECALMASK
Definition: d3dcaps.h:97
#define D3DDEVCAPS_SORTDECREASINGZ
Definition: d3dcaps.h:118
#define D3DPTEXTURECAPS_TRANSPARENCY
Definition: d3dcaps.h:84
#define D3DPSHADECAPS_SPECULARGOURAUDMONO
Definition: d3dcaps.h:68
#define D3DPSHADECAPS_ALPHAPHONGBLEND
Definition: d3dcaps.h:76
#define D3DPSHADECAPS_COLORPHONGRGB
Definition: d3dcaps.h:65
#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED
Definition: d3dcaps.h:77
#define D3DPMISCCAPS_CONFORMANT
Definition: d3dcaps.h:25
#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT
Definition: d3dcaps.h:160
#define D3DPTFILTERCAPS_LINEARMIPLINEAR
Definition: d3dcaps.h:92
#define D3DDEVCAPS_SORTEXACT
Definition: d3dcaps.h:119
#define D3DPTFILTERCAPS_MIPNEAREST
Definition: d3dcaps.h:89
#define D3DPSHADECAPS_SPECULARFLATRGB
Definition: d3dcaps.h:67
#define D3DVTXPCAPS_VERTEXFOG
Definition: d3dcaps.h:242
#define D3DPTEXTURECAPS_COLORKEYBLEND
Definition: d3dcaps.h:236
#define D3DPTBLENDCAPS_ADD
Definition: d3dcaps.h:167
#define D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT
Definition: d3dcaps.h:177
#define D3DPSHADECAPS_COLORFLATMONO
Definition: d3dcaps.h:60
#define D3DPRASTERCAPS_SUBPIXELX
Definition: d3dcaps.h:35
#define D3DPSHADECAPS_ALPHAFLATBLEND
Definition: d3dcaps.h:72
#define D3DPTBLENDCAPS_DECALALPHA
Definition: d3dcaps.h:95
#define D3DPRASTERCAPS_XOR
Definition: d3dcaps.h:31
#define D3DPSHADECAPS_ALPHAFLATSTIPPLED
Definition: d3dcaps.h:73
#define D3DPMISCCAPS_MASKPLANES
Definition: d3dcaps.h:22
#define D3DPRASTERCAPS_SUBPIXEL
Definition: d3dcaps.h:34
#define D3DPSHADECAPS_FOGFLAT
Definition: d3dcaps.h:78
#define D3DPSHADECAPS_FOGPHONG
Definition: d3dcaps.h:80
#define D3DPSHADECAPS_COLORPHONGMONO
Definition: d3dcaps.h:64
#define D3DPSHADECAPS_COLORGOURAUDMONO
Definition: d3dcaps.h:62
#define D3DPSHADECAPS_SPECULARPHONGMONO
Definition: d3dcaps.h:70
#define D3DPSHADECAPS_SPECULARPHONGRGB
Definition: d3dcaps.h:71
#define D3DPSHADECAPS_COLORFLATRGB
Definition: d3dcaps.h:61
#define D3DPTBLENDCAPS_DECAL
Definition: d3dcaps.h:93
#define D3DDEVCAPS_SORTINCREASINGZ
Definition: d3dcaps.h:117
#define D3DPTFILTERCAPS_MIPLINEAR
Definition: d3dcaps.h:90
#define DDBD_24
Definition: ddraw.h:474
#define DDBD_32
Definition: ddraw.h:475
#define DDBD_16
Definition: ddraw.h:473
GUID deviceGUID
Definition: d3dcaps.h:382
WORD wMaxUserClipPlanes
Definition: d3dcaps.h:383
DWORD dwReserved2
Definition: d3dcaps.h:387
DWORD dwVertexProcessingCaps
Definition: d3dcaps.h:385
DWORD dwReserved4
Definition: d3dcaps.h:389
DWORD dwReserved1
Definition: d3dcaps.h:386
WORD wMaxVertexBlendMatrices
Definition: d3dcaps.h:384
DWORD dwReserved3
Definition: d3dcaps.h:388
D3DVALUE dvMaxVertexW
Definition: d3dcaps.h:381
DWORD dwAlphaCmpCaps
Definition: d3dcaps.h:58
DWORD dwZCmpCaps
Definition: d3dcaps.h:55
DWORD dwShadeCaps
Definition: d3dcaps.h:59
DWORD dwStippleWidth
Definition: d3dcaps.h:64
DWORD dwRasterCaps
Definition: d3dcaps.h:54
DWORD dwSrcBlendCaps
Definition: d3dcaps.h:56
DWORD dwTextureBlendCaps
Definition: d3dcaps.h:62
DWORD dwTextureFilterCaps
Definition: d3dcaps.h:61
DWORD dwSize
Definition: d3dcaps.h:52
DWORD dwStippleHeight
Definition: d3dcaps.h:65
DWORD dwTextureAddressCaps
Definition: d3dcaps.h:63
DWORD dwTextureCaps
Definition: d3dcaps.h:60
DWORD dwMiscCaps
Definition: d3dcaps.h:53
DWORD dwDestBlendCaps
Definition: d3dcaps.h:57
struct wined3d_adapter * wined3d_adapter
Definition: ddraw_private.h:97
DWORD MaxVertexBlendMatrices
Definition: wined3d.h:1967
DWORD MaxTextureBlendStages
Definition: wined3d.h:1961
float GuardBandTop
Definition: wined3d.h:1952
DWORD FVFCaps
Definition: wined3d.h:1959
DWORD PrimitiveMiscCaps
Definition: wined3d.h:1928
DWORD VertexProcessingCaps
Definition: wined3d.h:1964
DWORD TextureAddressCaps
Definition: wined3d.h:1939
DWORD TextureCaps
Definition: wined3d.h:1935
DWORD ShadeCaps
Definition: wined3d.h:1934
DWORD TextureOpCaps
Definition: wined3d.h:1960
DWORD MaxTextureRepeat
Definition: wined3d.h:1946
DWORD MaxAnisotropy
Definition: wined3d.h:1948
float ExtentsAdjust
Definition: wined3d.h:1956
float GuardBandLeft
Definition: wined3d.h:1951
DWORD DevCaps
Definition: wined3d.h:1927
DWORD ZCmpCaps
Definition: wined3d.h:1930
DWORD MaxTextureHeight
Definition: wined3d.h:1944
DWORD AlphaCmpCaps
Definition: wined3d.h:1933
DWORD DestBlendCaps
Definition: wined3d.h:1932
DWORD RasterCaps
Definition: wined3d.h:1929
float MaxVertexW
Definition: wined3d.h:1949
DWORD MaxTextureWidth
Definition: wined3d.h:1943
DWORD LineCaps
Definition: wined3d.h:1941
DWORD MaxUserClipPlanes
Definition: wined3d.h:1966
float GuardBandBottom
Definition: wined3d.h:1954
float GuardBandRight
Definition: wined3d.h:1953
DWORD MaxTextureAspectRatio
Definition: wined3d.h:1947
DWORD MaxSimultaneousTextures
Definition: wined3d.h:1962
DWORD MaxActiveLights
Definition: wined3d.h:1965
DWORD StencilCaps
Definition: wined3d.h:1957
DWORD SrcBlendCaps
Definition: wined3d.h:1931
DWORD TextureFilterCaps
Definition: wined3d.h:1936
HRESULT CDECL wined3d_get_device_caps(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, struct wined3d_caps *caps)
Definition: directx.c:2366
#define WINED3DLINECAPS_ANTIALIAS
Definition: wined3d.h:1073
#define WINED3DPRASTERCAPS_DEPTHBIAS
Definition: wined3d.h:1222
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:91

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

◆ ddraw_get_object()

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

Definition at line 213 of file main.c.

214{
216
217 if (!t)
219
220 if (handle == DDRAW_INVALID_HANDLE || handle >= t->entry_count)
221 {
222 WARN("Invalid handle %#lx passed.\n", handle);
223 return NULL;
224 }
225
226 entry = &t->entries[handle];
227 if (entry->type != type)
228 {
229 WARN("Handle %#lx (%p) is not of type %#x.\n", handle, entry->object, type);
230 return NULL;
231 }
232
233 return entry->object;
234}

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 132 of file main.c.

133{
134 free(t->entries);
135 memset(t, 0, sizeof(*t));
136}

Referenced by d3d_device_init(), d3d_device_inner_Release(), and DllMain().

◆ ddraw_handle_table_init()

BOOL ddraw_handle_table_init ( struct ddraw_handle_table *  t,
UINT  initial_size 
)

Definition at line 118 of file main.c.

119{
120 if (!(t->entries = calloc(initial_size, sizeof(*t->entries))))
121 {
122 ERR("Failed to allocate handle table memory.\n");
123 return FALSE;
124 }
125 t->free_entries = NULL;
126 t->table_size = initial_size;
127 t->entry_count = 0;
128
129 return TRUE;
130}

Referenced by d3d_device_init(), and DllMain().

◆ ddraw_init()

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

Definition at line 5079 of file ddraw.c.

5080{
5081 struct wined3d_caps caps;
5082 HRESULT hr;
5083
5084 static const enum wined3d_feature_level feature_levels[] =
5085 {
5089 };
5090
5095 ddraw->IDirect3D_iface.lpVtbl = &d3d1_vtbl;
5096 ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl;
5097 ddraw->IDirect3D3_iface.lpVtbl = &d3d3_vtbl;
5098 ddraw->IDirect3D7_iface.lpVtbl = &d3d7_vtbl;
5101 ddraw->numIfaces = 1;
5102 ddraw->ref7 = 1;
5103
5105 if (!(ddraw->wined3d = wined3d_create(flags)))
5106 {
5108 if (!(ddraw->wined3d = wined3d_create(flags)))
5109 {
5110 WARN("Failed to create a wined3d object.\n");
5111 return E_FAIL;
5112 }
5113 }
5114
5116 {
5117 WARN("Failed to get the default wined3d adapter.\n");
5119 return E_FAIL;
5120 }
5121
5123 {
5124 WARN("Failed to get the default wined3d output.\n");
5126 return E_FAIL;
5127 }
5128
5130 {
5131 ERR("Failed to get device caps, hr %#lx.\n", hr);
5133 return E_FAIL;
5134 }
5135
5136 if (!(caps.ddraw_caps.caps & WINEDDCAPS_3D))
5137 {
5138 WARN("Created a wined3d object without 3D support.\n");
5140 }
5141
5145 {
5146 WARN("Failed to create a wined3d device, hr %#lx.\n", hr);
5148 return hr;
5149 }
5151
5154 return DD_OK;
5155}
#define DDRAW_STRIDE_ALIGNMENT
Definition: ddraw_private.h:61
#define DDRAW_WINED3D_FLAGS
Definition: ddraw_private.h:63
#define E_FAIL
Definition: ddrawi.h:102
device_type
static const struct IDirect3D3Vtbl d3d3_vtbl
Definition: ddraw.c:4850
static const struct wined3d_swapchain_state_parent_ops ddraw_swapchain_state_parent_ops
Definition: ddraw.c:93
static const struct IDirect3D7Vtbl d3d7_vtbl
Definition: ddraw.c:4836
static const struct IDirect3D2Vtbl d3d2_vtbl
Definition: ddraw.c:4868
static const struct IDirectDraw2Vtbl ddraw2_vtbl
Definition: ddraw.c:4775
static const struct IDirectDraw7Vtbl ddraw7_vtbl
Definition: ddraw.c:4698
static const struct IDirect3DVtbl d3d1_vtbl
Definition: ddraw.c:4883
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops
Definition: ddraw.c:5071
static const struct IDirectDraw4Vtbl ddraw4_vtbl
Definition: ddraw.c:4738
static struct IDirectDrawVtbl ddraw1_vtbl
Definition: ddraw.c:4807
struct wined3d_device_context *CDECL wined3d_device_get_immediate_context(struct wined3d_device *device)
Definition: device.c:1969
static D3D_DRIVER_TYPE HMODULE UINT const D3D_FEATURE_LEVEL * feature_levels
Definition: hlsl_d3d11.c:28
struct wined3d_swapchain_state_parent state_parent
IDirectDraw2 IDirectDraw2_iface
Definition: ddraw_private.h:85
IDirect3D3 IDirect3D3_iface
Definition: ddraw_private.h:88
struct wined3d_device * wined3d_device
Definition: ddraw_private.h:99
IDirect3D IDirect3D_iface
Definition: ddraw_private.h:90
struct wined3d_device_context * immediate_context
LONG ref7
Definition: ddraw_private.h:94
struct list d3ddevice_list
struct list surface_list
IDirectDraw4 IDirectDraw4_iface
Definition: ddraw_private.h:84
LONG numIfaces
Definition: ddraw_private.h:94
IDirect3D7 IDirect3D7_iface
Definition: ddraw_private.h:87
struct wined3d_output * wined3d_output
Definition: ddraw_private.h:98
struct wined3d_device_parent device_parent
Definition: ddraw_private.h:91
IDirect3D2 IDirect3D2_iface
Definition: ddraw_private.h:89
struct wined3d * wined3d
Definition: ddraw_private.h:96
IDirectDraw IDirectDraw_iface
Definition: ddraw_private.h:86
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
Definition: directx.c:198
HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, struct wined3d_adapter *adapter, enum wined3d_device_type device_type, HWND focus_window, uint32_t flags, BYTE surface_alignment, const enum wined3d_feature_level *feature_levels, unsigned int feature_level_count, struct wined3d_device_parent *device_parent, struct wined3d_device **device)
Definition: directx.c:2777
struct wined3d_adapter *CDECL wined3d_get_adapter(const struct wined3d *wined3d, unsigned int idx)
Definition: directx.c:1009
struct wined3d_output *CDECL wined3d_adapter_get_output(const struct wined3d_adapter *adapter, unsigned int idx)
Definition: directx.c:1027
#define WINED3D_NO3D
Definition: wined3d.h:1323
#define WINED3DADAPTER_DEFAULT
Definition: wined3d.h:871
#define WINEDDCAPS_3D
Definition: wined3d.h:1500
wined3d_feature_level
Definition: wined3d.h:98
@ WINED3D_FEATURE_LEVEL_7
Definition: wined3d.h:102
@ WINED3D_FEATURE_LEVEL_6
Definition: wined3d.h:101
@ WINED3D_FEATURE_LEVEL_5
Definition: wined3d.h:100
struct wined3d *CDECL wined3d_create(uint32_t flags)
Definition: wined3d_main.c:142

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 256 of file palette.c.

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

Referenced by ddraw7_CreatePalette().

◆ ddraw_set_swapchain_window()

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

Definition at line 147 of file ddraw_private.h.

148{
149 if (window == GetDesktopWindow())
150 window = NULL;
152}
static IHTMLWindow2 * window
Definition: events.c:77
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
HWND swapchain_window

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

◆ ddraw_surface_can_be_lost()

static BOOL ddraw_surface_can_be_lost ( const struct ddraw_surface *  surface)
inlinestatic

Definition at line 650 of file ddraw_private.h.

651{
652 DWORD caps = surface->surface_desc.ddsCaps.dwCaps;
653
654 /* Testing with DDCREATE_EMULATIONONLY showed that primary surfaces and Z buffers can
655 * be lost even if created with explicit DDCAPS_SYSTEMMEMORY. Textures can or cannot be lost
656 * depending on whether _SYSTEMMEMORY was given explicitly by the application. */
658 return TRUE;
659
660 return surface->sysmem_fallback;
661}
DDSCAPS2 ddsCaps
Definition: ddraw.h:1190
DDSURFACEDESC2 surface_desc
unsigned int sysmem_fallback

Referenced by ddraw_surface7_Restore(), ddraw_surface_is_lost(), and ddraw_update_lost_surfaces().

◆ 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 6535 of file surface.c.

6537{
6538 DDPIXELFORMAT wined3d_display_mode_format;
6539 struct ddraw_surface *root, **attach;
6541 struct ddraw_texture *texture;
6542 BOOL sysmem_fallback = FALSE;
6543 unsigned int layers = 1;
6545 bool reserve_memory;
6546 UINT levels, i;
6547 HRESULT hr;
6548
6549 TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p, version %u.\n",
6550 ddraw, surface_desc, surface, outer_unknown, version);
6551 if (TRACE_ON(ddraw))
6552 {
6553 TRACE("Requesting surface desc:\n");
6555 }
6556
6557 if (outer_unknown)
6558 return CLASS_E_NOAGGREGATION;
6559
6560 if (!surface)
6561 return E_POINTER;
6562
6563 if (!(texture = malloc(sizeof(*texture))))
6564 return E_OUTOFMEMORY;
6565
6566 texture->texture_memory = NULL;
6567 texture->version = version;
6568 texture->surface_desc = *surface_desc;
6569 desc = &texture->surface_desc;
6570
6571 /* Ensure DDSD_CAPS is always set. */
6572 desc->dwFlags |= DDSD_CAPS;
6573
6574 if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX)
6575 && !(desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_MIPMAP))
6576 && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
6577 {
6578 WARN("DDSCAPS_COMPLEX specified for a surface which is neither flippable, mipmapped, nor a cubemap.\n");
6579 free(texture);
6580 return DDERR_INVALIDCAPS;
6581 }
6582
6583 if ((desc->dwFlags & DDSD_MIPMAPCOUNT) && !(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
6584 {
6585 /* This is illegal even if there is only one mipmap level. */
6586 WARN("DDSD_MIPMAPCOUNT specified without DDSCAPS_COMPLEX.\n");
6587 free(texture);
6588 return DDERR_INVALIDCAPS;
6589 }
6590
6591 if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
6592 {
6593 if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->dwBackBufferCount)
6594 {
6595 WARN("Tried to create a flippable surface without any back buffers.\n");
6596 free(texture);
6597 return DDERR_INVALIDCAPS;
6598 }
6599
6600 if (!(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
6601 {
6602 WARN("Tried to create a flippable surface without DDSCAPS_COMPLEX.\n");
6603 free(texture);
6604 return DDERR_INVALIDCAPS;
6605 }
6606
6607 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6608 {
6609 WARN("Tried to create a flippable cubemap.\n");
6610 free(texture);
6611 return DDERR_INVALIDPARAMS;
6612 }
6613
6614 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
6615 {
6616 FIXME("Flippable textures not implemented.\n");
6617 free(texture);
6618 return DDERR_INVALIDCAPS;
6619 }
6620 }
6621 else
6622 {
6623 if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
6624 {
6625 WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
6627 free(texture);
6628 return hr;
6629 }
6630 }
6631
6632 if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
6633 {
6634 if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
6635 {
6636 WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
6637 free(texture);
6638 return DDERR_INVALIDCAPS;
6639 }
6640
6641 if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) && !(desc->ddsCaps.dwCaps & DDSCAPS_FLIP))
6642 {
6643 WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
6644 free(texture);
6645 return DDERR_INVALIDCAPS;
6646 }
6647
6648 if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
6649 {
6650 WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
6651 free(texture);
6652 return DDERR_NOEXCLUSIVEMODE;
6653 }
6654 }
6655
6656 /* This is a special case in ddrawex, but not allowed in ddraw. */
6657 if ((desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
6659 {
6660 WARN("Tried to create a surface in both system and video memory.\n");
6661 free(texture);
6662 return DDERR_INVALIDCAPS;
6663 }
6664
6665 if ((desc->ddsCaps.dwCaps & (DDSCAPS_ALLOCONLOAD | DDSCAPS_MIPMAP))
6666 && !(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
6667 {
6668 WARN("Caps %#lx require DDSCAPS_TEXTURE.\n", desc->ddsCaps.dwCaps);
6669 free(texture);
6670 return DDERR_INVALIDCAPS;
6671 }
6672
6673 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES)
6674 && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
6675 {
6676 WARN("Cube map faces requested without cube map flag.\n");
6677 free(texture);
6678 return DDERR_INVALIDCAPS;
6679 }
6680
6681 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6682 && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES))
6683 {
6684 WARN("Cube map without faces requested.\n");
6685 free(texture);
6686 return DDERR_INVALIDPARAMS;
6687 }
6688
6689 if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6690 && (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) != DDSCAPS2_CUBEMAP_ALLFACES)
6691 FIXME("Partial cube maps not implemented.\n");
6692
6693 if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
6694 {
6695 if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
6696 {
6697 WARN("DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.\n");
6698 free(texture);
6699 return DDERR_INVALIDCAPS;
6700 }
6701 if (desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
6702 {
6703 WARN("DDSCAPS2_TEXTUREMANAGE used with DDSCAPS_VIDEOMEMORY "
6704 "or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.\n");
6705 free(texture);
6706 return DDERR_INVALIDCAPS;
6707 }
6708 }
6709
6710 if (desc->ddsCaps.dwCaps & DDSCAPS_WRITEONLY
6711 && !(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)))
6712 {
6713 WARN("DDSCAPS_WRITEONLY used without DDSCAPS2_TEXTUREMANAGE, returning DDERR_INVALIDCAPS.\n");
6714 free(texture);
6715 return DDERR_INVALIDCAPS;
6716 }
6717
6719 {
6720 ERR("Failed to get display mode, hr %#lx.\n", hr);
6721 free(texture);
6722 return hr_ddraw_from_wined3d(hr);
6723 }
6724
6725 wined3d_display_mode_format.dwSize = sizeof(wined3d_display_mode_format);
6726 ddrawformat_from_wined3dformat(&wined3d_display_mode_format, mode.format_id);
6727
6728 /* No pixelformat given? Use the current screen format. */
6729 if (!(desc->dwFlags & DDSD_PIXELFORMAT))
6730 {
6731 desc->dwFlags |= DDSD_PIXELFORMAT;
6732 desc->ddpfPixelFormat = wined3d_display_mode_format;
6733 }
6734
6735 /* No width or no height? Use the screen size. */
6736 if (!(desc->dwFlags & DDSD_WIDTH) || !(desc->dwFlags & DDSD_HEIGHT))
6737 {
6738 if (!(desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
6739 {
6740 WARN("No width / height specified.\n");
6741 free(texture);
6742 return DDERR_INVALIDPARAMS;
6743 }
6744
6745 desc->dwFlags |= DDSD_WIDTH | DDSD_HEIGHT;
6746 desc->dwWidth = mode.width;
6747 desc->dwHeight = mode.height;
6748 }
6749
6750 if (!desc->dwWidth || !desc->dwHeight)
6751 {
6752 free(texture);
6753 return DDERR_INVALIDPARAMS;
6754 }
6755
6756 if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
6757 desc->ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER;
6758
6759 if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
6760 {
6761 /* The first surface is a front buffer, the back buffers are created
6762 * afterwards. */
6763 desc->ddsCaps.dwCaps |= DDSCAPS_VISIBLE;
6765 {
6766 struct wined3d_swapchain_desc swapchain_desc;
6767
6769 swapchain_desc.backbuffer_width = mode.width;
6770 swapchain_desc.backbuffer_height = mode.height;
6771 swapchain_desc.backbuffer_format = mode.format_id;
6772
6774 &swapchain_desc, NULL, ddraw_reset_enum_callback, FALSE)))
6775 {
6776 ERR("Failed to reset device.\n");
6777 free(texture);
6778 return hr_ddraw_from_wined3d(hr);
6779 }
6780 }
6781 }
6782
6783 if ((desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && (ddraw->flags & DDRAW_NO3D))
6784 {
6785 WARN("The application requests a 3D capable surface, but the ddraw object was created without 3D support.\n");
6786 /* Do not fail surface creation, only fail 3D device creation. */
6787 }
6788
6789 /* Mipmap count fixes */
6790 if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP)
6791 {
6792 if (desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX)
6793 {
6794 if (desc->dwFlags & DDSD_MIPMAPCOUNT)
6795 {
6796 /* Mipmap count is given, should not be 0. */
6797 if (!desc->dwMipMapCount)
6798 {
6799 free(texture);
6800 return DDERR_INVALIDPARAMS;
6801 }
6802 }
6803 else
6804 {
6805 /* Undocumented feature: Create sublevels until either the
6806 * width or the height is 1. */
6807 if (version == 7)
6808 desc->dwMipMapCount = wined3d_log2i(max(desc->dwWidth, desc->dwHeight)) + 1;
6809 else
6810 desc->dwMipMapCount = wined3d_log2i(min(desc->dwWidth, desc->dwHeight)) + 1;
6811 }
6812 }
6813 else
6814 {
6815 desc->dwMipMapCount = 1;
6816 }
6817
6818 desc->dwFlags |= DDSD_MIPMAPCOUNT;
6819 levels = desc->dwMipMapCount;
6820 }
6821 else
6822 {
6823 levels = 1;
6824 }
6825
6826 if (!(desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY)))
6827 {
6828 if (!(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)))
6829 {
6830 unsigned int bind_flags = 0;
6831 DWORD usage = 0;
6832
6833 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6834 {
6836 bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
6837 }
6838 else if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
6839 {
6840 bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
6841 }
6842
6843 if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
6844 bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
6845 else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
6846 bind_flags |= WINED3D_BIND_RENDER_TARGET;
6847
6850 usage, bind_flags, WINED3D_RTYPE_TEXTURE_2D, wined3dformat_from_ddrawformat(&desc->ddpfPixelFormat))))
6851 {
6852 desc->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
6853 }
6854 else
6855 {
6856 desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
6857 sysmem_fallback = TRUE;
6858 }
6859 }
6860 else if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
6861 {
6862 /* Tests show surfaces without memory flags get these flags added
6863 * right after creation. */
6864 desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY;
6865 }
6866 }
6867
6868 if ((desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
6870 {
6871 WARN("System memory overlays are not allowed.\n");
6872 free(texture);
6873 return DDERR_NOOVERLAYHW;
6874 }
6875
6876 if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
6877 desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
6878
6879 if (desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
6880 desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM;
6881
6882 if (desc->dwFlags & DDSD_LPSURFACE)
6883 {
6884 if (!(desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY))
6885 {
6886 WARN("User memory surfaces should not be GPU accessible.\n");
6887 free(texture);
6888 return DDERR_INVALIDCAPS;
6889 }
6890
6891 if (version < 4)
6892 {
6893 WARN("User memory surfaces not supported before version 4.\n");
6894 free(texture);
6895 return DDERR_INVALIDPARAMS;
6896 }
6897
6898 if (!desc->lpSurface)
6899 {
6900 WARN("NULL surface memory pointer specified.\n");
6901 free(texture);
6902 return DDERR_INVALIDPARAMS;
6903 }
6904
6905 if (format_is_compressed(&desc->ddpfPixelFormat))
6906 {
6907 if (version != 4 && (desc->dwFlags & DDSD_PITCH))
6908 {
6909 WARN("Pitch specified on a compressed user memory surface.\n");
6910 free(texture);
6911 return DDERR_INVALIDPARAMS;
6912 }
6913
6914 if (!(desc->dwFlags & (DDSD_LINEARSIZE | DDSD_PITCH)))
6915 {
6916 WARN("Compressed user memory surfaces should explicitly specify the linear size.\n");
6917 free(texture);
6918 return DDERR_INVALIDPARAMS;
6919 }
6920 }
6921 else
6922 {
6923 if (!(desc->dwFlags & DDSD_PITCH))
6924 {
6925 WARN("User memory surfaces should explicitly specify the pitch.\n");
6926 free(texture);
6927 return DDERR_INVALIDPARAMS;
6928 }
6929 }
6930 }
6931
6932 if (((desc->dwFlags & DDSD_CKDESTOVERLAY)
6933 && desc->ddckCKDestOverlay.dwColorSpaceLowValue != desc->ddckCKDestOverlay.dwColorSpaceHighValue)
6934 || ((desc->dwFlags & DDSD_CKDESTBLT)
6935 && desc->ddckCKDestBlt.dwColorSpaceLowValue != desc->ddckCKDestBlt.dwColorSpaceHighValue)
6936 || ((desc->dwFlags & DDSD_CKSRCOVERLAY)
6937 && desc->ddckCKSrcOverlay.dwColorSpaceLowValue != desc->ddckCKSrcOverlay.dwColorSpaceHighValue)
6938 || ((desc->dwFlags & DDSD_CKSRCBLT)
6939 && desc->ddckCKSrcBlt.dwColorSpaceLowValue != desc->ddckCKSrcBlt.dwColorSpaceHighValue))
6940 {
6941 WARN("Range color keys not supported, returning DDERR_NOCOLORKEYHW.\n");
6942 free(texture);
6943 return DDERR_NOCOLORKEYHW;
6944 }
6945
6946 if ((ddraw->flags & DDRAW_NO3D) && (desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
6947 {
6948 WARN("Video memory surfaces not supported without 3D support.\n");
6949 free(texture);
6950 return DDERR_NODIRECTDRAWHW;
6951 }
6952
6953 if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
6954 layers = 6;
6955
6956 reserve_memory = !(desc->dwFlags & DDSD_LPSURFACE)
6957 && desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY
6958 && wined3d_display_mode_format.dwRGBBitCount <= 16;
6959
6960 if (FAILED(hr = ddraw_texture_init(texture, ddraw, layers, levels, sysmem_fallback, reserve_memory)))
6961 {
6962 WARN("Failed to create wined3d texture, hr %#lx.\n", hr);
6963 free(texture);
6964 return hr_ddraw_from_wined3d(hr);
6965 }
6966
6967 root = texture->root;
6968 root->is_root = TRUE;
6969
6970 if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
6971 {
6972 unsigned int count = desc->dwBackBufferCount;
6973 struct ddraw_surface *last = root;
6974
6975 attach = &last->complex_array[0];
6976 for (i = 0; i < count; ++i)
6977 {
6978 if (!(texture = malloc(sizeof(*texture))))
6979 {
6980 hr = E_OUTOFMEMORY;
6981 goto fail;
6982 }
6983
6984 texture->texture_memory = NULL;
6985 texture->version = version;
6986 texture->surface_desc = root->surface_desc;
6987 desc = &texture->surface_desc;
6988
6989 /* Only one surface in the flipping chain is a back buffer, one is
6990 * a front buffer, the others are just flippable surfaces. */
6993 if (!i)
6994 desc->ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
6995 desc->dwBackBufferCount = 0;
6996
6997 if (FAILED(hr = ddraw_texture_init(texture, ddraw, 1, 1, sysmem_fallback, reserve_memory)))
6998 {
6999 free(texture);
7001 goto fail;
7002 }
7003
7004 last = texture->root;
7005
7006 *attach = last;
7007 attach = &last->complex_array[0];
7008 }
7009 *attach = root;
7010 }
7011
7013 {
7014 ddraw->primary = root;
7015 ddraw->gdi_surface = root->wined3d_texture;
7016 }
7017 *surface = root;
7018
7019 return DD_OK;
7020
7021fail:
7022 if (version == 7)
7023 IDirectDrawSurface7_Release(&root->IDirectDrawSurface7_iface);
7024 else if (version == 4)
7025 IDirectDrawSurface4_Release(&root->IDirectDrawSurface4_iface);
7026 else
7027 IDirectDrawSurface_Release(&root->IDirectDrawSurface_iface);
7028
7029 return hr;
7030}
struct _root root
enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format)
Definition: utils.c:330
static BOOL format_is_compressed(const DDPIXELFORMAT *format)
HRESULT hr_ddraw_from_wined3d(HRESULT hr)
Definition: utils.c:1183
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd)
Definition: utils.c:857
void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format, enum wined3d_format_id wined3d_format)
Definition: utils.c:30
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define malloc
Definition: debug_ros.c:4
static HRESULT ddraw_texture_init(struct ddraw_texture *texture, struct ddraw *ddraw, unsigned int layers, unsigned int levels, bool sysmem_fallback, bool reserve_memory)
Definition: surface.c:6252
static HRESULT CDECL ddraw_reset_enum_callback(struct wined3d_resource *resource)
Definition: surface.c:6147
HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, wined3d_device_reset_cb callback, BOOL reset_state)
Definition: device.c:4970
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLuint texture
Definition: glext.h:6295
GLenum mode
Definition: glext.h:6217
GLsizei levels
Definition: glext.h:7884
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
if(dx< 0)
Definition: linetemp.h:194
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
Definition: sync.c:64
#define DDSCAPS2_CUBEMAP_ALLFACES
Definition: ddraw.h:299
#define DDERR_NOOVERLAYHW
Definition: ddraw.h:100
#define DDERR_NOEXCLUSIVEMODE
Definition: ddraw.h:95
#define DDERR_NOCOLORKEYHW
Definition: ddraw.h:93
#define DDERR_NODIRECTDRAWHW
Definition: ddraw.h:139
DWORD dwSize
Definition: ddraw.h:1072
DWORD dwRGBBitCount
Definition: ddraw.h:1077
DDSURFACEDESC2 surface_desc
struct wined3d_texture * gdi_surface
struct ddraw_surface * primary
DWORD cooperative_level
struct wined3d_swapchain * wined3d_swapchain
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, uint32_t usage, unsigned int bind_flags, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
Definition: directx.c:1972
HRESULT CDECL wined3d_output_get_display_mode(const struct wined3d_output *output, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: directx.c:1515
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:345
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2952
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:934
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:720
#define WINED3D_BIND_SHADER_RESOURCE
Definition: wined3d.h:912
#define WINED3D_BIND_DEPTH_STENCIL
Definition: wined3d.h:915
#define WINED3D_BIND_RENDER_TARGET
Definition: wined3d.h:914
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define E_POINTER
Definition: winerror.h:3480

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

◆ ddraw_surface_get_any_texture()

static struct wined3d_texture * ddraw_surface_get_any_texture ( struct ddraw_surface *  surface,
unsigned int  flags 
)
inlinestatic

Definition at line 704 of file ddraw_private.h.

705{
709
711 return ddraw_surface_get_draw_texture(surface, flags);
712}
static struct wined3d_texture * ddraw_surface_get_default_texture(struct ddraw_surface *surface, unsigned int flags)
#define DDRAW_SURFACE_LOCATION_DRAW
#define DDRAW_SURFACE_LOCATION_DEFAULT
#define assert(_expr)
Definition: assert.h:32
unsigned int texture_location

Referenced by copy_mipmap_chain(), ddraw_surface7_BltFast(), ddraw_surface_blt(), and ddraw_surface_update_frontbuffer().

◆ ddraw_surface_get_default_texture()

static struct wined3d_texture * ddraw_surface_get_default_texture ( struct ddraw_surface *  surface,
unsigned int  flags 
)
inlinestatic

Definition at line 667 of file ddraw_private.h.

668{
669 if (surface->draw_texture)
670 {
672 {
673 wined3d_device_context_copy_sub_resource_region(surface->ddraw->immediate_context,
677 }
678
681 }
682 return surface->wined3d_texture;
683}
#define DDRAW_SURFACE_WRITE
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
Definition: texture.c:1649
struct ddraw * ddraw
unsigned int sub_resource_idx
struct wined3d_texture * wined3d_texture

Referenced by d3d_texture2_Load(), ddraw_surface1_Unlock(), ddraw_surface7_GetDC(), ddraw_surface7_ReleaseDC(), ddraw_surface_blt(), ddraw_surface_get_any_texture(), ddraw_surface_update_frontbuffer(), and surface_lock().

◆ ddraw_surface_get_draw_texture()

static struct wined3d_texture * ddraw_surface_get_draw_texture ( struct ddraw_surface *  surface,
unsigned int  flags 
)
inlinestatic

Definition at line 685 of file ddraw_private.h.

686{
687 if (!surface->draw_texture)
688 return surface->wined3d_texture;
689
691 {
692 wined3d_device_context_copy_sub_resource_region(surface->ddraw->immediate_context,
696 }
697
700
701 return surface->draw_texture;
702}

Referenced by d3d_device_sync_rendertarget(), d3d_device_sync_surfaces(), ddraw_surface_blt(), and ddraw_surface_get_any_texture().

◆ ddraw_surface_get_rendertarget_view()

struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view ( struct ddraw_surface *  surface)

Definition at line 7053 of file surface.c.

7054{
7056 HRESULT hr;
7057
7058 if (surface->wined3d_rtv)
7059 return surface->wined3d_rtv;
7060
7061 wined3d_texture = surface->draw_texture ? surface->draw_texture : surface->wined3d_texture;
7063 surface->sub_resource_idx, surface, &ddraw_view_wined3d_parent_ops, &surface->wined3d_rtv)))
7064 {
7065 ERR("Failed to create rendertarget view, hr %#lx.\n", hr);
7066 return NULL;
7067 }
7068
7069 return surface->wined3d_rtv;
7070}
static const struct wined3d_parent_ops ddraw_view_wined3d_parent_ops
Definition: surface.c:34
HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view)
Definition: view.c:946
struct wined3d_rendertarget_view * wined3d_rtv

Referenced by d3d_device7_SetViewport(), d3d_device_init(), d3d_device_set_render_target(), d3d_device_sync_rendertarget(), d3d_device_update_depth_stencil(), d3d_viewport_SetViewport(), d3d_viewport_SetViewport2(), ddraw_surface1_Flip(), ddraw_surface7_SetSurfaceDesc(), and ddraw_surface_blt().

◆ ddraw_surface_update_frontbuffer()

HRESULT ddraw_surface_update_frontbuffer ( struct ddraw_surface *  surface,
const RECT *  rect,
BOOL  read,
unsigned int  swap_interval 
)

Definition at line 61 of file surface.c.

63{
64 struct wined3d_texture *dst_texture, *wined3d_texture;
65 struct ddraw *ddraw = surface->ddraw;
66 HDC surface_dc, screen_dc;
67 int x, y, w, h;
68 HRESULT hr;
69 BOOL ret;
70 RECT r;
71
72 TRACE("surface %p, rect %s, read %#x, swap_interval %u.\n",
73 surface, wine_dbgstr_rect(rect), read, swap_interval);
74
75 if (ddraw->flags & DDRAW_SWAPPED && !read)
76 {
77 ddraw->flags &= ~DDRAW_SWAPPED;
78 rect = NULL;
79 }
80
81 if (!rect)
82 {
83 SetRect(&r, 0, 0, surface->surface_desc.dwWidth, surface->surface_desc.dwHeight);
84 rect = &r;
85 }
86
87 x = rect->left;
88 y = rect->top;
89 w = rect->right - rect->left;
90 h = rect->bottom - rect->top;
91
92 if (w <= 0 || h <= 0)
93 return DD_OK;
94
95 if (!read && TRACE_ON(fps))
96 {
98 ++ddraw->frames;
99
100 /* every 1.5 seconds */
101 if (time - ddraw->prev_frame_time > 1500)
102 {
103 TRACE_(fps)("%p @ approx %.2ffps\n",
104 ddraw, 1000.0 * ddraw->frames / (time - ddraw->prev_frame_time));
106 ddraw->frames = 0;
107 }
108 }
109
110 /* The interaction between ddraw and GDI drawing is not all that well
111 * documented, and somewhat arcane. In ddraw exclusive mode, GDI draws
112 * seemingly go to the *original* frontbuffer/primary surface, while ddraw
113 * draws/flips go to the *current* frontbuffer surface. The bottom line is
114 * that if the current frontbuffer is not the GDI frontbuffer, and there's
115 * e.g. a popup window in front of the ddraw swapchain window, we can't
116 * use wined3d_swapchain_present() to get the ddraw contents to the screen
117 * while in exclusive mode, since it would get obscured by the popup
118 * window. On the other hand, if the current frontbuffer *is* the GDI
119 * frontbuffer, that's what's supposed to happen; the popup should obscure
120 * (part of) the ddraw swapchain window.
121 *
122 * This affects the "Deer Hunter" demo, which uses a popup window and GDI
123 * draws to draw part of the user interface. See also the "fswindow"
124 * sample is the DirectX 7 SDK. */
127 {
128 /* Nothing to do, we control the frontbuffer, or at least the parts we
129 * care about. */
130 if (read)
131 return DD_OK;
132
133 if (swap_interval)
135 else
137
140 NULL, WINED3D_TEXF_POINT)) && swap_interval)
141 {
144 }
145 return hr;
146 }
147
150
151 if (FAILED(hr = wined3d_texture_get_dc(wined3d_texture, surface->sub_resource_idx, &surface_dc)))
152 {
153 ERR("Failed to get surface DC, hr %#lx.\n", hr);
154 return hr;
155 }
156 if (surface->palette)
157 wined3d_palette_apply_to_dc(surface->palette->wined3d_palette, surface_dc);
158
159 if (!(screen_dc = GetDC(NULL)))
160 {
162 ERR("Failed to get screen DC.\n");
163 return E_FAIL;
164 }
165
166 if (read)
167 ret = BitBlt(surface_dc, x, y, w, h,
168 screen_dc, x, y, SRCCOPY);
169 else
170 ret = BitBlt(screen_dc, x, y, w, h,
171 surface_dc, x, y, SRCCOPY);
172
173 ReleaseDC(NULL, screen_dc);
175
176 if (!ret)
177 {
178 ERR("Failed to blit to/from screen.\n");
179 return E_FAIL;
180 }
181
182 return DD_OK;
183}
#define read
Definition: acwin.h:97
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
RECT rect
Definition: combotst.c:67
static struct wined3d_texture * ddraw_surface_get_any_texture(struct ddraw_surface *surface, unsigned int flags)
#define DDRAW_SWAPPED
Definition: ddraw_private.h:59
#define DDRAW_SURFACE_RW
static BOOL ddraw_gdi_is_front(struct ddraw *ddraw)
Definition: surface.c:47
void CDECL wined3d_palette_apply_to_dc(const struct wined3d_palette *palette, HDC dc)
Definition: palette.c:91
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
Definition: texture.c:4243
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
Definition: texture.c:4291
HRESULT CDECL wined3d_device_context_blt(struct wined3d_device_context *context, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, unsigned int flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: texture.c:3854
#define TRACE_(x)
Definition: compat.h:76
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
return ret
Definition: mutex.c:147
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
__u16 time
Definition: mkdosfs.c:8
static HDC
Definition: imagelist.c:88
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
DWORD dwWidth
Definition: ddraw.h:1157
DWORD dwHeight
Definition: ddraw.h:1156
struct ddraw_palette * palette
DWORD prev_frame_time
unsigned int frames
struct wined3d_texture *CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, UINT back_buffer_idx)
Definition: swapchain.c:256
HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, uint32_t flags)
Definition: swapchain.c:192
struct wined3d_texture *CDECL wined3d_swapchain_get_front_buffer(const struct wined3d_swapchain *swapchain)
Definition: swapchain.c:280
@ WINED3D_TEXF_POINT
Definition: wined3d.h:706
#define SRCCOPY
Definition: wingdi.h:333

Referenced by ddraw_palette_SetEntries(), ddraw_surface1_Flip(), ddraw_surface1_Unlock(), ddraw_surface7_BltFast(), ddraw_surface7_GetDC(), ddraw_surface7_ReleaseDC(), ddraw_surface_blt_clipped(), ddraw_surface_set_palette(), and surface_lock().

◆ ddraw_update_lost_surfaces()

void ddraw_update_lost_surfaces ( struct ddraw *  ddraw)

Definition at line 5031 of file ddraw.c.

5032{
5033 struct ddraw_surface *surface;
5034
5035 /* Railroad Tycoon 2 tries to restore surfaces from within a
5036 * WM_QUERYNEWPALETTE message handler and expects it to succeed. We
5037 * haven't received the WM_ACTIVATEAPP message by that point, so the
5038 * device state is still DDRAW_DEVICE_STATE_LOST, even though we are in
5039 * the foreground. */
5041 {
5043
5044 if (window && GetForegroundWindow() == window)
5046 }
5047
5049 return;
5050
5052 {
5053 surface->is_lost = ddraw_surface_can_be_lost(surface);
5054 }
5056}
static BOOL ddraw_surface_can_be_lost(const struct ddraw_surface *surface)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
struct list surface_list_entry
unsigned int is_lost
LONG device_state
HWND dest_window
HWND focuswindow

Referenced by ddraw_surface7_Restore(), and ddraw_texture_init().

◆ ddrawformat_from_wined3dformat()

void ddrawformat_from_wined3dformat ( DDPIXELFORMAT *  ddraw_format,
enum wined3d_format_id  wined3d_format 
)

Definition at line 30 of file utils.c.

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

Referenced by d3d7_EnumZBufferFormats(), d3d_device2_EnumTextureFormats(), d3d_device7_EnumTextureFormats(), ddraw7_EnumDisplayModes(), ddraw7_EnumSurfaces(), ddraw7_GetDisplayMode(), ddraw7_SetDisplayMode(), ddraw_surface_create(), and fixup_texture_alpha_op().

◆ DDSD2_to_DDSD()

void DDSD2_to_DDSD ( const DDSURFACEDESC2 *  in,
DDSURFACEDESC *  out 
)

Definition at line 1242 of file utils.c.

1243{
1244 memset(out, 0, sizeof(*out));
1245 out->dwSize = sizeof(*out);
1246 out->dwFlags = in->dwFlags;
1247 if (in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
1248 if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
1249 if (in->dwFlags & DDSD_PIXELFORMAT)
1250 {
1251 out->ddpfPixelFormat = in->ddpfPixelFormat;
1252 if ((in->dwFlags & DDSD_CAPS) && (in->ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
1253 {
1254 /* Z buffers have DDSD_ZBUFFERBITDEPTH set, but not DDSD_PIXELFORMAT. They do
1255 * have valid data in ddpfPixelFormat though */
1256 out->dwFlags &= ~DDSD_PIXELFORMAT;
1257 out->dwFlags |= DDSD_ZBUFFERBITDEPTH;
1258 out->dwZBufferBitDepth = in->ddpfPixelFormat.dwZBufferBitDepth;
1259 }
1260 }
1261 /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */
1262 out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
1263 if (in->dwFlags & DDSD_PITCH) out->lPitch = in->lPitch;
1264 if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->dwBackBufferCount;
1265 if (in->dwFlags & DDSD_ZBUFFERBITDEPTH) out->dwZBufferBitDepth = in->dwMipMapCount; /* same union */
1266 if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
1267 /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
1268 out->lpSurface = in->lpSurface;
1269 if (in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->ddckCKDestOverlay;
1270 if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
1271 if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
1272 if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
1273 if (in->dwFlags & DDSD_MIPMAPCOUNT) out->dwMipMapCount = in->dwMipMapCount;
1274 if (in->dwFlags & DDSD_REFRESHRATE) out->dwRefreshRate = in->dwRefreshRate;
1275 if (in->dwFlags & DDSD_LINEARSIZE) out->dwLinearSize = in->dwLinearSize;
1276 /* Does not exist in DDSURFACEDESC:
1277 * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
1278 */
1279 if (in->dwFlags & DDSD_TEXTURESTAGE) WARN("Does not exist in DDSURFACEDESC: DDSD_TEXTURESTAGE\n");
1280 if (in->dwFlags & DDSD_FVF) WARN("Does not exist in DDSURFACEDESC: DDSD_FVF\n");
1281 if (in->dwFlags & DDSD_SRCVBHANDLE) WARN("Does not exist in DDSURFACEDESC: DDSD_SRCVBHANDLE\n");
1283}
#define DDSD_TEXTURESTAGE
Definition: ddraw.h:226
#define DDSD_ZBUFFERBITDEPTH
Definition: ddraw.h:215
#define DDSD_SRCVBHANDLE
Definition: ddraw.h:228
#define DDSD_FVF
Definition: ddraw.h:227
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by ddraw_surface3_GetSurfaceDesc(), ddraw_surface_lock_ddsd(), ddrawex3_GetDisplayMode(), ddrawex_surface3_GetSurfaceDesc(), ddrawex_surface3_Lock(), enum_modes_cb2(), enum_surfaces_cb2(), EnumDisplayModesCallbackThunk(), and enumsurfaces_thunk_cb().

◆ DDSD_to_DDSD2()

void DDSD_to_DDSD2 ( const DDSURFACEDESC *  in,
DDSURFACEDESC2 *  out 
)

Definition at line 1198 of file utils.c.

1199{
1200 /* The output of this function is never passed to the application directly, so
1201 * the memset is not strictly needed. CreateSurface still has problems with this
1202 * though. Don't forget to set ddsCaps.dwCaps2/3/4 to 0 when removing this */
1203 memset(out, 0x00, sizeof(*out));
1204 out->dwSize = sizeof(*out);
1205 out->dwFlags = in->dwFlags & ~DDSD_ZBUFFERBITDEPTH;
1206 if (in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
1207 if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
1208 if (in->dwFlags & DDSD_PIXELFORMAT) out->ddpfPixelFormat = in->ddpfPixelFormat;
1209 else if(in->dwFlags & DDSD_ZBUFFERBITDEPTH)
1210 {
1211 out->dwFlags |= DDSD_PIXELFORMAT;
1212 memset(&out->ddpfPixelFormat, 0, sizeof(out->ddpfPixelFormat));
1213 out->ddpfPixelFormat.dwSize = sizeof(out->ddpfPixelFormat);
1214 out->ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
1215 out->ddpfPixelFormat.dwZBufferBitDepth = in->dwZBufferBitDepth;
1216 /* 0 is not a valid DDSURFACEDESC / DDPIXELFORMAT on either side of the
1217 * conversion */
1218 out->ddpfPixelFormat.dwZBitMask = ~0U >> (32 - in->dwZBufferBitDepth);
1219 }
1220 /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */
1221 out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
1222 if (in->dwFlags & DDSD_PITCH) out->lPitch = in->lPitch;
1223 if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->dwBackBufferCount;
1224 if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
1225 /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
1226 out->lpSurface = in->lpSurface;
1227 if (in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->ddckCKDestOverlay;
1228 if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
1229 if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
1230 if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
1231 if (in->dwFlags & DDSD_MIPMAPCOUNT) out->dwMipMapCount = in->dwMipMapCount;
1232 if (in->dwFlags & DDSD_REFRESHRATE) out->dwRefreshRate = in->dwRefreshRate;
1233 if (in->dwFlags & DDSD_LINEARSIZE) out->dwLinearSize = in->dwLinearSize;
1234 /* Does not exist in DDSURFACEDESC:
1235 * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
1236 */
1237}
#define U(x)
Definition: wordpad.c:45

Referenced by ddraw1_CreateSurface(), ddraw1_EnumDisplayModes(), ddraw1_EnumSurfaces(), ddraw2_CreateSurface(), ddraw2_EnumDisplayModes(), ddraw2_EnumSurfaces(), ddraw_surface1_Initialize(), ddraw_surface2_Initialize(), ddraw_surface3_Initialize(), ddraw_surface3_SetSurfaceDesc(), ddrawex3_CreateSurface(), ddrawex3_EnumDisplayModes(), ddrawex3_EnumSurfaces(), ddrawex_surface3_Initialize(), and ddrawex_surface3_SetSurfaceDesc().

◆ dump_D3DMATRIX()

void dump_D3DMATRIX ( const D3DMATRIX *  mat)

Definition at line 906 of file utils.c.

907{
908 TRACE(" %f %f %f %f\n", mat->_11, mat->_12, mat->_13, mat->_14);
909 TRACE(" %f %f %f %f\n", mat->_21, mat->_22, mat->_23, mat->_24);
910 TRACE(" %f %f %f %f\n", mat->_31, mat->_32, mat->_33, mat->_34);
911 TRACE(" %f %f %f %f\n", mat->_41, mat->_42, mat->_43, mat->_44);
912}
static const MAT2 mat
Definition: font.c:51

Referenced by d3d_device1_SetMatrix().

◆ format_is_compressed()

static BOOL format_is_compressed ( const DDPIXELFORMAT *  format)
inlinestatic

Definition at line 636 of file ddraw_private.h.

637{
638 return (format->dwFlags & DDPF_FOURCC) && (format->dwFourCC == WINED3DFMT_DXT1
639 || format->dwFourCC == WINED3DFMT_DXT2 || format->dwFourCC == WINED3DFMT_DXT3
640 || format->dwFourCC == WINED3DFMT_DXT4 || format->dwFourCC == WINED3DFMT_DXT5);
641}

Referenced by ddraw_surface_create(), and ddraw_texture_init().

◆ format_is_paletteindexed()

static BOOL format_is_paletteindexed ( const DDPIXELFORMAT *  fmt)
inlinestatic

Definition at line 643 of file ddraw_private.h.

644{
647 return !!(fmt->dwFlags & flags);
648}
#define DDPF_PALETTEINDEXEDTO8
Definition: ddraw.h:507
#define DDPF_PALETTEINDEXED4
Definition: ddraw.h:506
#define DDPF_PALETTEINDEXED2
Definition: ddraw.h:515
#define DDPF_PALETTEINDEXED1
Definition: ddraw.h:514
Definition: dsound.c:943

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

◆ get_flexible_vertex_size()

DWORD get_flexible_vertex_size ( DWORD  d3dvtVertexType)

Definition at line 915 of file utils.c.

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

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

◆ hr_ddraw_from_wined3d()

HRESULT hr_ddraw_from_wined3d ( HRESULT  hr)

◆ impl_from_IDirect3DDevice()

◆ impl_from_IDirect3DDevice2()

◆ impl_from_IDirect3DDevice3()

◆ impl_from_IDirect3DDevice7()

static struct d3d_device * impl_from_IDirect3DDevice7 ( IDirect3DDevice7 *  iface)
inlinestatic

Definition at line 395 of file ddraw_private.h.

396{
397 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice7_iface);
398}

Referenced by d3d_device7_AddRef(), d3d_device7_ApplyStateBlock(), d3d_device7_BeginScene(), d3d_device7_BeginStateBlock(), d3d_device7_CaptureStateBlock(), d3d_device7_Clear(), d3d_device7_ComputeSphereVisibility(), d3d_device7_CreateStateBlock(), d3d_device7_DeleteStateBlock(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), d3d_device7_DrawPrimitiveVB(), d3d_device7_EndScene(), d3d_device7_EndStateBlock(), d3d_device7_EnumTextureFormats(), d3d_device7_GetCaps(), d3d_device7_GetClipPlane(), d3d_device7_GetClipStatus(), d3d_device7_GetDirect3D(), d3d_device7_GetLight(), d3d_device7_GetLightEnable(), d3d_device7_GetMaterial(), d3d_device7_GetRenderState(), d3d_device7_GetRenderTarget(), d3d_device7_GetTexture(), d3d_device7_GetTextureStageState(), d3d_device7_GetTransform(), d3d_device7_GetViewport(), d3d_device7_LightEnable(), d3d_device7_Load(), d3d_device7_MultiplyTransform(), d3d_device7_QueryInterface(), d3d_device7_Release(), d3d_device7_SetClipPlane(), d3d_device7_SetLight(), d3d_device7_SetMaterial(), d3d_device7_SetRenderState(), d3d_device7_SetRenderTarget(), d3d_device7_SetTexture(), d3d_device7_SetTextureStageState(), d3d_device7_SetTransform(), d3d_device7_SetViewport(), and d3d_device7_ValidateDevice().

◆ impl_from_IDirect3DTexture()

static struct ddraw_surface * impl_from_IDirect3DTexture ( IDirect3DTexture *  iface)
inlinestatic

◆ impl_from_IDirect3DTexture2()

static struct ddraw_surface * impl_from_IDirect3DTexture2 ( IDirect3DTexture2 *  iface)
inlinestatic

Definition at line 245 of file ddraw_private.h.

246{
247 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture2_iface);
248}

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

◆ impl_from_IDirectDrawPalette()

static struct ddraw_palette * impl_from_IDirectDrawPalette ( IDirectDrawPalette *  iface)
inlinestatic

◆ impl_from_IDirectDrawSurface()

◆ impl_from_IDirectDrawSurface2()

◆ impl_from_IDirectDrawSurface3()

static struct ddraw_surface * impl_from_IDirectDrawSurface3 ( IDirectDrawSurface3 *  iface)
inlinestatic

Definition at line 260 of file ddraw_private.h.

261{
262 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface3_iface);
263}

Referenced by ddraw_surface3_AddAttachedSurface(), ddraw_surface3_AddOverlayDirtyRect(), ddraw_surface3_AddRef(), ddraw_surface3_Blt(), ddraw_surface3_BltBatch(), ddraw_surface3_BltFast(), ddraw_surface3_DeleteAttachedSurface(), ddraw_surface3_EnumAttachedSurfaces(), ddraw_surface3_EnumOverlayZOrders(), ddraw_surface3_Flip(), ddraw_surface3_GetAttachedSurface(), ddraw_surface3_GetBltStatus(), ddraw_surface3_GetCaps(), ddraw_surface3_GetClipper(), ddraw_surface3_GetColorKey(), ddraw_surface3_GetDC(), ddraw_surface3_GetDDInterface(), ddraw_surface3_GetFlipStatus(), ddraw_surface3_GetOverlayPosition(), ddraw_surface3_GetPalette(), ddraw_surface3_GetPixelFormat(), ddraw_surface3_GetSurfaceDesc(), ddraw_surface3_Initialize(), ddraw_surface3_IsLost(), ddraw_surface3_Lock(), ddraw_surface3_PageLock(), ddraw_surface3_PageUnlock(), ddraw_surface3_QueryInterface(), ddraw_surface3_Release(), ddraw_surface3_ReleaseDC(), ddraw_surface3_Restore(), ddraw_surface3_SetClipper(), ddraw_surface3_SetColorKey(), ddraw_surface3_SetOverlayPosition(), ddraw_surface3_SetPalette(), ddraw_surface3_SetSurfaceDesc(), ddraw_surface3_Unlock(), ddraw_surface3_UpdateOverlay(), ddraw_surface3_UpdateOverlayDisplay(), ddraw_surface3_UpdateOverlayZOrder(), ddrawex_surface3_AddAttachedSurface(), ddrawex_surface3_AddOverlayDirtyRect(), ddrawex_surface3_AddRef(), ddrawex_surface3_Blt(), ddrawex_surface3_BltBatch(), ddrawex_surface3_BltFast(), ddrawex_surface3_DeleteAttachedSurface(), ddrawex_surface3_EnumAttachedSurfaces(), ddrawex_surface3_EnumOverlayZOrders(), ddrawex_surface3_Flip(), ddrawex_surface3_GetAttachedSurface(), ddrawex_surface3_GetBltStatus(), ddrawex_surface3_GetCaps(), ddrawex_surface3_GetClipper(), ddrawex_surface3_GetColorKey(), ddrawex_surface3_GetDC(), ddrawex_surface3_GetFlipStatus(), ddrawex_surface3_GetOverlayPosition(), ddrawex_surface3_GetPalette(), ddrawex_surface3_GetPixelFormat(), ddrawex_surface3_GetSurfaceDesc(), ddrawex_surface3_Initialize(), ddrawex_surface3_IsLost(), ddrawex_surface3_Lock(), ddrawex_surface3_PageLock(), ddrawex_surface3_PageUnlock(), ddrawex_surface3_QueryInterface(), ddrawex_surface3_Release(), ddrawex_surface3_ReleaseDC(), ddrawex_surface3_Restore(), ddrawex_surface3_SetClipper(), ddrawex_surface3_SetColorKey(), ddrawex_surface3_SetOverlayPosition(), ddrawex_surface3_SetPalette(), ddrawex_surface3_SetSurfaceDesc(), ddrawex_surface3_Unlock(), ddrawex_surface3_UpdateOverlay(), ddrawex_surface3_UpdateOverlayDisplay(), ddrawex_surface3_UpdateOverlayZOrder(), and unsafe_impl_from_IDirectDrawSurface3().

◆ impl_from_IDirectDrawSurface4()

static struct ddraw_surface * impl_from_IDirectDrawSurface4 ( IDirectDrawSurface4 *  iface)
inlinestatic

Definition at line 265 of file ddraw_private.h.

266{
267 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface4_iface);
268}

Referenced by ddraw_surface4_AddAttachedSurface(), ddraw_surface4_AddOverlayDirtyRect(), ddraw_surface4_AddRef(), ddraw_surface4_Blt(), ddraw_surface4_BltBatch(), ddraw_surface4_BltFast(), ddraw_surface4_ChangeUniquenessValue(), ddraw_surface4_DeleteAttachedSurface(), ddraw_surface4_EnumAttachedSurfaces(), ddraw_surface4_EnumOverlayZOrders(), ddraw_surface4_Flip(), ddraw_surface4_FreePrivateData(), ddraw_surface4_GetAttachedSurface(), ddraw_surface4_GetBltStatus(), ddraw_surface4_GetCaps(), ddraw_surface4_GetClipper(), ddraw_surface4_GetColorKey(), ddraw_surface4_GetDC(), ddraw_surface4_GetDDInterface(), ddraw_surface4_GetFlipStatus(), ddraw_surface4_GetOverlayPosition(), ddraw_surface4_GetPalette(), ddraw_surface4_GetPixelFormat(), ddraw_surface4_GetPrivateData(), ddraw_surface4_GetSurfaceDesc(), ddraw_surface4_GetUniquenessValue(), ddraw_surface4_Initialize(), ddraw_surface4_IsLost(), ddraw_surface4_Lock(), ddraw_surface4_PageLock(), ddraw_surface4_PageUnlock(), ddraw_surface4_QueryInterface(), ddraw_surface4_Release(), ddraw_surface4_ReleaseDC(), ddraw_surface4_Restore(), ddraw_surface4_SetClipper(), ddraw_surface4_SetColorKey(), ddraw_surface4_SetOverlayPosition(), ddraw_surface4_SetPalette(), ddraw_surface4_SetPrivateData(), ddraw_surface4_SetSurfaceDesc(), ddraw_surface4_Unlock(), ddraw_surface4_UpdateOverlay(), ddraw_surface4_UpdateOverlayDisplay(), ddraw_surface4_UpdateOverlayZOrder(), ddrawex_surface4_AddAttachedSurface(), ddrawex_surface4_AddOverlayDirtyRect(), ddrawex_surface4_AddRef(), ddrawex_surface4_Blt(), ddrawex_surface4_BltBatch(), ddrawex_surface4_BltFast(), ddrawex_surface4_ChangeUniquenessValue(), ddrawex_surface4_DeleteAttachedSurface(), ddrawex_surface4_EnumAttachedSurfaces(), ddrawex_surface4_EnumOverlayZOrders(), ddrawex_surface4_Flip(), ddrawex_surface4_FreePrivateData(), ddrawex_surface4_GetAttachedSurface(), ddrawex_surface4_GetBltStatus(), ddrawex_surface4_GetCaps(), ddrawex_surface4_GetClipper(), ddrawex_surface4_GetColorKey(), ddrawex_surface4_GetDC(), ddrawex_surface4_GetFlipStatus(), ddrawex_surface4_GetOverlayPosition(), ddrawex_surface4_GetPalette(), ddrawex_surface4_GetPixelFormat(), ddrawex_surface4_GetPrivateData(), ddrawex_surface4_GetSurfaceDesc(), ddrawex_surface4_GetUniquenessValue(), ddrawex_surface4_Initialize(), ddrawex_surface4_IsLost(), ddrawex_surface4_Lock(), ddrawex_surface4_PageLock(), ddrawex_surface4_PageUnlock(), ddrawex_surface4_QueryInterface(), ddrawex_surface4_Release(), ddrawex_surface4_ReleaseDC(), ddrawex_surface4_Restore(), ddrawex_surface4_SetClipper(), ddrawex_surface4_SetColorKey(), ddrawex_surface4_SetOverlayPosition(), ddrawex_surface4_SetPalette(), ddrawex_surface4_SetPrivateData(), ddrawex_surface4_SetSurfaceDesc(), ddrawex_surface4_Unlock(), ddrawex_surface4_UpdateOverlay(), ddrawex_surface4_UpdateOverlayDisplay(), ddrawex_surface4_UpdateOverlayZOrder(), and unsafe_impl_from_IDirectDrawSurface4().

◆ impl_from_IDirectDrawSurface7()

static struct ddraw_surface * impl_from_IDirectDrawSurface7 ( IDirectDrawSurface7 *  iface)
inlinestatic

Definition at line 270 of file ddraw_private.h.

271{
272 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface7_iface);
273}

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

◆ light_activate()

void light_activate ( struct d3d_light *  light)

Definition at line 48 of file light.c.

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

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

◆ light_deactivate()

void light_deactivate ( struct d3d_light *  light)

Definition at line 74 of file light.c.

75{
76 struct d3d_device *device;
77
78 TRACE("light %p.\n", light);
79
80 if (!light->active_viewport || !light->active_viewport->active_device
81 || light->active_viewport->active_device->current_viewport != light->active_viewport)
82 {
83 assert(!light->active_light_index);
84 return;
85 }
86
87 device = light->active_viewport->active_device;
88 if (light->active_light_index)
89 {
90 IDirect3DDevice7_LightEnable(&device->IDirect3DDevice7_iface, light->active_light_index, FALSE);
92 }
93}
void viewport_free_active_light_index(struct d3d_light *light)
Definition: viewport.c:159

Referenced by d3d_light_SetLight(), d3d_viewport_DeleteLight(), viewport_alloc_active_light_index(), and viewport_deactivate().

◆ material_activate()

void material_activate ( struct d3d_material *  material)

Definition at line 444 of file material.c.

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

Referenced by d3d_device3_SetLightState().

◆ multiply_matrix()

void multiply_matrix ( struct wined3d_matrix *  dst,
const struct wined3d_matrix *  src1,
const struct wined3d_matrix *  src2 
)

Definition at line 1153 of file utils.c.

1154{
1155 struct wined3d_matrix temp;
1156
1157 /* Now do the multiplication 'by hand'.
1158 I know that all this could be optimised, but this will be done later :-) */
1159 temp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
1160 temp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
1161 temp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
1162 temp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
1163
1164 temp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
1165 temp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
1166 temp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
1167 temp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
1168
1169 temp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
1170 temp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
1171 temp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
1172 temp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
1173
1174 temp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
1175 temp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
1176 temp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
1177 temp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
1178
1179 *dst = temp;
1180}
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by d3d_device3_MultiplyTransform(), d3d_device3_SetTransform(), d3d_viewport_TransformVertices(), get_projection_matrix(), init_transformed_lights(), prepare_clip_space_planes(), process_vertices_strided(), update_clip_space(), and wined3d_stateblock_multiply_transform().

◆ unsafe_impl_from_IDirect3DDevice()

struct d3d_device * unsafe_impl_from_IDirect3DDevice ( IDirect3DDevice *  iface)

Definition at line 6810 of file device.c.

6811{
6812 if (!iface) return NULL;
6813 assert(iface->lpVtbl == &d3d_device1_vtbl);
6814 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice_iface);
6815}
static const struct IDirect3DDeviceVtbl d3d_device1_vtbl
Definition: device.c:6754

Referenced by d3d_material1_GetHandle(), and d3d_texture1_GetHandle().

◆ unsafe_impl_from_IDirect3DDevice2()

struct d3d_device * unsafe_impl_from_IDirect3DDevice2 ( IDirect3DDevice2 *  iface)

Definition at line 6803 of file device.c.

6804{
6805 if (!iface) return NULL;
6806 assert(iface->lpVtbl == &d3d_device2_vtbl);
6807 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice2_iface);
6808}
static const struct IDirect3DDevice2Vtbl d3d_device2_vtbl
Definition: device.c:6715

Referenced by d3d_material2_GetHandle().

◆ unsafe_impl_from_IDirect3DDevice3()

struct d3d_device * unsafe_impl_from_IDirect3DDevice3 ( IDirect3DDevice3 *  iface)

Definition at line 6796 of file device.c.

6797{
6798 if (!iface) return NULL;
6799 assert(iface->lpVtbl == &d3d_device3_vtbl);
6800 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice3_iface);
6801}
static const struct IDirect3DDevice3Vtbl d3d_device3_vtbl
Definition: device.c:6667

Referenced by d3d_material3_GetHandle(), and d3d_vertex_buffer7_ProcessVertices().

◆ unsafe_impl_from_IDirect3DDevice7()

struct d3d_device * unsafe_impl_from_IDirect3DDevice7 ( IDirect3DDevice7 *  iface)

Definition at line 6789 of file device.c.

6790{
6791 if (!iface) return NULL;
6792 assert((iface->lpVtbl == &d3d_device7_fpu_preserve_vtbl) || (iface->lpVtbl == &d3d_device7_fpu_setup_vtbl));
6793 return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice7_iface);
6794}
static const struct IDirect3DDevice7Vtbl d3d_device7_fpu_preserve_vtbl
Definition: device.c:6612
static const struct IDirect3DDevice7Vtbl d3d_device7_fpu_setup_vtbl
Definition: device.c:6557

Referenced by d3d_vertex_buffer7_ProcessVertices().

◆ unsafe_impl_from_IDirect3DExecuteBuffer()

struct d3d_execute_buffer * unsafe_impl_from_IDirect3DExecuteBuffer ( IDirect3DExecuteBuffer *  iface)

Definition at line 790 of file executebuffer.c.

791{
792 if (!iface)
793 return NULL;
794 assert(iface->lpVtbl == &d3d_execute_buffer_vtbl);
795
797}
static struct d3d_execute_buffer * impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface)

Referenced by d3d_device1_Execute().

◆ unsafe_impl_from_IDirect3DLight()

struct d3d_light * unsafe_impl_from_IDirect3DLight ( IDirect3DLight *  iface)

Definition at line 257 of file light.c.

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

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

◆ unsafe_impl_from_IDirect3DTexture()

struct ddraw_surface * unsafe_impl_from_IDirect3DTexture ( IDirect3DTexture *  iface)

Definition at line 6037 of file surface.c.

6038{
6039 if (!iface) return NULL;
6040 assert(iface->lpVtbl == &d3d_texture1_vtbl);
6041 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture_iface);
6042}
static const struct IDirect3DTextureVtbl d3d_texture1_vtbl
Definition: surface.c:5936

Referenced by d3d_device1_SwapTextureHandles(), and d3d_texture1_Load().

◆ unsafe_impl_from_IDirect3DTexture2()

struct ddraw_surface * unsafe_impl_from_IDirect3DTexture2 ( IDirect3DTexture2 *  iface)

Definition at line 6030 of file surface.c.

6031{
6032 if (!iface) return NULL;
6033 assert(iface->lpVtbl == &d3d_texture2_vtbl);
6034 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirect3DTexture2_iface);
6035}
static const struct IDirect3DTexture2Vtbl d3d_texture2_vtbl
Definition: surface.c:5926

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

◆ unsafe_impl_from_IDirect3DVertexBuffer()

struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer ( IDirect3DVertexBuffer *  iface)

◆ unsafe_impl_from_IDirect3DVertexBuffer7()

struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer7 ( IDirect3DVertexBuffer7 *  iface)

Definition at line 510 of file vertexbuffer.c.

511{
512 if (!iface)
513 return NULL;
514 assert(iface->lpVtbl == &d3d_vertex_buffer7_vtbl);
515
517}
static struct d3d_vertex_buffer * impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:24

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

◆ unsafe_impl_from_IDirect3DViewport()

struct d3d_viewport * unsafe_impl_from_IDirect3DViewport ( IDirect3DViewport *  iface)

Definition at line 1224 of file viewport.c.

1225{
1226 /* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
1227 if (!iface) return NULL;
1228 assert(iface->lpVtbl == (IDirect3DViewportVtbl *)&d3d_viewport_vtbl);
1229 return CONTAINING_RECORD(iface, struct d3d_viewport, IDirect3DViewport3_iface);
1230}

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

◆ unsafe_impl_from_IDirect3DViewport2()

struct d3d_viewport * unsafe_impl_from_IDirect3DViewport2 ( IDirect3DViewport2 *  iface)

Definition at line 1216 of file viewport.c.

1217{
1218 /* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
1219 if (!iface) return NULL;
1220 assert(iface->lpVtbl == (IDirect3DViewport2Vtbl *)&d3d_viewport_vtbl);
1221 return CONTAINING_RECORD(iface, struct d3d_viewport, IDirect3DViewport3_iface);
1222}

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

◆ unsafe_impl_from_IDirect3DViewport3()

struct d3d_viewport * unsafe_impl_from_IDirect3DViewport3 ( IDirect3DViewport3 *  iface)

Definition at line 1209 of file viewport.c.

1210{
1211 if (!iface) return NULL;
1212 assert(iface->lpVtbl == &d3d_viewport_vtbl);
1213 return CONTAINING_RECORD(iface, struct d3d_viewport, IDirect3DViewport3_iface);
1214}

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

◆ unsafe_impl_from_IDirectDrawClipper()

struct ddraw_clipper * unsafe_impl_from_IDirectDrawClipper ( IDirectDrawClipper *  iface)

Definition at line 389 of file clipper.c.

390{
391 if (!iface)
392 return NULL;
393 assert(iface->lpVtbl == &ddraw_clipper_vtbl);
394
395 return impl_from_IDirectDrawClipper(iface);
396}
static struct ddraw_clipper * impl_from_IDirectDrawClipper(IDirectDrawClipper *iface)
Definition: clipper.c:28

Referenced by ddraw_surface7_SetClipper().

◆ unsafe_impl_from_IDirectDrawPalette()

struct ddraw_palette * unsafe_impl_from_IDirectDrawPalette ( IDirectDrawPalette *  iface)

Definition at line 232 of file palette.c.

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

Referenced by ddraw_surface_set_palette().

◆ unsafe_impl_from_IDirectDrawSurface()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface ( IDirectDrawSurface *  iface)

Definition at line 6014 of file surface.c.

6015{
6016 if (!iface) return NULL;
6017 if (iface->lpVtbl != &ddraw_surface1_vtbl)
6018 {
6019 HRESULT hr = IDirectDrawSurface_QueryInterface(iface, &IID_IDirectDrawSurface, (void **)&iface);
6020 if (FAILED(hr))
6021 {
6022 WARN("Object %p doesn't expose interface IDirectDrawSurface.\n", iface);
6023 return NULL;
6024 }
6025 IDirectDrawSurface_Release(iface);
6026 }
6027 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface_iface);
6028}
static struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl
Definition: surface.c:5875

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

◆ unsafe_impl_from_IDirectDrawSurface4()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface4 ( IDirectDrawSurface4 *  iface)

Definition at line 5966 of file surface.c.

5967{
5968 if (!iface) return NULL;
5969 if (iface->lpVtbl != &ddraw_surface4_vtbl)
5970 {
5971 HRESULT hr = IDirectDrawSurface4_QueryInterface(iface, &IID_IDirectDrawSurface4, (void **)&iface);
5972 if (FAILED(hr))
5973 {
5974 WARN("Object %p doesn't expose interface IDirectDrawSurface4.\n", iface);
5975 return NULL;
5976 }
5977 IDirectDrawSurface4_Release(iface);
5978 }
5979 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface4_iface);
5980}
static struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl
Definition: surface.c:5724

Referenced by d3d3_CreateDevice(), d3d_device3_SetRenderTarget(), ddraw4_DuplicateSurface(), and ddrawex4_DuplicateSurface().

◆ unsafe_impl_from_IDirectDrawSurface7()

struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface7 ( IDirectDrawSurface7 *  iface)

Definition at line 5950 of file surface.c.

5951{
5952 if (!iface) return NULL;
5953 if (iface->lpVtbl != &ddraw_surface7_vtbl)
5954 {
5955 HRESULT hr = IDirectDrawSurface7_QueryInterface(iface, &IID_IDirectDrawSurface7, (void **)&iface);
5956 if (FAILED(hr))
5957 {
5958 WARN("Object %p doesn't expose interface IDirectDrawSurface7.\n", iface);
5959 return NULL;
5960 }
5961 IDirectDrawSurface7_Release(iface);
5962 }
5963 return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface7_iface);
5964}
static struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl
Definition: surface.c:5664

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

◆ viewport_activate()

void viewport_activate ( struct d3d_viewport *  viewport,
BOOL  ignore_lights 
)

Definition at line 51 of file viewport.c.

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

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

◆ viewport_alloc_active_light_index()

void viewport_alloc_active_light_index ( struct d3d_light *  light)

Definition at line 121 of file viewport.c.

122{
123 struct d3d_viewport *vp = light->active_viewport;
124 unsigned int i, map;
125
126 TRACE("vp %p, light %p, index %lu, active_lights_count %lu.\n",
127 vp, light, light->active_light_index, vp->active_lights_count);
128
129 if (light->active_light_index)
130 return;
131
133 {
134 struct d3d_light *l;
135
137 {
138 if (l->active_light_index)
139 {
140 WARN("Too many active lights, viewport %p, light %p, deactivating %p.\n", vp, light, l);
142
143 /* Recycle active lights in a FIFO way. */
144 list_remove(&light->entry);
145 list_add_tail(&vp->light_list, &light->entry);
146 break;
147 }
148 }
149 }
150
151 map = ~vp->map_lights;
154 light->active_light_index = i + 1;
156 vp->map_lights |= 1u << i;
157}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
r l[0]
Definition: byte_order.h:168
Definition: _map.h:48
#define DDRAW_MAX_ACTIVE_LIGHTS
Definition: ddraw_private.h:70
void light_deactivate(struct d3d_light *light)
Definition: light.c:74
DWORD active_lights_count
static int wined3d_bit_scan(unsigned int *x)
Definition: wined3d.h:2982

Referenced by light_activate().

◆ viewport_deactivate()

void viewport_deactivate ( struct d3d_viewport *  viewport)

Definition at line 111 of file viewport.c.

112{
113 struct d3d_light *light;
114
116 {
118 }
119}

Referenced by d3d_device3_DeleteViewport(), and d3d_device3_SetCurrentViewport().

◆ viewport_free_active_light_index()

void viewport_free_active_light_index ( struct d3d_light *  light)

Definition at line 159 of file viewport.c.

160{
161 struct d3d_viewport *vp = light->active_viewport;
162
163 TRACE("vp %p, light %p, index %lu, active_lights_count %lu, map_lights %#lx.\n",
164 vp, light, light->active_light_index, vp->active_lights_count, vp->map_lights);
165
166 if (!light->active_light_index)
167 return;
168
169 assert(vp->map_lights & (1u << (light->active_light_index - 1)));
170
172 vp->map_lights &= ~(1u << (light->active_light_index - 1));
173 light->active_light_index = 0;
174}

Referenced by light_deactivate().

◆ wined3d_colour_from_ddraw_colour()

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

Definition at line 593 of file utils.c.

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

Referenced by ddraw_surface_blt().

◆ wined3dformat_from_ddrawformat()

enum wined3d_format_id wined3dformat_from_ddrawformat ( const DDPIXELFORMAT *  format)

Definition at line 330 of file utils.c.

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

Referenced by ddraw_surface7_SetSurfaceDesc(), ddraw_surface_create(), and wined3d_resource_desc_from_ddraw().

◆ wined3dmapflags_from_ddrawmapflags()

unsigned int wined3dmapflags_from_ddrawmapflags ( unsigned int  flags)

Definition at line 561 of file utils.c.

562{
563 static const unsigned int handled = DDLOCK_NOSYSLOCK
567 unsigned int wined3d_flags;
568
569 wined3d_flags = flags & handled;
571 wined3d_flags |= WINED3D_MAP_READ;
572 if (!(flags & DDLOCK_READONLY))
573 wined3d_flags |= WINED3D_MAP_WRITE;
574 if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
575 wined3d_flags |= WINED3D_MAP_READ | WINED3D_MAP_WRITE;
577 wined3d_flags |= WINED3D_MAP_NO_DIRTY_UPDATE;
579
580 if (flags)
581 FIXME("Unhandled flags %#x.\n", flags);
582
583 return wined3d_flags;
584}
#define DDLOCK_READONLY
Definition: ddraw.h:626
#define DDLOCK_WRITEONLY
Definition: ddraw.h:627
#define DDLOCK_NODIRTYUPDATE
Definition: ddraw.h:634
#define DDLOCK_DONOTWAIT
Definition: ddraw.h:632
#define DDLOCK_DISCARDCONTENTS
Definition: ddraw.h:630
#define DDLOCK_NOOVERWRITE
Definition: ddraw.h:629
#define DDLOCK_NOSYSLOCK
Definition: ddraw.h:628
#define DDLOCK_WAIT
Definition: ddraw.h:624
#define WINED3D_MAP_NO_DIRTY_UPDATE
Definition: wined3d.h:955
#define WINED3D_MAP_READ
Definition: wined3d.h:957

Referenced by d3d_vertex_buffer7_Lock(), and surface_lock().

Variable Documentation

◆ ddraw_null_wined3d_parent_ops

◆ force_refresh_rate

DWORD force_refresh_rate
extern

Definition at line 38 of file main.c.

Referenced by ddraw7_SetDisplayMode(), and DllMain().

◆ global_handle_table

◆ IID_D3DDEVICE_WineD3D