Add support for Jack audio server.
[wine.git] / dlls / ddraw / mesa_private.h
blobf04a8c0da207a15299e688385f9785b5b3393fe9
1 /* MESA private include file
2 * Copyright (c) 1998 Lionel ULMER
4 * This file contains all structures 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_MESA_PRIVATE_H
23 #define __GRAPHICS_WINE_MESA_PRIVATE_H
25 #include "d3d_private.h"
27 #ifdef HAVE_OPENGL
29 #undef APIENTRY
30 #undef CALLBACK
31 #undef WINAPI
33 #define XMD_H /* This is to prevent the Xmd.h inclusion bug :-/ */
34 #include <GL/gl.h>
35 #include <GL/glx.h>
36 #ifdef HAVE_GL_GLEXT_H
37 # include <GL/glext.h>
38 #endif
39 #undef XMD_H
41 #undef APIENTRY
42 #undef CALLBACK
43 #undef WINAPI
45 /* Redefines the constants */
46 #define CALLBACK __stdcall
47 #define WINAPI __stdcall
48 #define APIENTRY WINAPI
50 /* X11 locking */
52 extern void (*wine_tsx11_lock_ptr)(void);
53 extern void (*wine_tsx11_unlock_ptr)(void);
55 /* As GLX relies on X, this is needed */
56 #define ENTER_GL() wine_tsx11_lock_ptr()
57 #define LEAVE_GL() wine_tsx11_unlock_ptr()
59 extern const GUID IID_D3DDEVICE_OpenGL;
61 typedef struct render_state {
62 /* This is used for the device mode */
63 GLenum src, dst;
64 /* This is used for textures */
65 GLenum mag, min;
66 } RenderState;
68 /* Common functions defined in d3dcommon.c */
69 void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
70 DWORD dwRenderState, RenderState *rs) ;
72 typedef struct IDirect3DGLImpl
74 struct IDirect3DImpl parent;
75 int free_lights;
76 void (*light_released)(IDirect3DImpl *, GLenum light_num);
77 } IDirect3DGLImpl;
79 typedef struct IDirect3DLightGLImpl
81 struct IDirect3DLightImpl parent;
82 GLenum light_num;
83 } IDirect3DLightGLImpl;
85 typedef struct IDirect3DTextureGLImpl
87 struct IDirect3DTextureImpl parent;
88 GLuint tex_name;
89 } IDirect3DTextureGLImpl;
91 typedef struct IDirect3DDeviceGLImpl
93 struct IDirect3DDeviceImpl parent;
95 GLXContext gl_context;
97 /* The current render state */
98 RenderState render_state;
100 /* The last type of vertex drawn */
101 BOOLEAN last_vertices_transformed;
102 BOOLEAN last_vertices_lit;
104 D3DMATRIX *world_mat;
105 D3DMATRIX *view_mat;
106 D3DMATRIX *proj_mat;
108 Display *display;
109 Drawable drawable;
110 } IDirect3DDeviceGLImpl;
112 /* All non-static functions 'exported' by various sub-objects */
113 extern HRESULT direct3d_create(IDirect3DImpl **obj, IDirectDrawImpl *ddraw);
114 extern HRESULT d3dtexture_create(IDirect3DTextureImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf);
115 extern HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum light_num);
116 extern HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirect3DImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
117 extern HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirect3DImpl *d3d);
118 extern HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d);
119 extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc, DWORD dwFlags);
120 extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surface);
122 /* Used for Direct3D to request the device to enumerate itself */
123 extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
124 extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ;
125 extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice);
127 /* Some helper functions.. Would need to put them in a better place */
128 extern void dump_flexible_vertex(DWORD d3dvtVertexType);
129 extern DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
131 /* Matrix copy WITH transposition */
132 #define conv_mat2(mat,gl_mat) \
134 TRACE("%f %f %f %f\n", (mat)->_11, (mat)->_12, (mat)->_13, (mat)->_14); \
135 TRACE("%f %f %f %f\n", (mat)->_21, (mat)->_22, (mat)->_23, (mat)->_24); \
136 TRACE("%f %f %f %f\n", (mat)->_31, (mat)->_32, (mat)->_33, (mat)->_34); \
137 TRACE("%f %f %f %f\n", (mat)->_41, (mat)->_42, (mat)->_43, (mat)->_44); \
138 (gl_mat)->_11 = (mat)->_11; \
139 (gl_mat)->_12 = (mat)->_21; \
140 (gl_mat)->_13 = (mat)->_31; \
141 (gl_mat)->_14 = (mat)->_41; \
142 (gl_mat)->_21 = (mat)->_12; \
143 (gl_mat)->_22 = (mat)->_22; \
144 (gl_mat)->_23 = (mat)->_32; \
145 (gl_mat)->_24 = (mat)->_42; \
146 (gl_mat)->_31 = (mat)->_13; \
147 (gl_mat)->_32 = (mat)->_23; \
148 (gl_mat)->_33 = (mat)->_33; \
149 (gl_mat)->_34 = (mat)->_43; \
150 (gl_mat)->_41 = (mat)->_14; \
151 (gl_mat)->_42 = (mat)->_24; \
152 (gl_mat)->_43 = (mat)->_34; \
153 (gl_mat)->_44 = (mat)->_44; \
156 /* Matrix copy WITHOUT transposition */
157 #define conv_mat(mat,gl_mat) \
159 TRACE("%f %f %f %f\n", (mat)->_11, (mat)->_12, (mat)->_13, (mat)->_14); \
160 TRACE("%f %f %f %f\n", (mat)->_21, (mat)->_22, (mat)->_23, (mat)->_24); \
161 TRACE("%f %f %f %f\n", (mat)->_31, (mat)->_32, (mat)->_33, (mat)->_34); \
162 TRACE("%f %f %f %f\n", (mat)->_41, (mat)->_42, (mat)->_43, (mat)->_44); \
163 memcpy(gl_mat, (mat), 16 * sizeof(float)); \
166 #define _dump_colorvalue(s,v) \
167 TRACE(" " s " : %f %f %f %f\n", \
168 (v).u1.r, (v).u2.g, (v).u3.b, (v).u4.a);
170 /* This structure contains all the function pointers to OpenGL extensions
171 that are used by Wine */
172 typedef struct {
173 void (*ptr_ColorTableEXT) (GLenum target, GLenum internalformat,
174 GLsizei width, GLenum format, GLenum type, const GLvoid *table);
175 } Mesa_DeviceCapabilities;
177 #endif /* HAVE_OPENGL */
179 #endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */