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