VirtualBox

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

Last change on this file since 76519 was 76315, checked in by vboxsync, 6 years ago

DevVGA-SVGA3d-glLdr.h: Temporary hack for system glext.h using different header guard macro and defining GL_GLEXT_VERSION differently.

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