- implement FB => Texture blits
[wine/testsucceed.git] / dlls / ddraw / mesa_private.h
blob5bbab4098b26413306d734aafefa4f785adbde7f
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 #include "gl_private.h"
31 /* X11 locking */
33 extern void (*wine_tsx11_lock_ptr)(void);
34 extern void (*wine_tsx11_unlock_ptr)(void);
36 /* As GLX relies on X, this is needed */
37 #define ENTER_GL() wine_tsx11_lock_ptr()
38 #define LEAVE_GL() wine_tsx11_unlock_ptr()
40 extern const GUID IID_D3DDEVICE_OpenGL;
42 typedef enum {
43 SURFACE_GL,
44 SURFACE_MEMORY,
45 SURFACE_MEMORY_DIRTY
46 } SURFACE_STATE;
48 typedef struct IDirect3DGLImpl
50 struct IDirect3DImpl parent;
51 DWORD free_lights;
52 void (*light_released)(IDirect3DImpl *, GLenum light_num);
53 } IDirect3DGLImpl;
55 typedef struct IDirect3DLightGLImpl
57 struct IDirect3DLightImpl parent;
58 GLenum light_num;
59 } IDirect3DLightGLImpl;
61 /* This structure is used for the 'private' field of the IDirectDrawSurfaceImpl structure */
62 typedef struct IDirect3DTextureGLImpl
64 GLuint tex_name;
65 BOOLEAN loaded; /* For the moment, this is here.. Should be part of surface management though */
67 /* Texture upload management */
68 BOOLEAN initial_upload_done;
69 SURFACE_STATE dirty_flag;
71 /* Surface optimization */
72 void *surface_ptr;
74 /* This is for now used to override 'standard' surface stuff to be as transparent as possible */
75 void (*final_release)(struct IDirectDrawSurfaceImpl *This);
76 void (*lock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect, DWORD dwFlags);
77 void (*unlock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect);
78 void (*set_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal);
79 } IDirect3DTextureGLImpl;
81 typedef enum {
82 GL_TRANSFORM_NONE = 0,
83 GL_TRANSFORM_ORTHO,
84 GL_TRANSFORM_NORMAL,
85 GL_TRANSFORM_VERTEXBUFFER
86 } GL_TRANSFORM_STATE;
88 typedef struct IDirect3DDeviceGLImpl
90 struct IDirect3DDeviceImpl parent;
92 GLXContext gl_context;
94 /* The last type of vertex drawn */
95 GL_TRANSFORM_STATE transform_state;
97 /* Used to handle fogging faster... */
98 BYTE fog_table[3 * 0x10000]; /* 3 is for R, G and B
99 0x10000 is 0xFF for the vertex color and
100 0xFF for the fog intensity */
102 Display *display;
103 Drawable drawable;
105 GLuint unlock_tex;
106 SURFACE_STATE state, front_state;
107 IDirectDrawSurfaceImpl *lock_surf, *front_lock_surf;
108 } IDirect3DDeviceGLImpl;
110 /* This is for the OpenGL additions... */
111 typedef struct {
112 struct IDirect3DVertexBufferImpl parent;
114 DWORD dwVertexTypeDesc;
115 D3DMATRIX world_mat, view_mat, proj_mat;
116 LPVOID vertices;
117 } IDirect3DVertexBufferGLImpl;
119 /* All non-static functions 'exported' by various sub-objects */
120 extern HRESULT direct3d_create(IDirect3DImpl **obj, IDirectDrawImpl *ddraw);
121 extern HRESULT d3dtexture_create(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main_surf);
122 extern HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum light_num);
123 extern HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirect3DImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
124 extern HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirect3DImpl *d3d);
125 extern HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d);
126 extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc, DWORD dwFlags);
127 extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surface);
129 /* Used for Direct3D to request the device to enumerate itself */
130 extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD version) ;
131 extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ;
132 extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice);
134 /* Used to upload the texture */
135 extern HRESULT gltex_upload_texture(IDirectDrawSurfaceImpl *This) ;
137 /* Used to set-up our orthographic projection */
138 extern void d3ddevice_set_ortho(IDirect3DDeviceImpl *This) ;
140 /* Rendering state management functions */
141 extern void set_render_state(IDirect3DDeviceImpl* This, D3DRENDERSTATETYPE dwRenderStateType, STATEBLOCK *lpStateBlock);
142 extern void store_render_state(IDirect3DDeviceImpl *This, D3DRENDERSTATETYPE dwRenderStateType, DWORD dwRenderState, STATEBLOCK* lpStateBlock);
143 extern void get_render_state(IDirect3DDeviceImpl *This, D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState, STATEBLOCK* lpStateBlock);
144 extern void apply_render_state(IDirect3DDeviceImpl* This, STATEBLOCK* lpStateBlock);
146 /* This structure contains all the function pointers to OpenGL extensions
147 that are used by Wine */
148 typedef struct {
149 void (*ptr_ColorTableEXT) (GLenum target, GLenum internalformat,
150 GLsizei width, GLenum format, GLenum type, const GLvoid *table);
151 } Mesa_DeviceCapabilities;
153 #endif /* HAVE_OPENGL */
155 #endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */