VirtualBox

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

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

DevVGA-SVGA3d: dynamic loading of OpenGL: call XInitThreads

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