ReactOS 0.4.16-dev-2293-g4d8327b
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#define NTOS_MODE_USER
25#include <rtlfuncs.h>
26
27#include <wine/debug.h>
28
29#include "icd.h"
30
32
34{
36 volatile LONG lock;
37
39
40 DHGLRC dhglrc;
43 volatile LONG thread_id;
44};
45
46#define WGL_DC_OBJ_DC 0x1
48{
49 /* Header */
50 union
51 {
57
58 /* Pixel format */
60
61 /* ICD */
64
65 /* Software implementation */
67 void* sw_data;
68
69 /* Linked list */
71};
72
73/* Clean up functions */
74void IntDeleteAllContexts(void);
75void IntDeleteAllICDs(void);
76
78const GLDISPATCHTABLE*
80{
81 return (GLDISPATCHTABLE*)NtCurrentTeb()->glTable;
82}
83
85void
87{
88 NtCurrentTeb()->glTable = (void*)table;
89}
90
92void
94{
95 TEB* CurrentTeb = NtCurrentTeb();
96
97 CurrentTeb->glCurrentRC = hglrc;
98 CurrentTeb->glReserved2 = hdc;
99 CurrentTeb->glSectionInfo = dc_data;
100}
101
103HGLRC
105{
106 return NtCurrentTeb()->glCurrentRC;
107}
108
110HDC
112{
113 return NtCurrentTeb()->glReserved2;
114}
115
116static inline
117struct wgl_dc_data*
119{
120 return NtCurrentTeb()->glSectionInfo;
121}
122
124void
126{
127 NtCurrentTeb()->glContext = value;
128}
129
131void*
133{
134 return (void*)NtCurrentTeb()->glContext;
135}
136
138DHGLRC
140{
141 struct wgl_context* ctx = (struct wgl_context*)IntGetCurrentRC();
142 if(!ctx) return NULL;
143 return ctx->dhglrc;
144}
145
146/* Software implementation functions */
149DHGLRC sw_CreateContext(struct wgl_dc_data*);
151BOOL sw_SetContext(struct wgl_dc_data* dc_data, DHGLRC dhglrc);
152void sw_ReleaseContext(DHGLRC hglrc);
154BOOL sw_CopyContext(DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask);
155BOOL sw_ShareLists(DHGLRC dhglrcSrc, DHGLRC dhglrcDst);
156BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data* dc_data);
157
158#endif /* _OPENGL32_PCH_ */
#define PROC(name)
Definition: WinHttpOpen.c:37
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
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:88
unsigned int UINT
Definition: ndis.h:50
void IntDeleteAllICDs(void)
Definition: icdload.c:362
LIST_ENTRY ContextListHead
Definition: wgl.c:17
static struct wgl_dc_data * IntGetCurrentDcData(void)
Definition: opengl32.h:118
FORCEINLINE void IntSetCurrentDispatchTable(const GLDISPATCHTABLE *table)
Definition: opengl32.h:86
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:125
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:104
BOOL sw_SetPixelFormat(HDC hdc, struct wgl_dc_data *, INT format)
Definition: swimpl.c:359
FORCEINLINE DHGLRC IntGetCurrentDHGLRC(void)
Definition: opengl32.h:139
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:93
PROC sw_GetProcAddress(LPCSTR name)
Definition: swimpl.c:478
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:79
FORCEINLINE void * IntGetCurrentICDPrivate(void)
Definition: opengl32.h:132
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:933
FORCEINLINE HDC IntGetCurrentDC(void)
Definition: opengl32.h:111
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
Definition: icd.h:366
Definition: typedefs.h:120
Definition: compat.h:836
PVOID glCurrentRC
Definition: compat.h:873
PVOID glSectionInfo
Definition: compat.h:870
PVOID glReserved2
Definition: compat.h:869
Definition: format.c:58
Definition: name.c:39
DWORD magic
Definition: opengl32.h:35
DHGLRC dhglrc
Definition: opengl32.h:40
volatile LONG lock
Definition: opengl32.h:36
struct ICD_Data * icd_data
Definition: opengl32.h:41
INT pixelformat
Definition: opengl32.h:42
volatile LONG thread_id
Definition: opengl32.h:43
LIST_ENTRY ListEntry
Definition: opengl32.h:38
ULONG flags
Definition: opengl32.h:56
INT nb_sw_formats
Definition: opengl32.h:66
INT pixelformat
Definition: opengl32.h:59
HWND hwnd
Definition: opengl32.h:52
struct wgl_dc_data * next
Definition: opengl32.h:70
struct ICD_Data * icd_data
Definition: opengl32.h:62
union wgl_dc_data::@279 owner
HANDLE u
Definition: opengl32.h:54
INT nb_icd_formats
Definition: opengl32.h:63
void * sw_data
Definition: opengl32.h:67
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:96
#define FORCEINLINE
Definition: wdftypes.h:67
const char * LPCSTR
Definition: xmlstorage.h:183