VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h@ 95818

Last change on this file since 95818 was 95751, checked in by vboxsync, 2 years ago

Devices/Graphics: Switch to new OpenGL headers, bugref:8515

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.4 KB
Line 
1/* $Id: DevVGA-SVGA3d-glLdr.h 95751 2022-07-20 11:47:45Z vboxsync $ */
2/** @file
3 * DevVGA - VMWare SVGA device - 3D part, dynamic loading of GL function.
4 */
5
6/*
7 * Copyright (C) 2018-2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_glLdr_h
19#define VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_glLdr_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#ifndef VMSVGA3D_OPENGL
25# error "This include file is for VMSVGA3D_OPENGL."
26#endif
27
28#include <VBox/types.h>
29
30/** @todo VBOX_VMSVGA3D_GL_HACK_LEVEL is not necessary when dynamic loading is used. */
31
32#ifdef RT_OS_WINDOWS
33# include <iprt/win/windows.h>
34# include <GL/gl.h>
35# include "vmsvga_glext/wglext.h"
36
37#elif defined(RT_OS_DARWIN)
38# include <OpenGL/OpenGL.h>
39# include <OpenGL/gl3.h>
40# include <OpenGL/gl3ext.h>
41# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
42# include <OpenGL/gl.h>
43# include "DevVGA-SVGA3d-cocoa.h"
44// HACK
45typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
46typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
47typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
48# define GL_RGBA_S3TC 0x83A2
49# define GL_ALPHA8_EXT 0x803c
50# define GL_LUMINANCE8_EXT 0x8040
51# define GL_LUMINANCE16_EXT 0x8042
52# define GL_LUMINANCE4_ALPHA4_EXT 0x8043
53# define GL_LUMINANCE8_ALPHA8_EXT 0x8045
54# define GL_INT_2_10_10_10_REV 0x8D9F
55
56#else
57# include <X11/Xlib.h>
58# include <X11/Xatom.h>
59# include <GL/gl.h>
60# include <GL/glx.h>
61# define VBOX_VMSVGA3D_GL_HACK_LEVEL 0x103
62#endif
63
64#ifndef __glext_h__
65# undef GL_GLEXT_VERSION /** @todo r=bird: We include GL/glext.h above which also defines this and we'll end up with
66 * a clash if the system one does not use the same header guard as ours. So, I'm wondering
67 * whether this include is really needed, and if it is, whether we should use a unique header
68 * guard macro on it, so we'll have the same problems everywhere... */
69#endif
70#include "vmsvga_glext/glext.h"
71
72
73#ifdef RT_OS_WINDOWS
74# define GLAPIENTRY APIENTRY
75#else
76# define GLAPIENTRY
77#endif
78
79#define GLAPIENTRYP GLAPIENTRY *
80
81#ifdef VMSVGA3D_GL_DEFINE_PFN
82# define GLPFN
83#else
84# define GLPFN extern
85#endif
86
87/** Load OpenGL library and initialize function pointers. */
88int glLdrInit(PPDMDEVINS pDevIns);
89/** Resolve an OpenGL function name. */
90PFNRT glLdrGetProcAddress(const char *pszSymbol);
91/** Get pointers to extension function. They are available on Windows only when OpenGL context is set. */
92int glLdrGetExtFunctions(PPDMDEVINS pDevIns);
93
94/*
95 * All OpenGL function used by VMSVGA backend.
96 */
97
98/*
99 * GL 1.1 functions (exported from OpenGL32 on Windows).
100 */
101GLPFN void (GLAPIENTRYP pfn_glAlphaFunc)(GLenum func, GLclampf ref);
102#define glAlphaFunc pfn_glAlphaFunc
103
104GLPFN void (GLAPIENTRYP pfn_glBegin)(GLenum mode);
105#define glBegin pfn_glBegin
106
107GLPFN void (GLAPIENTRYP pfn_glBindTexture)(GLenum target, GLuint texture);
108#define glBindTexture pfn_glBindTexture
109
110GLPFN void (GLAPIENTRYP pfn_glBlendFunc)(GLenum sfactor, GLenum dfactor);
111#define glBlendFunc pfn_glBlendFunc
112
113GLPFN void (GLAPIENTRYP pfn_glClear)(GLbitfield mask);
114#define glClear pfn_glClear
115
116GLPFN void (GLAPIENTRYP pfn_glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
117#define glClearColor pfn_glClearColor
118
119GLPFN void (GLAPIENTRYP pfn_glClearDepth)(GLclampd depth);
120#define glClearDepth pfn_glClearDepth
121
122GLPFN void (GLAPIENTRYP pfn_glClearStencil)(GLint s);
123#define glClearStencil pfn_glClearStencil
124
125GLPFN void (GLAPIENTRYP pfn_glClipPlane)(GLenum plane, const GLdouble *equation);
126#define glClipPlane pfn_glClipPlane
127
128GLPFN void (GLAPIENTRYP pfn_glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
129#define glColorMask pfn_glColorMask
130
131GLPFN void (GLAPIENTRYP pfn_glColorPointer)(GLint size, GLenum type, GLsizei stride, const void *pointer);
132#define glColorPointer pfn_glColorPointer
133
134GLPFN void (GLAPIENTRYP pfn_glCullFace)(GLenum mode);
135#define glCullFace pfn_glCullFace
136
137GLPFN void (GLAPIENTRYP pfn_glDeleteTextures)(GLsizei n, const GLuint *textures);
138#define glDeleteTextures pfn_glDeleteTextures
139
140GLPFN void (GLAPIENTRYP pfn_glDepthFunc)(GLenum func);
141#define glDepthFunc pfn_glDepthFunc
142
143GLPFN void (GLAPIENTRYP pfn_glDepthMask)(GLboolean flag);
144#define glDepthMask pfn_glDepthMask
145
146GLPFN void (GLAPIENTRYP pfn_glDepthRange)(GLclampd zNear, GLclampd zFar);
147#define glDepthRange pfn_glDepthRange
148
149GLPFN void (GLAPIENTRYP pfn_glDisable)(GLenum cap);
150#define glDisable pfn_glDisable
151
152GLPFN void (GLAPIENTRYP pfn_glDisableClientState)(GLenum array);
153#define glDisableClientState pfn_glDisableClientState
154
155GLPFN void (GLAPIENTRYP pfn_glDrawArrays)(GLenum mode, GLint first, GLsizei count);
156#define glDrawArrays pfn_glDrawArrays
157
158GLPFN void (GLAPIENTRYP pfn_glDrawElements)(GLenum mode, GLsizei count, GLenum type, const void *indices);
159#define glDrawElements pfn_glDrawElements
160
161GLPFN void (GLAPIENTRYP pfn_glEnable)(GLenum cap);
162#define glEnable pfn_glEnable
163
164GLPFN void (GLAPIENTRYP pfn_glEnableClientState)(GLenum array);
165#define glEnableClientState pfn_glEnableClientState
166
167GLPFN void (GLAPIENTRYP pfn_glEnd)(void);
168#define glEnd pfn_glEnd
169
170GLPFN void (GLAPIENTRYP pfn_glFinish)(void);
171#define glFinish pfn_glFinish
172
173GLPFN void (GLAPIENTRYP pfn_glFlush)(void);
174#define glFlush pfn_glFlush
175
176GLPFN void (GLAPIENTRYP pfn_glFogf)(GLenum pname, GLfloat param);
177#define glFogf pfn_glFogf
178
179GLPFN void (GLAPIENTRYP pfn_glFogfv)(GLenum pname, const GLfloat *params);
180#define glFogfv pfn_glFogfv
181
182GLPFN void (GLAPIENTRYP pfn_glFogi)(GLenum pname, GLint param);
183#define glFogi pfn_glFogi
184
185GLPFN void (GLAPIENTRYP pfn_glFrontFace)(GLenum mode);
186#define glFrontFace pfn_glFrontFace
187
188GLPFN void (GLAPIENTRYP pfn_glGenTextures)(GLsizei n, GLuint *textures);
189#define glGenTextures pfn_glGenTextures
190
191GLPFN void (GLAPIENTRYP pfn_glGetBooleanv)(GLenum pname, GLboolean *params);
192#define glGetBooleanv pfn_glGetBooleanv
193
194GLPFN GLenum (GLAPIENTRYP pfn_glGetError)(void);
195#define glGetError pfn_glGetError
196
197GLPFN void (GLAPIENTRYP pfn_glGetFloatv)(GLenum pname, GLfloat *params);
198#define glGetFloatv pfn_glGetFloatv
199
200GLPFN void (GLAPIENTRYP pfn_glGetIntegerv)(GLenum pname, GLint *params);
201#define glGetIntegerv pfn_glGetIntegerv
202
203GLPFN const GLubyte * (GLAPIENTRYP pfn_glGetString)(GLenum name);
204#define glGetString pfn_glGetString
205
206GLPFN void (GLAPIENTRYP pfn_glGetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
207#define glGetTexImage pfn_glGetTexImage
208
209GLPFN void (GLAPIENTRYP pfn_glLightModelfv)(GLenum pname, const GLfloat *params);
210#define glLightModelfv pfn_glLightModelfv
211
212GLPFN void (GLAPIENTRYP pfn_glLightf)(GLenum light, GLenum pname, GLfloat param);
213#define glLightf pfn_glLightf
214
215GLPFN void (GLAPIENTRYP pfn_glLightfv)(GLenum light, GLenum pname, const GLfloat *params);
216#define glLightfv pfn_glLightfv
217
218GLPFN void (GLAPIENTRYP pfn_glLineWidth)(GLfloat width);
219#define glLineWidth pfn_glLineWidth
220
221GLPFN void (GLAPIENTRYP pfn_glLoadIdentity)(void);
222#define glLoadIdentity pfn_glLoadIdentity
223
224GLPFN void (GLAPIENTRYP pfn_glLoadMatrixf)(const GLfloat *m);
225#define glLoadMatrixf pfn_glLoadMatrixf
226
227GLPFN void (GLAPIENTRYP pfn_glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params);
228#define glMaterialfv pfn_glMaterialfv
229
230GLPFN void (GLAPIENTRYP pfn_glMatrixMode)(GLenum mode);
231#define glMatrixMode pfn_glMatrixMode
232
233GLPFN void (GLAPIENTRYP pfn_glMultMatrixf)(const GLfloat *m);
234#define glMultMatrixf pfn_glMultMatrixf
235
236GLPFN void (GLAPIENTRYP pfn_glNormalPointer)(GLenum type, GLsizei stride, const void *pointer);
237#define glNormalPointer pfn_glNormalPointer
238
239GLPFN void (GLAPIENTRYP pfn_glOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal);
240#define glOrtho pfn_glOrtho
241
242GLPFN void (GLAPIENTRYP pfn_glPixelStorei)(GLenum pname, GLint param);
243#define glPixelStorei pfn_glPixelStorei
244
245GLPFN void (GLAPIENTRYP pfn_glPointSize)(GLfloat size);
246#define glPointSize pfn_glPointSize
247
248GLPFN void (GLAPIENTRYP pfn_glPolygonMode)(GLenum face, GLenum mode);
249#define glPolygonMode pfn_glPolygonMode
250
251GLPFN void (GLAPIENTRYP pfn_glPolygonOffset)(GLfloat factor, GLfloat units);
252#define glPolygonOffset pfn_glPolygonOffset
253
254GLPFN void (GLAPIENTRYP pfn_glPopAttrib)(void);
255#define glPopAttrib pfn_glPopAttrib
256
257GLPFN void (GLAPIENTRYP pfn_glPopMatrix)(void);
258#define glPopMatrix pfn_glPopMatrix
259
260GLPFN void (GLAPIENTRYP pfn_glPushAttrib)(GLbitfield mask);
261#define glPushAttrib pfn_glPushAttrib
262
263GLPFN void (GLAPIENTRYP pfn_glPushMatrix)(void);
264#define glPushMatrix pfn_glPushMatrix
265
266GLPFN void (GLAPIENTRYP pfn_glScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
267#define glScissor pfn_glScissor
268
269GLPFN void (GLAPIENTRYP pfn_glShadeModel)(GLenum mode);
270#define glShadeModel pfn_glShadeModel
271
272GLPFN void (GLAPIENTRYP pfn_glStencilFunc)(GLenum func, GLint ref, GLuint mask);
273#define glStencilFunc pfn_glStencilFunc
274
275GLPFN void (GLAPIENTRYP pfn_glStencilMask)(GLuint mask);
276#define glStencilMask pfn_glStencilMask
277
278GLPFN void (GLAPIENTRYP pfn_glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
279#define glStencilOp pfn_glStencilOp
280
281GLPFN void (GLAPIENTRYP pfn_glTexCoord2f)(GLfloat s, GLfloat t);
282#define glTexCoord2f pfn_glTexCoord2f
283
284GLPFN void (GLAPIENTRYP pfn_glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const void *pointer);
285#define glTexCoordPointer pfn_glTexCoordPointer
286
287GLPFN void (GLAPIENTRYP pfn_glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
288#define glTexImage2D pfn_glTexImage2D
289
290GLPFN void (GLAPIENTRYP pfn_glTexParameterf)(GLenum target, GLenum pname, GLfloat param);
291#define glTexParameterf pfn_glTexParameterf
292
293GLPFN void (GLAPIENTRYP pfn_glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params);
294#define glTexParameterfv pfn_glTexParameterfv
295
296GLPFN void (GLAPIENTRYP pfn_glTexParameteri)(GLenum target, GLenum pname, GLint param);
297#define glTexParameteri pfn_glTexParameteri
298
299GLPFN void (GLAPIENTRYP pfn_glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
300#define glTexSubImage2D pfn_glTexSubImage2D
301
302GLPFN void (GLAPIENTRYP pfn_glVertex2i)(GLint x, GLint y);
303#define glVertex2i pfn_glVertex2i
304
305GLPFN void (GLAPIENTRYP pfn_glVertexPointer)(GLint size, GLenum type, GLsizei stride, const void *pointer);
306#define glVertexPointer pfn_glVertexPointer
307
308GLPFN void (GLAPIENTRYP pfn_glViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
309#define glViewport pfn_glViewport
310
311/*
312 * Extension functions (not exported from OpenGL32 on Windows).
313 */
314GLPFN void (GLAPIENTRYP pfn_glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
315#define glBlendColor pfn_glBlendColor
316
317GLPFN void (GLAPIENTRYP pfn_glBlendEquation)(GLenum mode);
318#define glBlendEquation pfn_glBlendEquation
319
320GLPFN void (GLAPIENTRYP pfn_glClientActiveTexture)(GLenum texture);
321#define glClientActiveTexture pfn_glClientActiveTexture
322
323#ifdef RT_OS_WINDOWS
324/*
325 * WGL.
326 */
327GLPFN HGLRC (WINAPI *pfn_wglCreateContext)(HDC);
328#define wglCreateContext pfn_wglCreateContext
329
330GLPFN BOOL (WINAPI *pfn_wglDeleteContext)(HGLRC);
331#define wglDeleteContext pfn_wglDeleteContext
332
333GLPFN BOOL (WINAPI *pfn_wglMakeCurrent)(HDC, HGLRC);
334#define wglMakeCurrent pfn_wglMakeCurrent
335
336GLPFN BOOL (WINAPI *pfn_wglShareLists)(HGLRC, HGLRC);
337#define wglShareLists pfn_wglShareLists
338
339#elif defined(RT_OS_LINUX)
340/*
341 * GLX
342 */
343GLPFN int (* pfn_glXGetFBConfigAttrib)(Display * dpy, GLXFBConfig config, int attribute, int * value);
344#define glXGetFBConfigAttrib pfn_glXGetFBConfigAttrib
345
346GLPFN XVisualInfo * (* pfn_glXGetVisualFromFBConfig)(Display * dpy, GLXFBConfig config);
347#define glXGetVisualFromFBConfig pfn_glXGetVisualFromFBConfig
348
349GLPFN Bool (* pfn_glXQueryVersion)(Display * dpy, int * major, int * minor);
350#define glXQueryVersion pfn_glXQueryVersion
351
352GLPFN GLXFBConfig * (* pfn_glXChooseFBConfig)(Display * dpy, int screen, const int * attrib_list, int * nelements);
353#define glXChooseFBConfig pfn_glXChooseFBConfig
354
355GLPFN XVisualInfo* (* pfn_glXChooseVisual)(Display * dpy, int screen, int * attribList);
356#define glXChooseVisual pfn_glXChooseVisual
357
358GLPFN GLXContext (* pfn_glXCreateContext)(Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
359#define glXCreateContext pfn_glXCreateContext
360
361GLPFN GLXPixmap (* pfn_glXCreatePixmap)(Display * dpy, GLXFBConfig config, Pixmap pixmap, const int * attrib_list);
362#define glXCreatePixmap pfn_glXCreatePixmap
363
364GLPFN Bool (* pfn_glXMakeCurrent)(Display * dpy, GLXDrawable drawable, GLXContext ctx);
365#define glXMakeCurrent pfn_glXMakeCurrent
366
367GLPFN void (* pfn_glXDestroyContext)(Display * dpy, GLXContext ctx);
368#define glXDestroyContext pfn_glXDestroyContext
369
370GLPFN void (* pfn_glXDestroyPixmap)(Display * dpy, GLXPixmap Pixmap);
371#define glXDestroyPixmap pfn_glXDestroyPixmap
372
373/*
374 * X11
375 */
376GLPFN int (* pfn_XConfigureWindow)(Display *display, Window w, unsigned value_mask, XWindowChanges *changes);
377#define XConfigureWindow pfn_XConfigureWindow
378
379GLPFN int (* pfn_XCloseDisplay)(Display *display);
380#define XCloseDisplay pfn_XCloseDisplay
381
382GLPFN Colormap (* pfn_XCreateColormap)(Display *display, Window w, Visual *visual, int alloc);
383#define XCreateColormap pfn_XCreateColormap
384
385GLPFN Pixmap (* pfn_XCreatePixmap)(Display *display, Drawable d, unsigned int width, unsigned int height, unsigned int depth);
386#define XCreatePixmap pfn_XCreatePixmap
387
388GLPFN Window (* pfn_XCreateWindow)(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height,
389 unsigned int border_width, int depth, unsigned int window_class, Visual *visual, unsigned long valuemask, XSetWindowAttributes *attributes);
390#define XCreateWindow pfn_XCreateWindow
391
392GLPFN Window (* pfn_XDefaultRootWindow)(Display *display);
393#define XDefaultRootWindow pfn_XDefaultRootWindow
394
395GLPFN int (* pfn_XDestroyWindow)(Display *display, Window w);
396#define XDestroyWindow pfn_XDestroyWindow
397
398GLPFN int (* pfn_XFree)(void *data);
399#define XFree pfn_XFree
400
401GLPFN int (* pfn_XFreePixmap)(Display *display, Pixmap pixmap);
402#define XFreePixmap pfn_XFreePixmap
403
404GLPFN Status (* pfn_XInitThreads)(void);
405#define XInitThreads pfn_XInitThreads
406
407GLPFN int (* pfn_XNextEvent)(Display *display, XEvent *event_return);
408#define XNextEvent pfn_XNextEvent
409
410GLPFN Display *(* pfn_XOpenDisplay)(char *display_name);
411#define XOpenDisplay pfn_XOpenDisplay
412
413GLPFN int (* pfn_XPending)(Display *display);
414#define XPending pfn_XPending
415
416GLPFN int (* (* pfn_XSetErrorHandler)(int (*handler)(Display *, XErrorEvent *)))(Display *, XErrorEvent *);
417#define XSetErrorHandler pfn_XSetErrorHandler
418
419GLPFN int (* pfn_XSync)(Display *display, Bool discard);
420#define XSync pfn_XSync
421
422GLPFN int (* pfn_XScreenNumberOfScreen)(Screen *screen);
423#define XScreenNumberOfScreen pfn_XScreenNumberOfScreen
424
425GLPFN int (* pfn_XMapWindow)(Display *display, Window w);
426#define XMapWindow pfn_XMapWindow
427
428GLPFN Status (* pfn_XGetWindowAttributes)(Display *display, Window w, XWindowAttributes *window_attributes_return);
429#define XGetWindowAttributes pfn_XGetWindowAttributes
430
431#endif
432
433#endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_glLdr_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette