2000-04-09 14:30:50 +00:00
|
|
|
/* MESA private include file
|
2002-03-09 23:29:33 +00:00
|
|
|
* Copyright (c) 1998 Lionel ULMER
|
|
|
|
*
|
|
|
|
* This file contains all structures that are not exported
|
|
|
|
* through d3d.h and all common macros.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-09 23:29:33 +00:00
|
|
|
*/
|
2000-04-09 14:30:50 +00:00
|
|
|
|
|
|
|
#ifndef __GRAPHICS_WINE_MESA_PRIVATE_H
|
|
|
|
#define __GRAPHICS_WINE_MESA_PRIVATE_H
|
|
|
|
|
|
|
|
#include "d3d_private.h"
|
|
|
|
|
2002-09-29 18:05:32 +00:00
|
|
|
#ifdef HAVE_OPENGL
|
|
|
|
|
2003-06-04 20:13:21 +00:00
|
|
|
#include "gl_private.h"
|
2002-09-25 00:29:56 +00:00
|
|
|
|
|
|
|
/* X11 locking */
|
|
|
|
|
|
|
|
extern void (*wine_tsx11_lock_ptr)(void);
|
|
|
|
extern void (*wine_tsx11_unlock_ptr)(void);
|
|
|
|
|
|
|
|
/* As GLX relies on X, this is needed */
|
|
|
|
#define ENTER_GL() wine_tsx11_lock_ptr()
|
|
|
|
#define LEAVE_GL() wine_tsx11_unlock_ptr()
|
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
extern const GUID IID_D3DDEVICE_OpenGL;
|
2000-04-09 14:30:50 +00:00
|
|
|
|
2003-06-04 23:10:38 +00:00
|
|
|
typedef enum {
|
|
|
|
SURFACE_GL,
|
|
|
|
SURFACE_MEMORY,
|
|
|
|
SURFACE_MEMORY_DIRTY
|
|
|
|
} SURFACE_STATE;
|
|
|
|
|
2003-06-04 23:31:39 +00:00
|
|
|
/* This structure is used for the 'd3d_private' field of the IDirectDraw structure */
|
2002-11-21 21:04:16 +00:00
|
|
|
typedef struct IDirect3DGLImpl
|
2000-04-09 14:30:50 +00:00
|
|
|
{
|
2005-10-31 10:05:15 +00:00
|
|
|
int dummy; /* Empty for the moment */
|
2002-11-21 21:04:16 +00:00
|
|
|
} IDirect3DGLImpl;
|
2000-04-09 14:30:50 +00:00
|
|
|
|
2002-12-15 01:17:59 +00:00
|
|
|
/* This structure is used for the 'private' field of the IDirectDrawSurfaceImpl structure */
|
2002-11-21 21:04:16 +00:00
|
|
|
typedef struct IDirect3DTextureGLImpl
|
2000-04-09 14:30:50 +00:00
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
GLuint tex_name;
|
2002-12-15 01:17:59 +00:00
|
|
|
BOOLEAN loaded; /* For the moment, this is here.. Should be part of surface management though */
|
2005-04-11 12:51:22 +00:00
|
|
|
IDirectDrawSurfaceImpl *main; /* Pointer to the 'main' surface of the mip-map set */
|
|
|
|
|
2003-01-03 21:17:47 +00:00
|
|
|
/* Texture upload management */
|
|
|
|
BOOLEAN initial_upload_done;
|
2003-06-04 23:10:38 +00:00
|
|
|
SURFACE_STATE dirty_flag;
|
2003-01-03 21:17:47 +00:00
|
|
|
|
2003-06-04 23:34:58 +00:00
|
|
|
/* This is used to optimize dirty checking in case of mipmapping.
|
|
|
|
Note that a bitmap could have been used but it was not worth the pain as it will be very rare
|
|
|
|
to have only one mipmap level change...
|
|
|
|
|
|
|
|
The __global_dirty_flag will only be set for the main mipmap level.
|
|
|
|
*/
|
|
|
|
SURFACE_STATE __global_dirty_flag;
|
|
|
|
SURFACE_STATE *global_dirty_flag;
|
|
|
|
|
|
|
|
/* This is to optimize the 'per-texture' parameters. */
|
|
|
|
DWORD *tex_parameters;
|
|
|
|
|
2003-05-20 04:10:22 +00:00
|
|
|
/* Surface optimization */
|
|
|
|
void *surface_ptr;
|
2003-06-04 23:22:13 +00:00
|
|
|
|
|
|
|
/* Used to detect a change in internal format when going from non-CK texture to CK-ed texture */
|
|
|
|
GLenum current_internal_format;
|
2003-05-20 04:10:22 +00:00
|
|
|
|
2002-12-15 01:17:59 +00:00
|
|
|
/* This is for now used to override 'standard' surface stuff to be as transparent as possible */
|
|
|
|
void (*final_release)(struct IDirectDrawSurfaceImpl *This);
|
|
|
|
void (*lock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect, DWORD dwFlags);
|
|
|
|
void (*unlock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect);
|
2003-01-02 19:59:49 +00:00
|
|
|
void (*set_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal);
|
2002-11-21 21:04:16 +00:00
|
|
|
} IDirect3DTextureGLImpl;
|
|
|
|
|
2003-01-03 21:05:38 +00:00
|
|
|
typedef enum {
|
|
|
|
GL_TRANSFORM_NONE = 0,
|
|
|
|
GL_TRANSFORM_ORTHO,
|
|
|
|
GL_TRANSFORM_NORMAL,
|
|
|
|
GL_TRANSFORM_VERTEXBUFFER
|
|
|
|
} GL_TRANSFORM_STATE;
|
|
|
|
|
2003-06-04 23:43:29 +00:00
|
|
|
typedef enum {
|
|
|
|
WINE_GL_BUFFER_BACK = 0,
|
|
|
|
WINE_GL_BUFFER_FRONT
|
|
|
|
} WINE_GL_BUFFER_TYPE;
|
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
typedef struct IDirect3DDeviceGLImpl
|
|
|
|
{
|
|
|
|
struct IDirect3DDeviceImpl parent;
|
|
|
|
|
|
|
|
GLXContext gl_context;
|
|
|
|
|
2003-06-04 23:34:58 +00:00
|
|
|
/* This stores the textures which are actually bound to the GL context */
|
|
|
|
IDirectDrawSurfaceImpl *current_bound_texture[MAX_TEXTURES];
|
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
/* The last type of vertex drawn */
|
2003-01-03 21:05:38 +00:00
|
|
|
GL_TRANSFORM_STATE transform_state;
|
2002-11-21 21:04:16 +00:00
|
|
|
|
2003-02-12 21:26:05 +00:00
|
|
|
/* Used to handle fogging faster... */
|
|
|
|
BYTE fog_table[3 * 0x10000]; /* 3 is for R, G and B
|
|
|
|
0x10000 is 0xFF for the vertex color and
|
|
|
|
0xFF for the fog intensity */
|
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
Display *display;
|
|
|
|
Drawable drawable;
|
2003-05-17 18:41:26 +00:00
|
|
|
|
2003-06-04 23:26:53 +00:00
|
|
|
/* Variables used for the flush to frame-buffer code using the texturing code */
|
2003-05-17 18:41:26 +00:00
|
|
|
GLuint unlock_tex;
|
2003-06-04 23:26:53 +00:00
|
|
|
void *surface_ptr;
|
|
|
|
GLenum current_internal_format;
|
2003-06-04 23:43:29 +00:00
|
|
|
|
|
|
|
/* 0 is back-buffer, 1 is front-buffer */
|
|
|
|
SURFACE_STATE state[2];
|
|
|
|
IDirectDrawSurfaceImpl *lock_surf[2];
|
|
|
|
RECT lock_rect[2];
|
|
|
|
/* This is just here to print-out a nice warning if we have two successive locks */
|
|
|
|
BOOLEAN lock_rect_valid[2];
|
2003-06-16 01:23:58 +00:00
|
|
|
|
|
|
|
/* This is used to optimize some stuff */
|
|
|
|
DWORD prev_clear_color;
|
|
|
|
DWORD prev_clear_stencil;
|
|
|
|
D3DVALUE prev_clear_Z;
|
|
|
|
BOOLEAN depth_mask, depth_test, alpha_test, stencil_test, cull_face, lighting, blending, fogging;
|
2003-11-11 00:31:16 +00:00
|
|
|
GLenum current_alpha_test_func;
|
|
|
|
GLclampf current_alpha_test_ref;
|
2003-06-16 01:23:58 +00:00
|
|
|
GLenum current_tex_env;
|
2003-08-18 19:55:11 +00:00
|
|
|
GLenum current_active_tex_unit;
|
2002-11-21 21:04:16 +00:00
|
|
|
} IDirect3DDeviceGLImpl;
|
|
|
|
|
2003-01-03 21:07:22 +00:00
|
|
|
/* This is for the OpenGL additions... */
|
|
|
|
typedef struct {
|
|
|
|
struct IDirect3DVertexBufferImpl parent;
|
|
|
|
|
|
|
|
DWORD dwVertexTypeDesc;
|
|
|
|
D3DMATRIX world_mat, view_mat, proj_mat;
|
|
|
|
LPVOID vertices;
|
|
|
|
} IDirect3DVertexBufferGLImpl;
|
|
|
|
|
2003-08-05 18:28:07 +00:00
|
|
|
/* This is for GL extension support.
|
|
|
|
|
|
|
|
This can contain either only a boolean if no function pointer exists or a set
|
|
|
|
of function pointers.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
/* Mirrored Repeat */
|
|
|
|
BOOLEAN mirrored_repeat;
|
2003-08-18 19:55:11 +00:00
|
|
|
/* Mipmap lod-bias */
|
2003-08-05 19:18:19 +00:00
|
|
|
BOOLEAN mipmap_lodbias;
|
2003-08-18 19:55:11 +00:00
|
|
|
/* Multi-texturing */
|
|
|
|
GLint max_texture_units;
|
|
|
|
void (*glActiveTexture)(GLenum texture);
|
2005-06-12 10:43:11 +00:00
|
|
|
void (*glMultiTexCoord[4])(GLenum target, const GLfloat *v);
|
2003-11-25 00:06:33 +00:00
|
|
|
void (*glClientActiveTexture)(GLenum texture);
|
2004-07-30 18:54:32 +00:00
|
|
|
/* S3TC/DXTN compressed texture */
|
|
|
|
BOOLEAN s3tc_compressed_texture;
|
|
|
|
void (*glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width,
|
|
|
|
GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
|
|
|
void (*glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
|
|
|
GLsizei width, GLsizei height, GLsizei imageSize, const GLvoid *data);
|
2003-08-05 18:28:07 +00:00
|
|
|
} GL_EXTENSIONS_LIST;
|
|
|
|
extern GL_EXTENSIONS_LIST GL_extensions;
|
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
/* All non-static functions 'exported' by various sub-objects */
|
2003-06-04 23:31:39 +00:00
|
|
|
extern HRESULT direct3d_create(IDirectDrawImpl *This);
|
|
|
|
extern HRESULT d3dtexture_create(IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main_surf);
|
2005-10-31 10:05:15 +00:00
|
|
|
extern HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirectDrawImpl *d3d);
|
2003-06-04 23:31:39 +00:00
|
|
|
extern HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirectDrawImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
|
|
|
|
extern HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirectDrawImpl *d3d);
|
|
|
|
extern HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirectDrawImpl *d3d);
|
|
|
|
extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirectDrawImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc, DWORD dwFlags);
|
2005-02-14 11:09:46 +00:00
|
|
|
extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *surface, int version);
|
2002-11-21 21:04:16 +00:00
|
|
|
|
|
|
|
/* Used for Direct3D to request the device to enumerate itself */
|
2003-05-12 03:09:17 +00:00
|
|
|
extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD version) ;
|
2002-11-30 19:21:42 +00:00
|
|
|
extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ;
|
2003-06-04 23:31:39 +00:00
|
|
|
extern HRESULT d3ddevice_find(IDirectDrawImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice);
|
2000-04-09 14:30:50 +00:00
|
|
|
|
2003-07-28 19:05:49 +00:00
|
|
|
/* Used by the DLL init routine to set-up the GL context and stuff properly */
|
|
|
|
extern BOOL d3ddevice_init_at_startup(void *gl_handle);
|
|
|
|
|
2003-01-03 21:17:47 +00:00
|
|
|
/* Used to upload the texture */
|
2003-06-04 23:34:58 +00:00
|
|
|
extern HRESULT gltex_upload_texture(IDirectDrawSurfaceImpl *This, IDirect3DDeviceImpl *d3ddev, DWORD stage) ;
|
2003-01-03 21:17:47 +00:00
|
|
|
|
2005-04-11 12:51:22 +00:00
|
|
|
/* Used to get the texture name */
|
|
|
|
extern GLuint gltex_get_tex_name(IDirectDrawSurfaceImpl *This) ;
|
|
|
|
|
2003-01-05 20:28:35 +00:00
|
|
|
/* Used to set-up our orthographic projection */
|
|
|
|
extern void d3ddevice_set_ortho(IDirect3DDeviceImpl *This) ;
|
|
|
|
|
2003-01-07 23:08:31 +00:00
|
|
|
/* Rendering state management functions */
|
|
|
|
extern void set_render_state(IDirect3DDeviceImpl* This, D3DRENDERSTATETYPE dwRenderStateType, STATEBLOCK *lpStateBlock);
|
|
|
|
extern void store_render_state(IDirect3DDeviceImpl *This, D3DRENDERSTATETYPE dwRenderStateType, DWORD dwRenderState, STATEBLOCK* lpStateBlock);
|
|
|
|
extern void get_render_state(IDirect3DDeviceImpl *This, D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState, STATEBLOCK* lpStateBlock);
|
|
|
|
extern void apply_render_state(IDirect3DDeviceImpl* This, STATEBLOCK* lpStateBlock);
|
2003-01-03 21:08:50 +00:00
|
|
|
|
2003-06-04 23:22:13 +00:00
|
|
|
/* Memory to texture conversion code. Split in three functions to do some optimizations. */
|
|
|
|
extern HRESULT upload_surface_to_tex_memory_init(IDirectDrawSurfaceImpl *surface, GLuint level, GLenum *prev_internal_format,
|
2003-06-04 23:24:59 +00:00
|
|
|
BOOLEAN need_to_alloc, BOOLEAN need_alpha_ck, DWORD tex_width, DWORD tex_height);
|
2003-06-04 23:26:53 +00:00
|
|
|
extern HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, void **temp_buffer);
|
2003-06-04 23:22:13 +00:00
|
|
|
extern HRESULT upload_surface_to_tex_memory_release(void);
|
|
|
|
|
2003-06-16 01:23:58 +00:00
|
|
|
/* Some utilities functions needed to be shared.. */
|
|
|
|
extern GLenum convert_D3D_compare_to_GL(D3DCMPFUNC dwRenderState) ;
|
|
|
|
|
2002-09-29 18:05:32 +00:00
|
|
|
#endif /* HAVE_OPENGL */
|
|
|
|
|
2000-04-09 14:30:50 +00:00
|
|
|
#endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */
|