Define __fastcall.
[wine] / dlls / ddraw / mesa_private.h
1 /* MESA private include file
2    (c) 1998 Lionel ULMER
3    
4    This files contains all the structure that are not exported
5    through d3d.h and all common macros. */
6
7 #ifndef __GRAPHICS_WINE_MESA_PRIVATE_H
8 #define __GRAPHICS_WINE_MESA_PRIVATE_H
9
10 #include "d3d_private.h"
11
12 #include "wine_gl.h"
13 #include "x11drv.h"
14
15 #undef USE_OSMESA
16
17 #include "x11_private.h"
18
19 /*****************************************************************************
20  * IDirect3DLight MESA private structure
21  */
22 typedef struct mesa_d3dl_private
23 {
24     GLenum              light_num;
25 } mesa_d3dl_private;
26
27 /*****************************************************************************
28  * IDirect3DTexture2 MESA private structure
29  */
30 typedef struct mesa_d3dt_private
31 {
32     GLuint                   tex_name;
33 } mesa_d3dt_private;
34
35 /*****************************************************************************
36  * IDirect3DViewport2 implementation structure
37  */
38 typedef struct mesa_d3dv_private
39 {
40     GLenum                      nextlight;
41 } mesa_d3dv_private;
42
43 #ifdef USE_OSMESA
44 # define LEAVE_GL() ;
45 # define ENTER_GL() ;
46 #else
47 # define LEAVE_GL() LeaveCriticalSection( &X11DRV_CritSection )
48 # define ENTER_GL() EnterCriticalSection( &X11DRV_CritSection )
49 #endif
50
51 /* Matrix copy WITH transposition */
52 #define conv_mat2(mat,gl_mat)                   \
53 {                                               \
54     TRACE("%f %f %f %f\n", (mat)->_11, (mat)->_12, (mat)->_13, (mat)->_14); \
55     TRACE("%f %f %f %f\n", (mat)->_21, (mat)->_22, (mat)->_23, (mat)->_24); \
56     TRACE("%f %f %f %f\n", (mat)->_31, (mat)->_32, (mat)->_33, (mat)->_34); \
57     TRACE("%f %f %f %f\n", (mat)->_41, (mat)->_42, (mat)->_43, (mat)->_44); \
58     (gl_mat)[ 0] = (mat)->_11;                  \
59     (gl_mat)[ 1] = (mat)->_21;                  \
60     (gl_mat)[ 2] = (mat)->_31;                  \
61     (gl_mat)[ 3] = (mat)->_41;                  \
62     (gl_mat)[ 4] = (mat)->_12;                  \
63     (gl_mat)[ 5] = (mat)->_22;                  \
64     (gl_mat)[ 6] = (mat)->_32;                  \
65     (gl_mat)[ 7] = (mat)->_42;                  \
66     (gl_mat)[ 8] = (mat)->_13;                  \
67     (gl_mat)[ 9] = (mat)->_23;                  \
68     (gl_mat)[10] = (mat)->_33;                  \
69     (gl_mat)[11] = (mat)->_43;                  \
70     (gl_mat)[12] = (mat)->_14;                  \
71     (gl_mat)[13] = (mat)->_24;                  \
72     (gl_mat)[14] = (mat)->_34;                  \
73     (gl_mat)[15] = (mat)->_44;                  \
74 };
75
76 /* Matrix copy WITHOUT transposition */
77 #define conv_mat(mat,gl_mat)                    \
78 {                                               \
79     TRACE("%f %f %f %f\n", (mat)->_11, (mat)->_12, (mat)->_13, (mat)->_14); \
80     TRACE("%f %f %f %f\n", (mat)->_21, (mat)->_22, (mat)->_23, (mat)->_24); \
81     TRACE("%f %f %f %f\n", (mat)->_31, (mat)->_32, (mat)->_33, (mat)->_34); \
82     TRACE("%f %f %f %f\n", (mat)->_41, (mat)->_42, (mat)->_43, (mat)->_44); \
83     memcpy(gl_mat, (mat), 16 * sizeof(float));      \
84 };
85
86 typedef struct render_state {
87   /* This is used for the device mode */
88   GLenum src, dst;
89   /* This is used for textures */
90   GLenum mag, min;
91 } RenderState;
92
93 typedef struct mesa_d3dd_private {
94 #ifdef USE_OSMESA
95     OSMesaContext ctx;
96     unsigned char *buffer;
97 #else
98     GLXContext ctx;
99 #endif
100
101     /* The current render state */
102     RenderState rs;
103
104     /* The last type of vertex drawn */
105     D3DVERTEXTYPE vt;
106
107     D3DMATRIX *world_mat;
108     D3DMATRIX *view_mat;
109     D3DMATRIX *proj_mat;
110 } mesa_d3dd_private;
111
112 #define _dump_colorvalue(s,v)               \
113     TRACE(" " s " : %f %f %f %f\n",           \
114             (v).r.r, (v).g.g, (v).b.b, (v).a.a);
115
116 /* Common functions defined in d3dcommon.c */
117 void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
118                       DWORD dwRenderState, RenderState *rs) ;
119
120 /* All non-static functions 'exported' by various sub-objects */
121 extern LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurface4Impl* surf);
122 extern LPDIRECT3DTEXTURE d3dtexture_create(IDirectDrawSurface4Impl* surf);
123
124 extern LPDIRECT3DLIGHT d3dlight_create_dx3(IDirect3DImpl* d3d1);
125 extern LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2);
126
127 extern LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
128
129 extern LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1);
130 extern LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2);
131
132 extern LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1);
133 extern LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2);
134
135 extern int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDeviceImpl** device);
136 extern int d3d_OpenGL_dx3(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
137 extern int d3d_OpenGL(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
138 extern int is_OpenGL(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevice2Impl** device, IDirect3D2Impl* d3d);
139
140 extern LPDIRECT3DTEXTURE2 mesa_d3dtexture2_create(IDirectDrawSurface4Impl*);
141 extern LPDIRECT3DTEXTURE mesa_d3dtexture_create(IDirectDrawSurface4Impl*);
142
143 static const GUID WINE_UNUSED IID_D3DDEVICE2_OpenGL = {
144   0x39a0da38,
145   0x7e57,
146   0x11d2,
147   { 0x8b,0x7c,0x0e,0x4e,0xd8,0x3c,0x2b,0x3c }
148 };
149
150 static const GUID WINE_UNUSED IID_D3DDEVICE_OpenGL = {
151   0x31416d44,
152   0x86ae,
153   0x11d2,
154   { 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfa }
155 };
156
157 extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
158 extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
159 #endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */