ReactOS 0.4.17-dev-966-gf06eace
ddraw_private.h
Go to the documentation of this file.
1/*
2 * Copyright 2006 Stefan Dösinger
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
20#define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
21
22#include <assert.h>
23#include <limits.h>
24#include <math.h>
25#include <stdbool.h>
26#define COBJMACROS
27#include "wine/debug.h"
28
29#include "winbase.h"
30#include "wingdi.h"
31#include "winuser.h"
32
33#include "d3d.h"
34#include "ddraw.h"
35#ifdef DDRAW_INIT_GUID
36#include "initguid.h"
37#endif
38#include "wine/list.h"
39#include "wine/wined3d.h"
40
43
44/*****************************************************************************
45 * IDirectDraw implementation structure
46 *****************************************************************************/
47struct FvfToDecl
48{
49 DWORD fvf;
51};
52
53#define DDRAW_INITIALIZED 0x00000001
54#define DDRAW_D3D_INITIALIZED 0x00000002
55#define DDRAW_RESTORE_MODE 0x00000004
56#define DDRAW_NO3D 0x00000008
57#define DDRAW_SCL_DDRAW1 0x00000010
58#define DDRAW_SCL_RECURSIVE 0x00000020
59#define DDRAW_SWAPPED 0x00000040
60
61#define DDRAW_STRIDE_ALIGNMENT 8
62
63#define DDRAW_WINED3D_FLAGS (WINED3D_LEGACY_DEPTH_BIAS | WINED3D_RESTORE_MODE_ON_ACTIVATE \
64 | WINED3D_FOCUS_MESSAGES | WINED3D_PIXEL_CENTER_INTEGER | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR \
65 | WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_CUBEMAP_FILTERING | WINED3D_NO_DRAW_INDIRECT)
66
67#define DDRAW_WINED3D_SWAPCHAIN_FLAGS (WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH \
68 | WINED3D_SWAPCHAIN_IMPLICIT | WINED3D_SWAPCHAIN_REGISTER_TOPMOST_TIMER)
69
70#define DDRAW_MAX_ACTIVE_LIGHTS 32
71#define DDRAW_MAX_TEXTURES 8
72
74{
78};
79
80struct ddraw
81{
82 /* Interfaces */
84 IDirectDraw4 IDirectDraw4_iface;
85 IDirectDraw2 IDirectDraw2_iface;
86 IDirectDraw IDirectDraw_iface;
87 IDirect3D7 IDirect3D7_iface;
88 IDirect3D3 IDirect3D3_iface;
89 IDirect3D2 IDirect3D2_iface;
90 IDirect3D IDirect3D_iface;
92
93 /* See comment in IDirectDraw::AddRef */
95
103
110
111 /* DirectDraw things, which are not handled by WineD3D */
113
114 /* D3D things */
119
120 /* Various HWNDs */
124
125 /* For the dll unload cleanup code */
127 /* The surface list - can't relay this to WineD3D
128 * because of IParent
129 */
131
132 /* FVF management */
135
136 unsigned int frames;
138};
139
140#define DDRAW_WINDOW_CLASS_NAME "DirectDrawDeviceWnd"
141
146
148{
149 if (window == GetDesktopWindow())
150 window = NULL;
152}
153
154/* Utility functions */
155void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut);
158
159#define DDRAW_SURFACE_LOCATION_DEFAULT 0x00000001
160#define DDRAW_SURFACE_LOCATION_DRAW 0x00000002
161
163{
164 /* IUnknown fields */
166 IDirectDrawSurface4 IDirectDrawSurface4_iface;
167 IDirectDrawSurface3 IDirectDrawSurface3_iface;
168 IDirectDrawSurface2 IDirectDrawSurface2_iface;
169 IDirectDrawSurface IDirectDrawSurface_iface;
170 IDirectDrawGammaControl IDirectDrawGammaControl_iface;
171 IDirect3DTexture2 IDirect3DTexture2_iface;
172 IDirect3DTexture IDirect3DTexture_iface;
173
177
179
180 /* Connections to other Objects */
181 struct ddraw *ddraw;
182 unsigned int texture_location;
185 unsigned int sub_resource_idx;
189
190 /* This implementation handles attaching surfaces to other surfaces */
194
195 /* Complex surfaces are organized in a tree, although the tree is degenerated to a list in most cases.
196 * In mipmap and primary surfaces each level has only one attachment, which is the next surface level.
197 * Only the cube texture root has 6 surfaces attached, which then have a normal mipmap chain attached
198 * to them. So hardcode the array to 6, a dynamic array or a list would be an overkill.
199 */
200#define MAX_COMPLEX_ATTACHED 6
202 /* You can't traverse the tree upwards. Only a flag for Surface::Release because it's needed there,
203 * but no pointer to prevent temptations to traverse it in the wrong direction.
204 */
205 unsigned int is_root : 1;
206 unsigned int is_lost : 1;
207 unsigned int sysmem_fallback : 1;
208
209 /* Surface description, for GetAttachedSurface */
211
212 /* Clipper objects */
215
216 /* For the ddraw surface list */
218
221};
222
224{
225 unsigned int version;
227
230
232};
233
234HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc,
235 struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version);
238 const RECT *rect, BOOL read, unsigned int swap_interval);
239
240static inline struct ddraw_surface *impl_from_IDirect3DTexture(IDirect3DTexture *iface)
241{
243}
244
245static inline struct ddraw_surface *impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface)
246{
248}
249
250static inline struct ddraw_surface *impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
251{
253}
254
255static inline struct ddraw_surface *impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface)
256{
258}
259
260static inline struct ddraw_surface *impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface)
261{
263}
264
265static inline struct ddraw_surface *impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface)
266{
268}
269
271{
273}
274
275struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface);
276struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface);
278
279struct ddraw_surface *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface);
280struct ddraw_surface *unsafe_impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface);
281
282#define DDRAW_INVALID_HANDLE ~0U
283
285{
291};
292
294{
295 void *object;
297};
298
300{
305};
306
313
314struct d3d_device
315{
316 /* IUnknown */
317 IDirect3DDevice7 IDirect3DDevice7_iface;
318 IDirect3DDevice3 IDirect3DDevice3_iface;
319 IDirect3DDevice2 IDirect3DDevice2_iface;
320 IDirect3DDevice IDirect3DDevice_iface;
326
330 struct ddraw *ddraw;
334
336
337 /* Viewport management */
341
342 /* Required to keep track which of two available texture blending modes in d3ddevice3 is used */
345
346 struct wined3d_matrix legacy_projection, legacy_clipspace;
347
348 /* Light state */
350
351 /* Rendering functions to wrap D3D(1-3) to D3D7 */
359
360 /* Handle management */
363
365
368
369 /* For temporary saving state during reset. */
371};
372
373HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_surface *target, IUnknown *rt_iface,
374 UINT version, struct d3d_device **device, IUnknown *outer_unknown);
376
377/* The IID */
378extern const GUID IID_D3DDEVICE_WineD3D;
379
380static inline struct d3d_device *impl_from_IDirect3DDevice(IDirect3DDevice *iface)
381{
383}
384
385static inline struct d3d_device *impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface)
386{
388}
389
390static inline struct d3d_device *impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface)
391{
393}
394
395static inline struct d3d_device *impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface)
396{
398}
399
400struct d3d_device *unsafe_impl_from_IDirect3DDevice(IDirect3DDevice *iface);
401struct d3d_device *unsafe_impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface);
402struct d3d_device *unsafe_impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface);
403struct d3d_device *unsafe_impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface);
404
406{
407 IDirectDrawClipper IDirectDrawClipper_iface;
410 HRGN region;
412};
413
415struct ddraw_clipper *unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *iface);
416BOOL ddraw_clipper_is_valid(const struct ddraw_clipper *clipper);
417
418/*****************************************************************************
419 * IDirectDrawPalette implementation structure
420 *****************************************************************************/
422{
423 /* IUnknown fields */
424 IDirectDrawPalette IDirectDrawPalette_iface;
426
428 struct ddraw *ddraw;
431};
432
433static inline struct ddraw_palette *impl_from_IDirectDrawPalette(IDirectDrawPalette *iface)
434{
436}
437
438struct ddraw_palette *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface);
439
441 struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries);
442
443/* Helper structures */
445{
446 const CLSID *clsid;
448 void **ppObj);
449};
450
451/******************************************************************************
452 * IDirect3DLight implementation structure - Wraps to D3D7
453 ******************************************************************************/
455{
456 IDirect3DLight IDirect3DLight_iface;
458
459 /* IDirect3DLight fields */
460 struct ddraw *ddraw;
461
462 /* If this light is active for one viewport, put the viewport here */
464
467
469
470 struct list entry;
471};
472
473/* Helper functions */
474void light_activate(struct d3d_light *light);
475void light_deactivate(struct d3d_light *light);
476void d3d_light_init(struct d3d_light *light, struct ddraw *ddraw);
477struct d3d_light *unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface);
478
479/******************************************************************************
480 * IDirect3DMaterial implementation structure - Wraps to D3D7
481 ******************************************************************************/
483{
484 IDirect3DMaterial3 IDirect3DMaterial3_iface;
485 IDirect3DMaterial2 IDirect3DMaterial2_iface;
486 IDirect3DMaterial IDirect3DMaterial_iface;
488
489 /* IDirect3DMaterial2 fields */
490 struct ddraw *ddraw;
492
495};
496
497/* Helper functions */
500
502{
506};
507
508/*****************************************************************************
509 * IDirect3DViewport - Wraps to D3D7
510 *****************************************************************************/
512{
513 IDirect3DViewport3 IDirect3DViewport3_iface;
515
516 /* IDirect3DViewport fields */
517 struct ddraw *ddraw;
518
519 /* If this viewport is active for one device, put the device here */
521
524
526
527 union
528 {
532
533 struct list entry;
536};
537
538struct d3d_viewport *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *iface);
539struct d3d_viewport *unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *iface);
540struct d3d_viewport *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface);
541
542/* Helper functions */
543void viewport_activate(struct d3d_viewport *viewport, BOOL ignore_lights);
544void viewport_deactivate(struct d3d_viewport *viewport);
545void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw);
546
547/*****************************************************************************
548 * IDirect3DExecuteBuffer - Wraps to D3D7
549 *****************************************************************************/
551{
552 IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface;
554 /* IDirect3DExecuteBuffer fields */
555 struct ddraw *ddraw;
557
560
561 /* This buffer will store the transformed vertices */
562 unsigned int index_size, index_pos;
565
566 /* This flags is set to TRUE if we allocated ourselves the
567 * data buffer
568 */
570};
571
574struct d3d_execute_buffer *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface);
575
576/* The execute function */
578 struct d3d_device *device);
579
580/*****************************************************************************
581 * IDirect3DVertexBuffer
582 *****************************************************************************/
584{
585 IDirect3DVertexBuffer7 IDirect3DVertexBuffer7_iface;
587 unsigned int version;
588
589 /*** WineD3D and ddraw links ***/
592 struct ddraw *ddraw;
593
594 /*** Storage for D3D7 specific things ***/
600 bool sysmem;
601};
602
605struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface);
606struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface);
607
608/*****************************************************************************
609 * Helper functions from utils.c
610 *****************************************************************************/
611
612#define GET_TEXCOUNT_FROM_FVF(d3dvtVertexType) \
613 (((d3dvtVertexType) & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT)
614
615#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
616 (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
617
621 DWORD colour, struct wined3d_color *wined3d_colour);
623unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags);
624void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd);
625void dump_D3DMATRIX(const D3DMATRIX *mat);
626void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps);
627DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
628void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in);
629void DDRAW_dump_cooperativelevel(DWORD cooplevel);
632
633void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1,
634 const struct wined3d_matrix *src2);
635
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}
642
644{
647 return !!(fmt->dwFlags & flags);
648}
649
650static inline BOOL ddraw_surface_can_be_lost(const struct ddraw_surface *surface)
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}
662
663#define DDRAW_SURFACE_READ 0x00000001
664#define DDRAW_SURFACE_WRITE 0x00000002
665#define DDRAW_SURFACE_RW (DDRAW_SURFACE_READ | DDRAW_SURFACE_WRITE)
666
667static inline struct wined3d_texture *ddraw_surface_get_default_texture(struct ddraw_surface *surface, unsigned int flags)
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}
684
685static inline struct wined3d_texture *ddraw_surface_get_draw_texture(struct ddraw_surface *surface, unsigned int flags)
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}
703
704static inline struct wined3d_texture *ddraw_surface_get_any_texture(struct ddraw_surface *surface, unsigned int flags)
705{
709
711 return ddraw_surface_get_draw_texture(surface, flags);
712}
713
715void d3d_device_apply_state(struct d3d_device *device, BOOL clear_state);
716
717/* Used for generic dumping */
719{
721 const char *name;
722};
723
724#define FE(x) { x, #x }
725
727{
729 const char *name;
730 void (*func)(const void *);
732};
733
734/* Structure copy */
735#define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }
736
737#define DD_STRUCT_COPY_BYSIZE_(to,from,to_size,from_size) \
738 do { \
739 DWORD __size = (to)->dwSize; \
740 DWORD __resetsize = min(to_size, sizeof(*to)); \
741 DWORD __copysize = min(__resetsize, from_size); \
742 assert(to != from); \
743 memcpy(to, from, __copysize); \
744 memset((char*)(to) + __copysize, 0, __resetsize - __copysize); \
745 (to)->dwSize = __size; /* restore size */ \
746 } while (0)
747
748#define DD_STRUCT_COPY_BYSIZE(to,from) DD_STRUCT_COPY_BYSIZE_(to,from,(to)->dwSize,(from)->dwSize)
749
751
754
755#endif
#define read
Definition: acwin.h:97
Definition: list.h:39
RECT rect
Definition: combotst.c:67
#define D3DMAXUSERCLIPPLANES
Definition: d3d8types.h:75
D3DPRIMITIVETYPE
Definition: d3dtypes.h:822
D3DTEXTUREBLEND
Definition: d3dtypes.h:735
DWORD D3DMATRIXHANDLE
Definition: d3dtypes.h:156
#define DDRAW_SURFACE_WRITE
struct d3d_device * unsafe_impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface)
Definition: device.c:6789
static struct wined3d_texture * ddraw_surface_get_any_texture(struct ddraw_surface *surface, unsigned int flags)
enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format)
Definition: utils.c:330
void d3d_device_apply_state(struct d3d_device *device, BOOL clear_state)
Definition: device.c:3454
void light_activate(struct d3d_light *light)
Definition: light.c:48
void * ddraw_free_handle(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
Definition: main.c:184
void viewport_activate(struct d3d_viewport *viewport, BOOL ignore_lights)
Definition: viewport.c:51
unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags)
Definition: utils.c:561
void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
Definition: utils.c:1153
void viewport_alloc_active_light_index(struct d3d_light *light)
Definition: viewport.c:121
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
Definition: ddraw.c:1287
static struct wined3d_texture * ddraw_surface_get_default_texture(struct ddraw_surface *surface, unsigned int flags)
DWORD force_refresh_rate
Definition: main.c:38
void dump_D3DMATRIX(const D3DMATRIX *mat)
Definition: utils.c:906
void viewport_deactivate(struct d3d_viewport *viewport)
Definition: viewport.c:111
BOOL ddraw_clipper_is_valid(const struct ddraw_clipper *clipper)
Definition: clipper.c:33
static struct ddraw_surface * impl_from_IDirectDrawSurface3(IDirectDrawSurface3 *iface)
void light_deactivate(struct d3d_light *light)
Definition: light.c:74
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface)
Definition: surface.c:5966
struct d3d_viewport * unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface)
Definition: viewport.c:1224
static struct ddraw_surface * impl_from_IDirectDrawSurface4(IDirectDrawSurface4 *iface)
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RECT *rect, BOOL read, unsigned int swap_interval)
Definition: surface.c:61
HRESULT d3d_execute_buffer_init(struct d3d_execute_buffer *execute_buffer, struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc)
ddraw_device_state
Definition: ddraw_private.h:74
@ 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
void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw)
Definition: viewport.c:1232
void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out)
Definition: utils.c:1198
void DDSD2_to_DDSD(const DDSURFACEDESC2 *in, DDSURFACEDESC *out)
Definition: utils.c:1242
HRESULT ddraw_clipper_init(struct ddraw_clipper *clipper)
Definition: clipper.c:381
static struct ddraw_palette * impl_from_IDirectDrawPalette(IDirectDrawPalette *iface)
static struct ddraw_surface * impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
struct d3d_viewport * unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *iface)
Definition: viewport.c:1209
HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc)
Definition: vertexbuffer.c:443
void material_activate(struct d3d_material *material)
Definition: material.c:444
struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
Definition: vertexbuffer.c:510
struct d3d_device * unsafe_impl_from_IDirect3DDevice(IDirect3DDevice *iface)
Definition: device.c:6810
void * ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
Definition: main.c:213
HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version)
Definition: surface.c:6535
static BOOL format_is_compressed(const DDPIXELFORMAT *format)
#define DDRAW_SURFACE_LOCATION_DRAW
struct ddraw_clipper * unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *iface)
Definition: clipper.c:389
#define MAX_COMPLEX_ATTACHED
enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device *device)
Definition: device.c:6817
void ddraw_handle_table_destroy(struct ddraw_handle_table *t)
Definition: main.c:132
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
Definition: utils.c:710
struct ddraw_palette * unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface)
Definition: palette.c:232
struct wined3d_rendertarget_view * ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface)
Definition: surface.c:7053
struct ddraw_handle_table global_handle_table
Definition: main.c:40
static struct ddraw_surface * impl_from_IDirectDrawSurface2(IDirectDrawSurface2 *iface)
HRESULT hr_ddraw_from_wined3d(HRESULT hr)
Definition: utils.c:1183
void d3d_device_sync_surfaces(struct d3d_device *device)
Definition: device.c:3427
struct d3d_viewport * unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *iface)
Definition: viewport.c:1216
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd)
Definition: utils.c:857
static BOOL format_is_paletteindexed(const DDPIXELFORMAT *fmt)
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type)
Definition: ddraw.c:5079
#define DDRAW_SURFACE_LOCATION_DEFAULT
HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *execute_buffer, struct d3d_device *device)
Definition: executebuffer.c:48
void DDRAW_dump_cooperativelevel(DWORD cooplevel)
Definition: utils.c:960
void d3d_light_init(struct d3d_light *light, struct ddraw *ddraw)
Definition: light.c:250
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
Definition: surface.c:5950
static struct d3d_device * impl_from_IDirect3DDevice7(IDirect3DDevice7 *iface)
struct ddraw_surface * unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface)
Definition: surface.c:6037
BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
Definition: main.c:118
struct d3d_execute_buffer * unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface)
static void ddraw_set_swapchain_window(struct ddraw *ddraw, HWND window)
static struct ddraw_surface * impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface)
#define DDRAW_SURFACE_READ
struct d3d_vertex_buffer * unsafe_impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface)
struct d3d_device * unsafe_impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface)
Definition: device.c:6803
void ddraw_update_lost_surfaces(struct ddraw *ddraw)
Definition: ddraw.c:5031
struct wined3d_vertex_declaration * ddraw_find_decl(struct ddraw *ddraw, DWORD fvf)
Definition: ddraw.c:4917
struct ddraw_surface * unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *iface)
Definition: surface.c:6014
struct ddraw_surface * unsafe_impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface)
Definition: surface.c:6030
struct d3d_material * d3d_material_create(struct ddraw *ddraw)
Definition: material.c:498
static struct d3d_device * impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface)
struct d3d_light * unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface)
Definition: light.c:257
DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddraw_handle_type type)
Definition: main.c:138
ddraw_handle_type
@ DDRAW_HANDLE_STATEBLOCK
@ DDRAW_HANDLE_SURFACE
@ DDRAW_HANDLE_MATRIX
@ DDRAW_HANDLE_MATERIAL
@ DDRAW_HANDLE_FREE
void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut)
Definition: utils.c:953
static struct wined3d_texture * ddraw_surface_get_draw_texture(struct ddraw_surface *surface, unsigned int flags)
ddraw_viewport_version
@ DDRAW_VIEWPORT_VERSION_1
@ DDRAW_VIEWPORT_VERSION_NONE
@ DDRAW_VIEWPORT_VERSION_2
struct d3d_device * unsafe_impl_from_IDirect3DDevice3(IDirect3DDevice3 *iface)
Definition: device.c:6796
static struct d3d_device * impl_from_IDirect3DDevice(IDirect3DDevice *iface)
void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7)
Definition: ddraw.c:1203
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType)
Definition: utils.c:915
void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format, enum wined3d_format_id wined3d_format)
Definition: utils.c:30
static struct d3d_device * impl_from_IDirect3DDevice2(IDirect3DDevice2 *iface)
static BOOL ddraw_surface_can_be_lost(const struct ddraw_surface *surface)
static struct ddraw_surface * impl_from_IDirectDrawSurface7(IDirectDrawSurface7 *iface)
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: device.c:6959
BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddraw_palette *palette, DWORD colour, struct wined3d_color *wined3d_colour)
Definition: utils.c:593
static struct ddraw_surface * impl_from_IDirect3DTexture(IDirect3DTexture *iface)
HRESULT ddraw_palette_init(struct ddraw_palette *palette, struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries)
Definition: palette.c:256
void viewport_free_active_light_index(struct d3d_light *light)
Definition: viewport.c:159
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
Definition: ddraw.c:82
void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps)
Definition: utils.c:982
const GUID IID_D3DDEVICE_WineD3D
Definition: device.c:36
void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut)
Definition: utils.c:943
HRESULT hr
Definition: delayimp.cpp:582
device_type
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
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
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
Definition: texture.c:1649
static const WCHAR version[]
Definition: asmname.c:66
GUID guid
Definition: version.c:147
#define assert(_expr)
Definition: assert.h:32
int ptrdiff_t
Definition: corecrt.h:194
#define DDPF_FOURCC
Definition: ddsformat.c:58
#define DDPF_PALETTEINDEXED8
Definition: ddsformat.c:59
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble t
Definition: gl.h:2047
GLenum func
Definition: glext.h:6028
GLuint buffer
Definition: glext.h:5915
GLuint in
Definition: glext.h:9616
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
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
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
static HDC
Definition: imagelist.c:88
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
static const MAT2 mat
Definition: font.c:51
static IHTMLWindow2 * window
Definition: events.c:77
static HPALETTE palette
Definition: clipboard.c:1457
long LONG
Definition: pedump.c:60
#define REFIID
Definition: guiddef.h:118
DWORD IDirectDrawSurface7
Definition: vmrender.idl:20
DWORD IDirectDraw7
Definition: vmrender.idl:21
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define DDPF_PALETTEINDEXEDTO8
Definition: ddraw.h:507
#define DDPF_PALETTEINDEXED4
Definition: ddraw.h:506
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:269
#define DDPF_PALETTEINDEXED2
Definition: ddraw.h:515
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:260
#define DDPF_PALETTEINDEXED1
Definition: ddraw.h:514
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:263
struct wined3d_vertex_declaration * decl
Definition: ddraw_private.h:50
DWORD fvf
Definition: d3d8_private.h:96
Definition: dcommon.idl:28
DWORD dwCaps
Definition: ddraw.h:734
DDSCAPS2 ddsCaps
Definition: ddraw.h:1190
struct wined3d_device_context * immediate_context
struct list viewport_list
struct d3d_device_context_state * state
IUnknown * outer_unknown
D3DPRIMITIVETYPE primitive_type
BOOL have_draw_textures
BYTE * sysmem_vertex_buffer
IDirect3DDevice3 IDirect3DDevice3_iface
BOOL hardware_device
struct wined3d_stateblock * recording
DWORD nb_vertices
IUnknown * rt_iface
DWORD vertex_size
struct wined3d_stateblock * update_state
D3DMATRIXHANDLE proj
struct ddraw_surface * target_ds
DWORD render_flags
D3DMATRIXHANDLE world
struct d3d_viewport * current_viewport
DWORD vertex_type
IUnknown IUnknown_inner
IDirect3DDevice2 IDirect3DDevice2_iface
struct list ddraw_entry
DWORD buffer_size
BOOL legacyTextureBlending
DWORD material
struct wined3d_matrix legacy_projection legacy_clipspace
D3DVIEWPORT7 active_viewport
IDirect3DDevice IDirect3DDevice_iface
struct ddraw_surface * target
struct wined3d_device * wined3d_device
struct wined3d_vec4 user_clip_planes[D3DMAXUSERCLIPPLANES]
struct ddraw * ddraw
IDirect3DDevice7 IDirect3DDevice7_iface
struct wined3d_stateblock * saved_state
D3DTEXTUREBLEND texture_map_blend
struct wined3d_streaming_buffer vertex_buffer index_buffer
const struct wined3d_stateblock_state * stateblock_state
D3DMATRIXHANDLE view
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface
struct wined3d_buffer * index_buffer
unsigned int index_pos
D3DEXECUTEBUFFERDESC desc
unsigned int index_size
struct wined3d_buffer * dst_vertex_buffer
unsigned int src_vertex_pos
struct ddraw * ddraw
unsigned int vertex_size
struct d3d_device * d3ddev
D3DEXECUTEDATA data
struct wined3d_buffer * src_vertex_buffer
struct list entry
D3DLIGHT2 light
struct d3d_viewport * active_viewport
struct ddraw * ddraw
D3DLIGHT7 light7
DWORD active_light_index
IDirect3DLight IDirect3DLight_iface
D3DMATERIAL mat
struct d3d_device * active_device
IDirect3DMaterial IDirect3DMaterial_iface
struct ddraw * ddraw
IDirect3DMaterial2 IDirect3DMaterial2_iface
IDirect3DMaterial3 IDirect3DMaterial3_iface
struct wined3d_vertex_declaration * wined3d_declaration
struct ddraw * ddraw
struct wined3d_buffer * wined3d_buffer
IDirect3DVertexBuffer7 IDirect3DVertexBuffer7_iface
unsigned int version
struct list light_list
enum ddraw_viewport_version version
struct ddraw * ddraw
struct d3d_device * active_device
struct d3d_material * background
IDirect3DViewport3 IDirect3DViewport3_iface
struct list entry
DWORD active_lights_count
union d3d_viewport::@288 viewports
D3DVIEWPORT vp1
D3DVIEWPORT2 vp2
IDirectDrawClipper IDirectDrawClipper_iface
enum ddraw_handle_type type
void * object
struct ddraw_handle_entry * free_entries
struct ddraw_handle_entry * entries
IUnknown * ifaceToRelease
struct wined3d_palette * wined3d_palette
IDirectDrawPalette IDirectDrawPalette_iface
struct ddraw * ddraw
IDirectDrawSurface IDirectDrawSurface_iface
struct wined3d_texture * draw_texture
IDirectDrawSurface2 IDirectDrawSurface2_iface
struct ddraw * ddraw
struct ddraw_clipper * clipper
IDirectDrawGammaControl IDirectDrawGammaControl_iface
DDSURFACEDESC2 surface_desc
unsigned int sysmem_fallback
unsigned int is_root
IUnknown * texture_outer
IUnknown * attached_iface
struct wined3d_private_store private_store
IDirectDrawSurface3 IDirectDrawSurface3_iface
struct ddraw_surface * first_attached
struct wined3d_rendertarget_view * wined3d_rtv
unsigned int sub_resource_idx
IDirect3DTexture IDirect3DTexture_iface
struct d3d_device * device1
struct ddraw_palette * palette
IDirectDrawSurface7 IDirectDrawSurface7_iface
struct ddraw_surface * next_attached
struct list surface_list_entry
IUnknown * ifaceToRelease
IDirectDrawSurface4 IDirectDrawSurface4_iface
struct ddraw_surface * complex_array[MAX_COMPLEX_ATTACHED]
unsigned int is_lost
unsigned int texture_location
struct wined3d_texture * wined3d_texture
IDirect3DTexture2 IDirect3DTexture2_iface
unsigned int version
struct ddraw_surface * root
void * texture_memory
struct wined3d_device * wined3d_device
DDSURFACEDESC2 surface_desc
struct wined3d_texture * gdi_surface
DWORD flags
struct wined3d_swapchain_state_parent state_parent
IDirectDraw2 IDirectDraw2_iface
Definition: ddraw_private.h:85
IDirect3D3 IDirect3D3_iface
Definition: ddraw_private.h:88
LONG ref1
Definition: ddraw_private.h:94
struct ddraw_surface * primary
HWND d3d_window
RECT primary_lock
struct wined3d_device * wined3d_device
Definition: ddraw_private.h:99
LONG device_state
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:83
HWND devicewindow
DWORD prev_frame_time
IDirect3D IDirect3D_iface
Definition: ddraw_private.h:90
struct wined3d_device_context * immediate_context
unsigned int frames
LONG ref7
Definition: ddraw_private.h:94
DWORD cooperative_level
struct wined3d_swapchain * wined3d_swapchain
struct list d3ddevice_list
struct list surface_list
IDirectDraw4 IDirectDraw4_iface
Definition: ddraw_private.h:84
HWND swapchain_window
struct list ddraw_list_entry
LONG numIfaces
Definition: ddraw_private.h:94
LONG ref4
Definition: ddraw_private.h:94
IDirect3D7 IDirect3D7_iface
Definition: ddraw_private.h:87
struct FvfToDecl * decls
HWND dest_window
struct wined3d_output * wined3d_output
Definition: ddraw_private.h:98
struct d3d_device * device_last_applied_state
HWND focuswindow
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
LONG ref2
Definition: ddraw_private.h:94
LONG ref3
Definition: ddraw_private.h:94
int d3dversion
UINT numConvertedDecls
struct wined3d_adapter * wined3d_adapter
Definition: ddraw_private.h:97
IDirectDraw IDirectDraw_iface
Definition: ddraw_private.h:86
UINT declArraySize
Definition: devices.h:37
const char * name
Definition: dsound.c:943
ptrdiff_t offset
const char * name
const CLSID * clsid
Definition: main.c:56
HRESULT(* pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: main.c:57
Definition: tools.h:99
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define HRESULT
Definition: msvc.h:7
wined3d_format_id
Definition: wined3d.h:126
@ WINED3DFMT_DXT2
Definition: wined3d.h:261
@ WINED3DFMT_DXT1
Definition: wined3d.h:260
@ WINED3DFMT_DXT3
Definition: wined3d.h:262
@ WINED3DFMT_DXT4
Definition: wined3d.h:263
@ WINED3DFMT_DXT5
Definition: wined3d.h:264
wined3d_depth_buffer_type
Definition: wined3d.h:472
wined3d_device_type
Definition: wined3d.h:90
unsigned char BYTE
Definition: xxhash.c:193