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