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)
11 #ifndef OPENGL32_PRIVATE_H
12 #define OPENGL32_PRIVATE_H
14 #define snwprintf _snwprintf
18 #endif /* __cplusplus */
22 #ifndef PFD_GENERIC_ACCELERATED
23 # define PFD_GENERIC_ACCELERATED 0x00001000
26 #define OPENGL_DRIVERS_SUBKEY L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers"
27 #define OPENGL_DRIVERS_SUBKEY2 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers\\"
33 #define WIN32_LEAN_AND_MEAN
34 #define WIN32_NO_STATUS
38 #define NTOS_MODE_USER
40 #include <ndk/pstypes.h>
45 /* gl function list */
48 /* ICD index list/types */
53 # define DEBUG_OPENGL32
54 /* enable breakpoints */
55 /*# define DEBUG_OPENGL32_BRKPTS*/
56 /* dumps the list of (un)supported glXXX functions when an ICD is loaded. */
57 # define DEBUG_OPENGL32_ICD_EXPORTS
58 /* prints much information about whats going on */
59 # define DEBUG_OPENGL32_TRACE
63 # ifdef DEBUG_OPENGL32
65 # define DBGPRINT( fmt, args... ) \
66 DPRINT( "OpenGL32.DLL: %s: "fmt"\n", __FUNCTION__, ##args )
70 # define DBGPRINT( ... ) do {} while (0)
73 #ifdef DEBUG_OPENGL32_BRKPTS
74 # if defined(__GNUC__)
75 # define DBGBREAK() __asm__( "int $3" );
76 # elif defined(_MSC_VER)
77 # define DBGBREAK() __asm { int 3 }
79 # error Unsupported compiler!
82 # define DBGBREAK() do {} while (0)
85 #ifdef DEBUG_OPENGL32_TRACE
86 # define DBGTRACE( args... ) DBGPRINT( args )
88 # define DBGTRACE( ... ) do {} while (0)
91 /* function/data attributes */
92 #define EXPORT __declspec(dllexport)
94 # define NAKED __declspec(naked)
97 # define WINAPI __stdcall
100 # define NAKED __attribute__((naked))
101 # define SHARED __attribute__((section("shared"), shared))
106 #endif /* APIENTRY */
107 #define APIENTRY __stdcall
109 /* Called by the driver to set the dispatch table */
110 typedef DWORD (WINAPI
*SetContextCallBack
)( const ICDTable
* );
112 /* OpenGL ICD data */
113 typedef struct tagGLDRIVERDATA
115 HMODULE handle
; /*!< DLL handle */
116 UINT refcount
; /*!< Number of references to this ICD */
117 WCHAR driver_name
[256]; /*!< Name of ICD driver */
119 WCHAR dll
[256]; /*!< Dll filename from registry */
120 DWORD version
; /*!< Version value from registry */
121 DWORD driver_version
; /*!< DriverVersion value from registry */
122 DWORD flags
; /*!< Flags value from registry */
124 BOOL (WINAPI
*DrvCopyContext
)( HGLRC
, HGLRC
, UINT
);
125 HGLRC (WINAPI
*DrvCreateContext
)( HDC
);
126 HGLRC (WINAPI
*DrvCreateLayerContext
)( HDC
, int );
127 BOOL (WINAPI
*DrvDeleteContext
)( HGLRC
);
128 BOOL (WINAPI
*DrvDescribeLayerPlane
)( HDC
, int, int, UINT
, LPLAYERPLANEDESCRIPTOR
);
129 int (WINAPI
*DrvDescribePixelFormat
)( IN HDC
, IN
int, IN UINT
, OUT LPPIXELFORMATDESCRIPTOR
);
130 int (WINAPI
*DrvGetLayerPaletteEntries
)( HDC
, int, int, int, COLORREF
* );
131 PROC (WINAPI
*DrvGetProcAddress
)( LPCSTR lpProcName
);
132 void (WINAPI
*DrvReleaseContext
)( HGLRC hglrc
); /* maybe returns BOOL? */
133 BOOL (WINAPI
*DrvRealizeLayerPalette
)( HDC
, int, BOOL
);
134 PICDTable (WINAPI
*DrvSetContext
)( HDC hdc
, HGLRC hglrc
, SetContextCallBack callback
);
135 int (WINAPI
*DrvSetLayerPaletteEntries
)( HDC
, int, int, int, CONST COLORREF
* );
136 BOOL (WINAPI
*DrvSetPixelFormat
)( IN HDC
, IN
int, const PIXELFORMATDESCRIPTOR
* );
137 BOOL (WINAPI
*DrvShareLists
)( HGLRC
, HGLRC
);
138 BOOL (WINAPI
*DrvSwapBuffers
)( HDC
);
139 BOOL (WINAPI
*DrvSwapLayerBuffers
)( HDC
, UINT
);
140 BOOL (WINAPI
*DrvValidateVersion
)( DWORD
);
142 struct tagGLDRIVERDATA
*next
; /* next ICD -- linked list */
145 /* Our private OpenGL context (stored in TLS) */
146 typedef struct tagGLRC
148 GLDRIVERDATA
*icd
; /*!< driver used for this context */
149 HDC hdc
; /*!< DC handle */
150 BOOL is_current
; /*!< Wether this context is current for some DC */
151 DWORD thread_id
; /*!< Thread holding this context */
153 HGLRC hglrc
; /*!< GLRC from DrvCreateContext (ICD internal) */
155 struct tagGLRC
*next
; /* linked list */
158 /* OpenGL private device context data */
159 typedef struct tagGLDCDATA
161 HANDLE handle
; /*!< Handle for which this data is (HWND for device, HDC for memory context) */
162 GLDRIVERDATA
*icd
; /*!< Driver used for this DC */
163 int pixel_format
; /*!< Selected pixel format */
165 struct tagGLDCDATA
*next
; /* linked list */
170 typedef struct tagGLPROCESSDATA
172 GLDRIVERDATA
*driver_list
; /*!< List of loaded drivers */
173 HANDLE driver_mutex
; /*!< Mutex to protect driver list */
174 GLRC
*glrc_list
; /*!< List of GL rendering contexts */
175 HANDLE glrc_mutex
; /*!< Mutex to protect glrc list */
176 GLDCDATA
*dcdata_list
; /*!< List of GL private DC data */
177 HANDLE dcdata_mutex
; /*!< Mutex to protect glrc list */
180 extern GLPROCESSDATA OPENGL32_processdata
;
182 /* function prototypes */
183 GLDRIVERDATA
*OPENGL32_LoadICD( LPCWSTR driver
);
184 BOOL
OPENGL32_UnloadICD( GLDRIVERDATA
*icd
);
185 BOOL APIENTRY
rosglMakeCurrent( HDC hdc
, HGLRC hglrc
);
186 BOOL APIENTRY
IntUseFontBitmapsA( HDC hDC
, DWORD first
, DWORD count
, DWORD listBase
);
187 BOOL APIENTRY
IntUseFontBitmapsW( HDC hDC
, DWORD first
, DWORD count
, DWORD listBase
);
188 BOOL APIENTRY
IntUseFontOutlinesA( HDC hDC
, DWORD first
, DWORD count
, DWORD listBase
,
189 FLOAT chordalDeviation
, FLOAT extrusion
, INT format
,
190 GLYPHMETRICSFLOAT
*glyphMetricsFloatArray
);
191 BOOL APIENTRY
IntUseFontOutlinesW( HDC hDC
, DWORD first
, DWORD count
, DWORD listBase
,
192 FLOAT chordalDeviation
, FLOAT extrusion
, INT format
,
193 GLYPHMETRICSFLOAT
*glyphMetricsFloatArray
);
195 /* empty gl functions from gl.c */
196 int WINAPI
glEmptyFunc0( void );
197 int WINAPI
glEmptyFunc4( long );
198 int WINAPI
glEmptyFunc8( long, long );
199 int WINAPI
glEmptyFunc12( long, long, long );
200 int WINAPI
glEmptyFunc16( long, long, long, long );
201 int WINAPI
glEmptyFunc20( long, long, long, long, long );
202 int WINAPI
glEmptyFunc24( long, long, long, long, long, long );
203 int WINAPI
glEmptyFunc28( long, long, long, long, long, long, long );
204 int WINAPI
glEmptyFunc32( long, long, long, long, long, long, long, long );
205 int WINAPI
glEmptyFunc36( long, long, long, long, long, long, long, long,
207 int WINAPI
glEmptyFunc40( long, long, long, long, long, long, long, long,
209 int WINAPI
glEmptyFunc44( long, long, long, long, long, long, long, long,
211 int WINAPI
glEmptyFunc48( long, long, long, long, long, long, long, long,
212 long, long, long, long );
213 int WINAPI
glEmptyFunc52( long, long, long, long, long, long, long, long,
214 long, long, long, long, long );
215 int WINAPI
glEmptyFunc56( long, long, long, long, long, long, long, long,
216 long, long, long, long, long, long );
218 #ifdef OPENGL32_GL_FUNC_PROTOTYPES
220 #define X(func,ret,typeargs,args,icdidx,tebidx,stack) ret WINAPI func typeargs;
224 #endif /* OPENGL32_GL_FUNC_PROTOTYPES */
228 #endif /* __cplusplus */
230 #endif /* OPENGL32_PRIVATE_H */