- Sync with trunk r58248 to bring the latest changes from Amine (headers) and others...
[reactos.git] / dll / opengl / opengl32 / opengl32.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: lib/opengl32/opengl32.h
5 * PURPOSE: OpenGL32 lib
6 * PROGRAMMER: Royce Mitchell III, Anich Gregor (blight)
7 * UPDATE HISTORY:
8 * Feb 1, 2004: Created
9 */
10
11 #ifndef OPENGL32_PRIVATE_H
12 #define OPENGL32_PRIVATE_H
13
14 #define snwprintf _snwprintf
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19
20 #define NDEBUG
21
22 #ifndef PFD_GENERIC_ACCELERATED
23 # define PFD_GENERIC_ACCELERATED 0x00001000
24 #endif
25
26 #define OPENGL_DRIVERS_SUBKEY L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers"
27 #define OPENGL_DRIVERS_SUBKEY2 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers\\"
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 //#include <string.h>
32
33 #define WIN32_NO_STATUS
34 #include <windef.h>
35 #include <winbase.h>
36 #include <winreg.h>
37 #include <wingdi.h>
38 #include <winuser.h>
39 #include <winddi.h>
40
41 #define NTOS_MODE_USER
42 #include <ndk/pstypes.h>
43
44 //#include <GL/gl.h>
45 #include <GL/glu.h>
46
47 /* gl function list */
48 #include "glfuncs.h"
49
50 /* ICD index list/types */
51 #include "icdtable.h"
52
53 /* debug flags */
54 #if !defined(NDEBUG)
55 # define DEBUG_OPENGL32
56 /* enable breakpoints */
57 /*# define DEBUG_OPENGL32_BRKPTS*/
58 /* dumps the list of (un)supported glXXX functions when an ICD is loaded. */
59 # define DEBUG_OPENGL32_ICD_EXPORTS
60 /* prints much information about whats going on */
61 # define DEBUG_OPENGL32_TRACE
62 #endif /* !NDEBUG */
63
64 /* debug macros */
65 # ifdef DEBUG_OPENGL32
66 # include <debug.h>
67 # define DBGPRINT( fmt, args... ) \
68 DPRINT( "OpenGL32.DLL: %s: "fmt"\n", __FUNCTION__, ##args )
69 # endif
70
71 #ifndef DBGPRINT
72 # define DBGPRINT( ... ) do {} while (0)
73 #endif
74
75 #ifdef DEBUG_OPENGL32_BRKPTS
76 # if defined(__GNUC__)
77 # define DBGBREAK() __asm__( "int $3" );
78 # elif defined(_MSC_VER)
79 # define DBGBREAK() __asm { int 3 }
80 # else
81 # error Unsupported compiler!
82 # endif
83 #else
84 # define DBGBREAK() do {} while (0)
85 #endif
86
87 #ifdef DEBUG_OPENGL32_TRACE
88 # define DBGTRACE( args... ) DBGPRINT( args )
89 #else
90 # define DBGTRACE( ... ) do {} while (0)
91 #endif
92
93 /* function/data attributes */
94 #define EXPORT __declspec(dllexport)
95 #ifdef _MSC_VER
96 # define NAKED __declspec(naked)
97 # define SHARED
98 # ifndef WINAPI
99 # define WINAPI __stdcall
100 # endif /* WINAPI */
101 #else /* GCC */
102 # define NAKED __attribute__((naked))
103 # define SHARED __attribute__((section("shared"), shared))
104 #endif
105
106 #ifdef APIENTRY
107 #undef APIENTRY
108 #endif /* APIENTRY */
109 #define APIENTRY __stdcall
110
111 /* Called by the driver to set the dispatch table */
112 typedef DWORD (WINAPI *SetContextCallBack)( const ICDTable * );
113
114 /* OpenGL ICD data */
115 typedef struct tagGLDRIVERDATA
116 {
117 HMODULE handle; /*!< DLL handle */
118 UINT refcount; /*!< Number of references to this ICD */
119 WCHAR driver_name[256]; /*!< Name of ICD driver */
120
121 WCHAR dll[256]; /*!< Dll filename from registry */
122 DWORD version; /*!< Version value from registry */
123 DWORD driver_version; /*!< DriverVersion value from registry */
124 DWORD flags; /*!< Flags value from registry */
125
126 BOOL (WINAPI *DrvCopyContext)( HGLRC, HGLRC, UINT );
127 HGLRC (WINAPI *DrvCreateContext)( HDC );
128 HGLRC (WINAPI *DrvCreateLayerContext)( HDC, int );
129 BOOL (WINAPI *DrvDeleteContext)( HGLRC );
130 BOOL (WINAPI *DrvDescribeLayerPlane)( HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR );
131 int (WINAPI *DrvDescribePixelFormat)( IN HDC, IN int, IN UINT, OUT LPPIXELFORMATDESCRIPTOR );
132 int (WINAPI *DrvGetLayerPaletteEntries)( HDC, int, int, int, COLORREF * );
133 PROC (WINAPI *DrvGetProcAddress)( LPCSTR lpProcName );
134 void (WINAPI *DrvReleaseContext)( HGLRC hglrc ); /* maybe returns BOOL? */
135 BOOL (WINAPI *DrvRealizeLayerPalette)( HDC, int, BOOL );
136 PICDTable (WINAPI *DrvSetContext)( HDC hdc, HGLRC hglrc, SetContextCallBack callback );
137 int (WINAPI *DrvSetLayerPaletteEntries)( HDC, int, int, int, CONST COLORREF * );
138 BOOL (WINAPI *DrvSetPixelFormat)( IN HDC, IN int, const PIXELFORMATDESCRIPTOR * );
139 BOOL (WINAPI *DrvShareLists)( HGLRC, HGLRC );
140 BOOL (WINAPI *DrvSwapBuffers)( HDC );
141 BOOL (WINAPI *DrvSwapLayerBuffers)( HDC, UINT );
142 BOOL (WINAPI *DrvValidateVersion)( DWORD );
143
144 struct tagGLDRIVERDATA *next; /* next ICD -- linked list */
145 } GLDRIVERDATA;
146
147 /* Our private OpenGL context (stored in TLS) */
148 typedef struct tagGLRC
149 {
150 GLDRIVERDATA *icd; /*!< driver used for this context */
151 HDC hdc; /*!< DC handle */
152 BOOL is_current; /*!< Wether this context is current for some DC */
153 DWORD thread_id; /*!< Thread holding this context */
154
155 HGLRC hglrc; /*!< GLRC from DrvCreateContext (ICD internal) */
156
157 struct tagGLRC *next; /* linked list */
158 } GLRC;
159
160 /* OpenGL private device context data */
161 typedef struct tagGLDCDATA
162 {
163 HANDLE handle; /*!< Handle for which this data is (HWND for device, HDC for memory context) */
164 GLDRIVERDATA *icd; /*!< Driver used for this DC */
165 int pixel_format; /*!< Selected pixel format */
166
167 struct tagGLDCDATA *next; /* linked list */
168 } GLDCDATA;
169
170
171 /* Process data */
172 typedef struct tagGLPROCESSDATA
173 {
174 GLDRIVERDATA *driver_list; /*!< List of loaded drivers */
175 HANDLE driver_mutex; /*!< Mutex to protect driver list */
176 GLRC *glrc_list; /*!< List of GL rendering contexts */
177 HANDLE glrc_mutex; /*!< Mutex to protect glrc list */
178 GLDCDATA *dcdata_list; /*!< List of GL private DC data */
179 HANDLE dcdata_mutex; /*!< Mutex to protect glrc list */
180 } GLPROCESSDATA;
181
182 extern GLPROCESSDATA OPENGL32_processdata;
183
184 /* function prototypes */
185 GLDRIVERDATA *OPENGL32_LoadICD( LPCWSTR driver );
186 BOOL OPENGL32_UnloadICD( GLDRIVERDATA *icd );
187 BOOL APIENTRY rosglMakeCurrent( HDC hdc, HGLRC hglrc );
188 BOOL APIENTRY IntUseFontBitmapsA( HDC hDC, DWORD first, DWORD count, DWORD listBase );
189 BOOL APIENTRY IntUseFontBitmapsW( HDC hDC, DWORD first, DWORD count, DWORD listBase );
190 BOOL APIENTRY IntUseFontOutlinesA( HDC hDC, DWORD first, DWORD count, DWORD listBase,
191 FLOAT chordalDeviation, FLOAT extrusion, INT format,
192 GLYPHMETRICSFLOAT *glyphMetricsFloatArray );
193 BOOL APIENTRY IntUseFontOutlinesW( HDC hDC, DWORD first, DWORD count, DWORD listBase,
194 FLOAT chordalDeviation, FLOAT extrusion, INT format,
195 GLYPHMETRICSFLOAT *glyphMetricsFloatArray );
196
197 /* empty gl functions from gl.c */
198 int WINAPI glEmptyFunc0( void );
199 int WINAPI glEmptyFunc4( long );
200 int WINAPI glEmptyFunc8( long, long );
201 int WINAPI glEmptyFunc12( long, long, long );
202 int WINAPI glEmptyFunc16( long, long, long, long );
203 int WINAPI glEmptyFunc20( long, long, long, long, long );
204 int WINAPI glEmptyFunc24( long, long, long, long, long, long );
205 int WINAPI glEmptyFunc28( long, long, long, long, long, long, long );
206 int WINAPI glEmptyFunc32( long, long, long, long, long, long, long, long );
207 int WINAPI glEmptyFunc36( long, long, long, long, long, long, long, long,
208 long );
209 int WINAPI glEmptyFunc40( long, long, long, long, long, long, long, long,
210 long, long );
211 int WINAPI glEmptyFunc44( long, long, long, long, long, long, long, long,
212 long, long, long );
213 int WINAPI glEmptyFunc48( long, long, long, long, long, long, long, long,
214 long, long, long, long );
215 int WINAPI glEmptyFunc52( long, long, long, long, long, long, long, long,
216 long, long, long, long, long );
217 int WINAPI glEmptyFunc56( long, long, long, long, long, long, long, long,
218 long, long, long, long, long, long );
219
220 #ifdef OPENGL32_GL_FUNC_PROTOTYPES
221
222 #define X(func,ret,typeargs,args,icdidx,tebidx,stack) ret WINAPI func typeargs;
223 GLFUNCS_MACRO
224 #undef X
225
226 #endif /* OPENGL32_GL_FUNC_PROTOTYPES */
227
228 #ifdef __cplusplus
229 }; /* extern "C" */
230 #endif /* __cplusplus */
231
232 #endif /* OPENGL32_PRIVATE_H */
233
234 /* EOF */