VirtualBox

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

Last change on this file since 105381 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

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