Changed wsock32 to use the new iphlpapi for interface and route
[wine/wine64.git] / dlls / ddraw / d3d_private.h
blob2c0af80605ed01c01a1b442d96a8540c00ef5b7c
1 /* Direct3D private include file
2 * Copyright (c) 1998 Lionel ULMER
4 * This file contains all the structure that are not exported
5 * through d3d.h and all common macros.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __GRAPHICS_WINE_D3D_PRIVATE_H
23 #define __GRAPHICS_WINE_D3D_PRIVATE_H
25 /* THIS FILE MUST NOT CONTAIN X11 or MESA DEFINES */
27 #include "d3d.h"
29 #define MAX_TEXTURES 8
30 #define MAX_LIGHTS 16
32 #define HIGHEST_RENDER_STATE 152
33 #define HIGHEST_TEXTURE_STAGE_STATE 24
35 /*****************************************************************************
36 * Predeclare the interface implementation structures
38 typedef struct IDirect3DImpl IDirect3DImpl;
39 typedef struct IDirect3DLightImpl IDirect3DLightImpl;
40 typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
41 typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
42 typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
43 typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
44 typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
46 #include "ddraw_private.h"
48 typedef struct STATEBLOCKFLAGS {
49 BOOL render_state[HIGHEST_RENDER_STATE];
50 BOOL texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE];
51 } STATEBLOCKFLAGS;
53 typedef struct STATEBLOCK {
54 STATEBLOCKFLAGS set_flags;
55 DWORD render_state[HIGHEST_RENDER_STATE];
56 DWORD texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE];
57 } STATEBLOCK;
59 /*****************************************************************************
60 * IDirect3D implementation structure.
61 * This is common for interfaces 1, 2, 3 and 7.
63 struct IDirect3DImpl
65 ICOM_VFIELD_MULTI(IDirect3D7);
66 ICOM_VFIELD_MULTI(IDirect3D3);
67 ICOM_VFIELD_MULTI(IDirect3D2);
68 ICOM_VFIELD_MULTI(IDirect3D);
69 DWORD ref;
70 /* IDirect3D fields */
71 IDirectDrawImpl* ddraw;
73 /* Used as a callback function to create a texture */
74 HRESULT (*create_texture)(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *tex, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main);
76 /* Used as a callback for Devices to tell to the D3D object it's been created */
77 HRESULT (*added_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
78 HRESULT (*removed_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
80 /* This is needed for delayed texture creation and Z buffer blits */
81 IDirect3DDeviceImpl *current_device;
84 /*****************************************************************************
85 * IDirect3DLight implementation structure
87 struct IDirect3DLightImpl
89 ICOM_VFIELD_MULTI(IDirect3DLight);
90 DWORD ref;
91 /* IDirect3DLight fields */
92 IDirect3DImpl *d3d;
93 /* If this light is active for one viewport, put the viewport here */
94 IDirect3DViewportImpl *active_viewport;
96 D3DLIGHT2 light;
97 D3DLIGHT7 light7;
99 DWORD dwLightIndex;
101 /* Chained list used for adding / removing from viewports */
102 IDirect3DLightImpl *next;
104 /* Activation function */
105 void (*activate)(IDirect3DLightImpl*);
106 void (*desactivate)(IDirect3DLightImpl*);
107 void (*update)(IDirect3DLightImpl*);
110 /*****************************************************************************
111 * IDirect3DMaterial implementation structure
113 struct IDirect3DMaterialImpl
115 ICOM_VFIELD_MULTI(IDirect3DMaterial3);
116 ICOM_VFIELD_MULTI(IDirect3DMaterial2);
117 ICOM_VFIELD_MULTI(IDirect3DMaterial);
118 DWORD ref;
119 /* IDirect3DMaterial2 fields */
120 IDirect3DImpl *d3d;
121 IDirect3DDeviceImpl *active_device;
123 D3DMATERIAL mat;
125 void (*activate)(IDirect3DMaterialImpl* this);
128 /*****************************************************************************
129 * IDirect3DViewport implementation structure
131 struct IDirect3DViewportImpl
133 ICOM_VFIELD_MULTI(IDirect3DViewport3);
134 DWORD ref;
135 /* IDirect3DViewport fields */
136 IDirect3DImpl *d3d;
137 /* If this viewport is active for one device, put the device here */
138 IDirect3DDeviceImpl *active_device;
140 DWORD num_lights;
141 DWORD map_lights;
143 int use_vp2;
144 union {
145 D3DVIEWPORT vp1;
146 D3DVIEWPORT2 vp2;
147 } viewports;
149 /* Activation function */
150 void (*activate)(IDirect3DViewportImpl*);
152 /* Field used to chain viewports together */
153 IDirect3DViewportImpl *next;
155 /* Lights list */
156 IDirect3DLightImpl *lights;
158 /* Background material */
159 IDirect3DMaterialImpl *background;
162 /*****************************************************************************
163 * IDirect3DExecuteBuffer implementation structure
165 struct IDirect3DExecuteBufferImpl
167 ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
168 DWORD ref;
169 /* IDirect3DExecuteBuffer fields */
170 IDirect3DImpl *d3d;
171 IDirect3DDeviceImpl* d3ddev;
173 D3DEXECUTEBUFFERDESC desc;
174 D3DEXECUTEDATA data;
176 /* This buffer will store the transformed vertices */
177 void* vertex_data;
178 D3DVERTEXTYPE vertex_type;
180 /* This flags is set to TRUE if we allocated ourselves the
181 data buffer */
182 BOOL need_free;
184 void (*execute)(IDirect3DExecuteBufferImpl* this,
185 IDirect3DDeviceImpl* dev,
186 IDirect3DViewportImpl* vp);
189 /* Internal structure to store the state of the clipping planes */
190 typedef struct d3d7clippingplane
192 D3DVALUE plane[4];
193 } d3d7clippingplane;
195 /*****************************************************************************
196 * IDirect3DDevice implementation structure
199 #define WORLDMAT_CHANGED (0x00000001 << 0)
200 #define VIEWMAT_CHANGED (0x00000001 << 1)
201 #define PROJMAT_CHANGED (0x00000001 << 2)
203 struct IDirect3DDeviceImpl
205 ICOM_VFIELD_MULTI(IDirect3DDevice7);
206 ICOM_VFIELD_MULTI(IDirect3DDevice3);
207 ICOM_VFIELD_MULTI(IDirect3DDevice2);
208 ICOM_VFIELD_MULTI(IDirect3DDevice);
209 DWORD ref;
210 /* IDirect3DDevice fields */
211 IDirect3DImpl *d3d;
212 IDirectDrawSurfaceImpl *surface;
214 IDirect3DViewportImpl *viewport_list;
215 IDirect3DViewportImpl *current_viewport;
216 D3DVIEWPORT7 active_viewport;
218 IDirectDrawSurfaceImpl *current_texture[MAX_TEXTURES];
220 /* Current transformation matrices */
221 D3DMATRIX *world_mat;
222 D3DMATRIX *view_mat;
223 D3DMATRIX *proj_mat;
225 /* Current material used in D3D7 mode */
226 D3DMATERIAL7 current_material;
228 /* Light parameters */
229 DWORD active_lights, set_lights;
230 D3DLIGHT7 light_parameters[MAX_LIGHTS];
232 /* clipping planes */
233 DWORD max_clipping_planes;
234 d3d7clippingplane *clipping_planes;
236 void (*set_context)(IDirect3DDeviceImpl*);
237 HRESULT (*clear)(IDirect3DDeviceImpl *This,
238 DWORD dwCount,
239 LPD3DRECT lpRects,
240 DWORD dwFlags,
241 DWORD dwColor,
242 D3DVALUE dvZ,
243 DWORD dwStencil);
244 void (*matrices_updated)(IDirect3DDeviceImpl *This, DWORD matrices);
245 void (*set_matrices)(IDirect3DDeviceImpl *This, DWORD matrices,
246 D3DMATRIX *world_mat, D3DMATRIX *view_mat, D3DMATRIX *proj_mat);
248 STATEBLOCK state_block;
250 /* Used to prevent locks and rendering to overlap */
251 CRITICAL_SECTION crit;
254 /*****************************************************************************
255 * IDirect3DVertexBuffer implementation structure
257 struct IDirect3DVertexBufferImpl
259 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
260 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
261 DWORD ref;
262 IDirect3DImpl *d3d;
263 D3DVERTEXBUFFERDESC desc;
264 LPVOID *vertices;
265 DWORD vertex_buffer_size;
267 BOOLEAN processed;
270 /* Various dump and helper functions */
271 extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
272 extern void dump_D3DMATERIAL7(LPD3DMATERIAL7 lpMat);
273 extern void dump_D3DCOLORVALUE(D3DCOLORVALUE *lpCol);
274 extern void dump_D3DLIGHT7(LPD3DLIGHT7 lpLight);
275 extern void dump_DPFLAGS(DWORD dwFlags);
276 extern void dump_D3DMATRIX(D3DMATRIX *mat);
277 extern void dump_D3DVECTOR(D3DVECTOR *lpVec);
278 extern void dump_flexible_vertex(DWORD d3dvtVertexType);
279 extern DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
280 extern void convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided, DWORD dwStartVertex);
281 extern void dump_D3DVOP(DWORD dwVertexOp);
282 extern void dump_D3DPV(DWORD dwFlags);
284 extern const float id_mat[16];
286 #endif /* __GRAPHICS_WINE_D3D_PRIVATE_H */