patch by blight:
[reactos.git] / reactos / lib / opengl32 / opengl32.h
1 /* $Id: opengl32.h,v 1.10 2004/02/06 17:22:55 royce Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: lib/opengl32/opengl32.h
6 * PURPOSE: OpenGL32 lib
7 * PROGRAMMER: Royce Mitchell III, Anich Gregor (blight)
8 * UPDATE HISTORY:
9 * Feb 1, 2004: Created
10 */
11
12 #ifndef OPENGL32_PRIVATE_H
13 #define OPENGL32_PRIVATE_H
14
15 /* gl function list */
16 #include "glfuncs.h"
17
18 /* ICD index list/types */
19 #include "icdtable.h"
20
21 /* debug flags */
22 #if !defined(NDEBUG)
23 # define DEBUG_OPENGL32
24 # define DEBUG_OPENGL32_BRKPTS /* enable breakpoints */
25 # define DEBUG_OPENGL32_ICD_EXPORTS /* dumps the list of (un)supported glXXX
26 functions when an ICD is loaded. */
27 #endif /* !NDEBUG */
28
29 /* debug macros */
30 #ifdef DEBUG_OPENGL32 /* FIXME: DPRINT wants DbgPrint - where is it? */
31 ULONG DbgPrint(PCH Format,...);
32 # include <debug.h>
33 # define DBGPRINT( fmt, args... ) \
34 DPRINT( "OpenGL32.DLL: %s: "fmt"\n", __FUNCTION__, ##args )
35 #else
36 # define DBGPRINT( ... ) do {} while (0)
37 #endif
38
39 #ifdef DEBUG_OPENGL32_BRKPTS
40 # if defined(__GNUC__)
41 # define DBGBREAK() __asm__( "int $3" );
42 # elif defined(_MSC_VER)
43 # define DBGBREAK() __asm { int 3 }
44 # else
45 # error Unsupported compiler!
46 # endif
47 #endif
48
49 #if 0
50 /* table indices for funcnames and function pointers */
51 enum glfunc_indices
52 {
53 GLIDX_INVALID = -1,
54 #define X(func, ret, typeargs, args) GLIDX_##func,
55 GLFUNCS_MACRO
56 #undef X
57 GLIDX_COUNT
58 };
59
60 /* function name table */
61 extern const char* OPENGL32_funcnames[GLIDX_COUNT];
62 #endif
63
64 /* Called by the driver to set the dispatch table */
65 typedef DWORD (CALLBACK * SetContextCallBack)( const ICDTable * );
66
67 /* OpenGL ICD data */
68 typedef struct tagGLDRIVERDATA
69 {
70 HMODULE handle; /* DLL handle */
71 UINT refcount; /* number of references to this ICD */
72 WCHAR driver_name[256]; /* name of display driver */
73
74 WCHAR dll[256]; /* Dll value from registry */
75 DWORD version; /* Version value from registry */
76 DWORD driver_version; /* DriverVersion value from registry */
77 DWORD flags; /* Flags value from registry */
78
79 BOOL (*DrvCopyContext)( HGLRC, HGLRC, UINT );
80 HGLRC (*DrvCreateContext)( HDC );
81 HGLRC (*DrvCreateLayerContext)( HDC, int );
82 BOOL (*DrvDeleteContext)( HGLRC );
83 BOOL (*DrvDescribeLayerPlane)( HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR );
84 int (*DrvDescribePixelFormat)( IN HDC, IN int, IN UINT, OUT LPPIXELFORMATDESCRIPTOR );
85 int (*DrvGetLayerPaletteEntries)( HDC, int, int, int, COLORREF * );
86 FARPROC (*DrvGetProcAddress)( LPCSTR lpProcName );
87 void (*DrvReleaseContext)();
88 BOOL (*DrvRealizeLayerPalette)( HDC, int, BOOL );
89 int (*DrvSetContext)( HDC hdc, HGLRC hglrc, SetContextCallBack callback );
90 int (*DrvSetLayerPaletteEntries)( HDC, int, int, int, CONST COLORREF * );
91 BOOL (*DrvSetPixelFormat)( IN HDC, IN int, IN CONST PIXELFORMATDESCRIPTOR * );
92 BOOL (*DrvShareLists)( HGLRC, HGLRC );
93 BOOL (*DrvSwapBuffers)( HDC );
94 BOOL (*DrvSwapLayerBuffers)( HDC, UINT );
95 BOOL (*DrvValidateVersion)( DWORD );
96
97 struct tagGLDRIVERDATA *next; /* next ICD -- linked list */
98 } GLDRIVERDATA;
99
100 /* Out private OpenGL context (saved in TLS) */
101 typedef struct tagGLRC
102 {
103 GLDRIVERDATA *icd; /* driver used for this context */
104 INT iFormat; /* current pixel format index - ? */
105 HDC hdc; /* DC handle */
106 BOOL is_current; /* wether this context is current for some DC */
107 DWORD thread_id; /* thread holding this context */
108
109 HGLRC hglrc; /* GLRC from DrvCreateContext */
110
111 struct tagGLRC *next; /* linked list */
112 } GLRC;
113
114 /* Process data */
115 typedef struct tagGLPROCESSDATA
116 {
117 GLDRIVERDATA *driver_list; /* list of loaded drivers */
118 HANDLE driver_mutex; /* mutex to protect driver list */
119 GLRC *glrc_list; /* list of GL rendering contexts */
120 HANDLE glrc_mutex; /* mutex to protect glrc list */
121 } GLPROCESSDATA;
122
123 /* TLS data */
124 typedef struct tagGLTHREADDATA
125 {
126 GLRC *glrc; /* current GL rendering context */
127 } GLTHREADDATA;
128
129 extern DWORD OPENGL32_tls;
130 extern GLPROCESSDATA OPENGL32_processdata;
131 #define OPENGL32_threaddata ((GLTHREADDATA *)TlsGetValue( OPENGL32_tls ))
132
133 /* function prototypes */
134 GLDRIVERDATA *OPENGL32_LoadICDForHDC( HDC hdc );
135 GLDRIVERDATA *OPENGL32_LoadICD( LPCWSTR driver );
136 BOOL OPENGL32_UnloadICD( GLDRIVERDATA *icd );
137 DWORD OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName );
138 DWORD OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd );
139
140 /* empty gl functions from gl.c */
141 int STDCALL glEmptyFunc0();
142 int STDCALL glEmptyFunc4( long );
143 int STDCALL glEmptyFunc8( long, long );
144 int STDCALL glEmptyFunc12( long, long, long );
145 int STDCALL glEmptyFunc16( long, long, long, long );
146 int STDCALL glEmptyFunc20( long, long, long, long, long );
147 int STDCALL glEmptyFunc24( long, long, long, long, long, long );
148 int STDCALL glEmptyFunc28( long, long, long, long, long, long, long );
149 int STDCALL glEmptyFunc32( long, long, long, long, long, long, long, long );
150 int STDCALL glEmptyFunc36( long, long, long, long, long, long, long, long,
151 long );
152 int STDCALL glEmptyFunc40( long, long, long, long, long, long, long, long,
153 long, long );
154 int STDCALL glEmptyFunc44( long, long, long, long, long, long, long, long,
155 long, long, long );
156 int STDCALL glEmptyFunc48( long, long, long, long, long, long, long, long,
157 long, long, long, long );
158 int STDCALL glEmptyFunc52( long, long, long, long, long, long, long, long,
159 long, long, long, long, long );
160 int STDCALL glEmptyFunc56( long, long, long, long, long, long, long, long,
161 long, long, long, long, long, long );
162
163 #endif//OPENGL32_PRIVATE_H
164
165 /* EOF */