ReactOS 0.4.15-dev-7942-gd23573b
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 */
29static __inline
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
44static __inline
45VOID
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
60static __inline
61VOID
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;
81 volatile LONG thread_id;
82};
83
84#define WGL_DC_OBJ_DC 0x1
86{
87 /* Header */
88 union
89 {
95
96 /* Pixel format */
98
99 /* ICD */
102
103 /* Software implementation */
105 void* sw_data;
106
107 /* Linked list */
109};
110
111/* Clean up functions */
112void IntDeleteAllContexts(void);
113void IntDeleteAllICDs(void);
114
116const GLDISPATCHTABLE*
118{
119 return (GLDISPATCHTABLE*)NtCurrentTeb()->glTable;
120}
121
123void
125{
126 NtCurrentTeb()->glTable = (void*)table;
127}
128
130void
132{
133 TEB* CurrentTeb = NtCurrentTeb();
134
135 CurrentTeb->glCurrentRC = hglrc;
136 CurrentTeb->glReserved2 = hdc;
137 CurrentTeb->glSectionInfo = dc_data;
138}
139
141HGLRC
143{
144 return NtCurrentTeb()->glCurrentRC;
145}
146
148HDC
150{
151 return NtCurrentTeb()->glReserved2;
152}
153
154static inline
155struct wgl_dc_data*
157{
158 return NtCurrentTeb()->glSectionInfo;
159}
160
162void
164{
165 NtCurrentTeb()->glContext = value;
166}
167
169void*
171{
172 return (void*)NtCurrentTeb()->glContext;
173}
174
176DHGLRC
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 */
187DHGLRC sw_CreateContext(struct wgl_dc_data*);
189BOOL sw_SetContext(struct wgl_dc_data* dc_data, DHGLRC dhglrc);
190void sw_ReleaseContext(DHGLRC hglrc);
192BOOL sw_CopyContext(DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask);
193BOOL sw_ShareLists(DHGLRC dhglrcSrc, DHGLRC dhglrcDst);
194BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data* dc_data);
195
196#endif /* _OPENGL32_PCH_ */
unsigned char BOOLEAN
#define PROC(name)
Definition: WinHttpOpen.c:37
#define NULL
Definition: types.h:112
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
#define NtCurrentTeb
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define _Inout_
Definition: ms_sal.h:378
#define _In_
Definition: ms_sal.h:308
unsigned int UINT
Definition: ndis.h:50
void IntDeleteAllICDs(void)
Definition: icdload.c:357
LIST_ENTRY ContextListHead
Definition: wgl.c:17
static struct wgl_dc_data * IntGetCurrentDcData(void)
Definition: opengl32.h:156
FORCEINLINE void IntSetCurrentDispatchTable(const GLDISPATCHTABLE *table)
Definition: opengl32.h:124
BOOL sw_CopyContext(DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask)
Definition: swimpl.c:498
BOOL sw_ShareLists(DHGLRC dhglrcSrc, DHGLRC dhglrcDst)
Definition: swimpl.c:504
BOOL sw_DeleteContext(DHGLRC dhglrc)
Definition: swimpl.c:448
FORCEINLINE void IntSetCurrentICDPrivate(void *value)
Definition: opengl32.h:163
DHGLRC sw_CreateContext(struct wgl_dc_data *)
Definition: swimpl.c:422
BOOL sw_SetContext(struct wgl_dc_data *dc_data, DHGLRC dhglrc)
Definition: swimpl.c:1390
FORCEINLINE HGLRC IntGetCurrentRC(void)
Definition: opengl32.h:142
BOOL sw_SetPixelFormat(HDC hdc, struct wgl_dc_data *, INT format)
Definition: swimpl.c:359
FORCEINLINE DHGLRC IntGetCurrentDHGLRC(void)
Definition: opengl32.h:177
INT sw_DescribePixelFormat(HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR *descr)
Definition: swimpl.c:315
FORCEINLINE void IntMakeCurrent(HGLRC hglrc, HDC hdc, struct wgl_dc_data *dc_data)
Definition: opengl32.h:131
PROC sw_GetProcAddress(LPCSTR name)
Definition: swimpl.c:478
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117
FORCEINLINE void * IntGetCurrentICDPrivate(void)
Definition: opengl32.h:170
void sw_ReleaseContext(DHGLRC hglrc)
Definition: swimpl.c:1477
BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data *dc_data)
Definition: swimpl.c:1492
void IntDeleteAllContexts(void)
Definition: wgl.c:931
FORCEINLINE HDC IntGetCurrentDC(void)
Definition: opengl32.h:149
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
static HDC HGLRC hglrc
Definition: opengl.c:36
long LONG
Definition: pedump.c:60
const char * descr
Definition: boot.c:45
base of all file and directory entries
Definition: entries.h:83
Definition: icd.h:366
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: compat.h:836
PVOID glCurrentRC
Definition: compat.h:873
PVOID glSectionInfo
Definition: compat.h:870
PVOID glReserved2
Definition: compat.h:869
Definition: name.c:39
DWORD magic
Definition: opengl32.h:73
DHGLRC dhglrc
Definition: opengl32.h:78
volatile LONG lock
Definition: opengl32.h:74
struct ICD_Data * icd_data
Definition: opengl32.h:79
INT pixelformat
Definition: opengl32.h:80
volatile LONG thread_id
Definition: opengl32.h:81
LIST_ENTRY ListEntry
Definition: opengl32.h:76
ULONG flags
Definition: opengl32.h:94
INT nb_sw_formats
Definition: opengl32.h:104
INT pixelformat
Definition: opengl32.h:97
union wgl_dc_data::@299 owner
HWND hwnd
Definition: opengl32.h:90
struct wgl_dc_data * next
Definition: opengl32.h:108
struct ICD_Data * icd_data
Definition: opengl32.h:100
HANDLE u
Definition: opengl32.h:92
INT nb_icd_formats
Definition: opengl32.h:101
void * sw_data
Definition: opengl32.h:105
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:94
#define FORCEINLINE
Definition: wdftypes.h:67
const char * LPCSTR
Definition: xmlstorage.h:183