VirtualBox

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

Last change on this file since 84677 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

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