ReactOS  0.4.13-dev-650-g34bf247
opengl32.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * FILE: lib/opengl32/opengl.h
5  * PURPOSE: OpenGL32 lib, general header
6  */
7 
8 #ifndef _OPENGL32_PCH_
9 #define _OPENGL32_PCH_
10 
11 #define WIN32_NO_STATUS
12 #include <stdarg.h>
13 #include <windef.h>
14 #include <winbase.h>
15 #include <winuser.h>
16 #include <wingdi.h>
17 #include <winddi.h>
18 #include <GL/gl.h>
19 
20 #ifndef OPENGL32_USE_TLS
21 #include <pstypes.h>
22 #endif
23 
24 #include <wine/debug.h>
25 
26 #include "icd.h"
27 
28 /* *$%$£^§! headers inclusion */
29 static __inline
30 BOOLEAN
33 {
34  PLIST_ENTRY OldFlink;
35  PLIST_ENTRY OldBlink;
36 
37  OldFlink = Entry->Flink;
38  OldBlink = Entry->Blink;
39  OldFlink->Blink = OldBlink;
40  OldBlink->Flink = OldFlink;
41  return (OldFlink == OldBlink);
42 }
43 
44 static __inline
45 VOID
47  _In_ PLIST_ENTRY ListHead,
49 )
50 {
51  PLIST_ENTRY OldBlink;
52  OldBlink = ListHead->Blink;
53  Entry->Flink = ListHead;
54  Entry->Blink = OldBlink;
55  OldBlink->Flink = Entry;
56  ListHead->Blink = Entry;
57 }
58 
59 
60 static __inline
61 VOID
63  _Inout_ PLIST_ENTRY ListHead
64 )
65 {
66  ListHead->Flink = ListHead->Blink = ListHead;
67 }
68 
70 
72 {
74  volatile LONG lock;
75 
77 
78  DHGLRC dhglrc;
79  struct ICD_Data* icd_data;
81  volatile LONG thread_id;
82 };
83 
84 #define WGL_DC_OBJ_DC 0x1
86 {
87  /* Header */
88  union
89  {
93  } owner;
95 
96  /* Pixel format */
98 
99  /* ICD */
102 
103  /* Software implementation */
105  void* sw_data;
106 
107  /* Linked list */
108  struct wgl_dc_data* next;
109 };
110 
111 /* Clean up functions */
112 void IntDeleteAllContexts(void);
113 void IntDeleteAllICDs(void);
114 
116 const GLDISPATCHTABLE*
118 {
119  return (GLDISPATCHTABLE*)NtCurrentTeb()->glTable;
120 }
121 
123 void
125 {
126  NtCurrentTeb()->glTable = (void*)table;
127 }
128 
130 void
132 {
133  TEB* CurrentTeb = NtCurrentTeb();
134 
135  CurrentTeb->glCurrentRC = hglrc;
136  CurrentTeb->glReserved2 = hdc;
137  CurrentTeb->glSectionInfo = dc_data;
138 }
139 
141 HGLRC
143 {
144  return NtCurrentTeb()->glCurrentRC;
145 }
146 
148 HDC
150 {
151  return NtCurrentTeb()->glReserved2;
152 }
153 
154 static inline
155 struct wgl_dc_data*
157 {
158  return NtCurrentTeb()->glSectionInfo;
159 }
160 
162 void
164 {
165  NtCurrentTeb()->glContext = value;
166 }
167 
169 void*
171 {
172  return (void*)NtCurrentTeb()->glContext;
173 }
174 
176 DHGLRC
178 {
179  struct wgl_context* ctx = (struct wgl_context*)IntGetCurrentRC();
180  if(!ctx) return NULL;
181  return ctx->dhglrc;
182 }
183 
184 /* Software implementation functions */
187 DHGLRC sw_CreateContext(struct wgl_dc_data*);
189 BOOL sw_SetContext(struct wgl_dc_data* dc_data, DHGLRC dhglrc);
190 void sw_ReleaseContext(DHGLRC hglrc);
192 BOOL sw_CopyContext(DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask);
193 BOOL sw_ShareLists(DHGLRC dhglrcSrc, DHGLRC dhglrcDst);
194 BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data* dc_data);
195 
196 #endif /* _OPENGL32_PCH_ */
PVOID glCurrentRC
Definition: compat.h:522
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
ULONG flags
Definition: opengl32.h:94
FORCEINLINE void IntMakeCurrent(HGLRC hglrc, HDC hdc, struct wgl_dc_data *dc_data)
Definition: opengl32.h:131
DHGLRC dhglrc
Definition: opengl32.h:78
struct _Entry Entry
Definition: kefuncs.h:640
PVOID glReserved2
Definition: compat.h:518
FORCEINLINE void * IntGetCurrentICDPrivate(void)
Definition: opengl32.h:170
BOOL sw_SetContext(struct wgl_dc_data *dc_data, DHGLRC dhglrc)
Definition: swimpl.c:1429
void sw_ReleaseContext(DHGLRC hglrc)
Definition: swimpl.c:1516
BOOL sw_ShareLists(DHGLRC dhglrcSrc, DHGLRC dhglrcDst)
Definition: swimpl.c:504
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
HWND hwnd
Definition: opengl32.h:90
volatile LONG thread_id
Definition: opengl32.h:81
static HDC
Definition: imagelist.c:92
struct ICD_Data * icd_data
Definition: opengl32.h:79
BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data *dc_data)
Definition: swimpl.c:1531
static HDC HGLRC hglrc
Definition: opengl.c:36
int32_t INT
Definition: typedefs.h:56
void * sw_data
Definition: opengl32.h:105
static __inline VOID InsertTailList(_In_ PLIST_ENTRY ListHead, _In_ PLIST_ENTRY Entry)
Definition: opengl32.h:46
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
FORCEINLINE HGLRC IntGetCurrentRC(void)
Definition: opengl32.h:142
HANDLE u
Definition: opengl32.h:92
volatile LONG lock
Definition: opengl32.h:74
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
struct ICD_Data * icd_data
Definition: opengl32.h:100
static struct wgl_dc_data * IntGetCurrentDcData(void)
Definition: opengl32.h:156
unsigned char BOOLEAN
struct wgl_dc_data * next
Definition: opengl32.h:108
smooth NULL
Definition: ftsmooth.c:416
INT nb_sw_formats
Definition: opengl32.h:104
#define FORCEINLINE
Definition: ntbasedef.h:221
union wgl_dc_data::@281 owner
const char * LPCSTR
Definition: xmlstorage.h:183
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
FORCEINLINE void IntSetCurrentICDPrivate(void *value)
Definition: opengl32.h:163
BOOL sw_SetPixelFormat(HDC hdc, struct wgl_dc_data *, INT format)
Definition: swimpl.c:359
GLsizeiptr size
Definition: glext.h:5919
void IntDeleteAllContexts(void)
Definition: wgl.c:927
FORCEINLINE HDC IntGetCurrentDC(void)
Definition: opengl32.h:149
unsigned long DWORD
Definition: ntddk_ex.h:95
void IntDeleteAllICDs(void)
Definition: icdload.c:357
#define _Inout_
Definition: no_sal2.h:244
HDC hdc
Definition: main.c:9
INT pixelformat
Definition: opengl32.h:97
Definition: typedefs.h:117
INT nb_icd_formats
Definition: opengl32.h:101
GLsizei const GLfloat * value
Definition: glext.h:6069
#define _In_
Definition: no_sal2.h:204
BOOL sw_CopyContext(DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask)
Definition: swimpl.c:498
Definition: compat.h:484
FORCEINLINE DHGLRC IntGetCurrentDHGLRC(void)
Definition: opengl32.h:177
FORCEINLINE void IntSetCurrentDispatchTable(const GLDISPATCHTABLE *table)
Definition: opengl32.h:124
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
DWORD magic
Definition: opengl32.h:73
LIST_ENTRY ContextListHead
Definition: wgl.c:17
unsigned int UINT
Definition: ndis.h:50
PROC sw_GetProcAddress(LPCSTR name)
Definition: swimpl.c:478
INT sw_DescribePixelFormat(HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR *descr)
Definition: swimpl.c:315
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117
Definition: icd.h:365
Definition: name.c:36
BOOL sw_DeleteContext(DHGLRC dhglrc)
Definition: swimpl.c:448
PVOID glSectionInfo
Definition: compat.h:519
unsigned int ULONG
Definition: retypes.h:1
INT_PTR(WINAPI * PROC)()
Definition: windef.h:250
INT pixelformat
Definition: opengl32.h:80
const char * descr
Definition: boot.c:42
LIST_ENTRY ListEntry
Definition: opengl32.h:76
static __inline VOID InitializeListHead(_Inout_ PLIST_ENTRY ListHead)
Definition: opengl32.h:62
static __inline BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: opengl32.h:31
DHGLRC sw_CreateContext(struct wgl_dc_data *)
Definition: swimpl.c:422
base of all file and directory entries
Definition: entries.h:82