1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox Windows NT/2000/XP guest OpenGL ICD
|
---|
4 | *
|
---|
5 | * OpenGL extensions
|
---|
6 | *
|
---|
7 | * References: http://oss.sgi.com/projects/ogl-sample/registry/
|
---|
8 | * http://icps.u-strasbg.fr/~marchesin/perso/extensions/
|
---|
9 | *
|
---|
10 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
11 | *
|
---|
12 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | * available from http://www.virtualbox.org. This file is free software;
|
---|
14 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | * General Public License as published by the Free Software Foundation,
|
---|
16 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
17 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
18 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 | *
|
---|
20 | * If you received this file as part of a commercial VirtualBox
|
---|
21 | * distribution, then only the terms of your commercial VirtualBox
|
---|
22 | * license agreement apply instead of the previous paragraph.
|
---|
23 | *
|
---|
24 | */
|
---|
25 |
|
---|
26 | #define VBOX_OGL_WITH_EXTENSION_ARRAY
|
---|
27 | #include "VBoxOGL.h"
|
---|
28 |
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Initialize OpenGL extensions
|
---|
32 | *
|
---|
33 | * @returns VBox status code
|
---|
34 | * @param pCtx OpenGL thread context
|
---|
35 | */
|
---|
36 | int vboxInitOpenGLExtensions(PVBOX_OGL_THREAD_CTX pCtx)
|
---|
37 | {
|
---|
38 | char *pszExtensions;
|
---|
39 | static bool fInitialized = false;
|
---|
40 | VBoxOGLglGetString parms;
|
---|
41 | int rc;
|
---|
42 |
|
---|
43 | if (fInitialized)
|
---|
44 | return VINF_SUCCESS;
|
---|
45 |
|
---|
46 | memset(&parms, 0, sizeof(parms));
|
---|
47 | VBOX_INIT_CALL(&parms.hdr, GLGETSTRING, pCtx);
|
---|
48 |
|
---|
49 | parms.name.type = VMMDevHGCMParmType_32bit;
|
---|
50 | parms.name.u.value32 = GL_EXTENSIONS;
|
---|
51 | parms.pString.type = VMMDevHGCMParmType_LinAddr;
|
---|
52 | parms.pString.u.Pointer.size = sizeof(szOpenGLExtensions);
|
---|
53 | parms.pString.u.Pointer.u.linearAddr = (vmmDevHypPtr)szOpenGLExtensions;
|
---|
54 |
|
---|
55 | rc = vboxHGCMCall(&parms, sizeof (parms));
|
---|
56 |
|
---|
57 | if ( VBOX_FAILURE(rc)
|
---|
58 | || VBOX_FAILURE(parms.hdr.result))
|
---|
59 | {
|
---|
60 | DbgPrintf(("GL_EXTENSIONS failed with %x %x\n", rc, parms.hdr.result));
|
---|
61 | return (rc == VINF_SUCCESS) ? parms.hdr.result : rc;
|
---|
62 | }
|
---|
63 | DbgPrintf(("GL_EXTENSIONS=%s\n\n", szOpenGLExtensions));
|
---|
64 |
|
---|
65 | pszExtensions = strdup(szOpenGLExtensions);
|
---|
66 | szOpenGLExtensions[0] = 0;
|
---|
67 |
|
---|
68 | for (int i=0;i<RT_ELEMENTS(OpenGLExtensions);i++)
|
---|
69 | {
|
---|
70 | if (strstr((char *)pszExtensions, OpenGLExtensions[i].pszExtName))
|
---|
71 | OpenGLExtensions[i].fAvailable = VBoxIsExtensionAvailable(OpenGLExtensions[i].pszExtFunctionName);
|
---|
72 |
|
---|
73 | if ( OpenGLExtensions[i].fAvailable
|
---|
74 | && !strstr(szOpenGLExtensions, OpenGLExtensions[i].pszExtName))
|
---|
75 | {
|
---|
76 | strcat(szOpenGLExtensions, OpenGLExtensions[i].pszExtName);
|
---|
77 | strcat(szOpenGLExtensions, " ");
|
---|
78 | }
|
---|
79 | }
|
---|
80 |
|
---|
81 | free(pszExtensions);
|
---|
82 |
|
---|
83 | fInitialized = true;
|
---|
84 | return VINF_SUCCESS;
|
---|
85 | }
|
---|
86 |
|
---|
87 |
|
---|
88 | PROC APIENTRY DrvGetProcAddress(LPCSTR lpszProc)
|
---|
89 | {
|
---|
90 | PROC pfnProc = NULL;
|
---|
91 |
|
---|
92 | for (int i=0;i<RT_ELEMENTS(OpenGLExtensions);i++)
|
---|
93 | {
|
---|
94 | if ( OpenGLExtensions[i].fAvailable
|
---|
95 | && !strcmp(OpenGLExtensions[i].pszExtFunctionName, lpszProc))
|
---|
96 | {
|
---|
97 | pfnProc = (PROC)OpenGLExtensions[i].pfnFunction;
|
---|
98 | }
|
---|
99 | }
|
---|
100 | if (pfnProc == NULL)
|
---|
101 | DbgPrintf(("DrvGetProcAddress %s FAILED\n", lpszProc));
|
---|
102 | else
|
---|
103 | DbgPrintf(("DrvGetProcAddress %s\n", lpszProc));
|
---|
104 |
|
---|
105 | return pfnProc;
|
---|
106 | }
|
---|
107 |
|
---|
108 | BOOL WINAPI wglSwapIntervalEXT(int interval)
|
---|
109 | {
|
---|
110 | VBOX_OGL_GEN_SYNC_OP1_RET(BOOL, wglSwapIntervalEXT, interval);
|
---|
111 | return retval;
|
---|
112 | }
|
---|
113 |
|
---|
114 | int WINAPI wglGetSwapIntervalEXT(void)
|
---|
115 | {
|
---|
116 | VBOX_OGL_GEN_SYNC_OP_RET(int, wglGetSwapIntervalEXT);
|
---|
117 | return retval;
|
---|
118 | }
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 |
|
---|
123 |
|
---|
124 | #if 0
|
---|
125 | GL_ARB_multitexture
|
---|
126 | GL_EXT_texture_env_add
|
---|
127 | GL_EXT_compiled_vertex_array
|
---|
128 | GL_S3_s3tc
|
---|
129 | GL_ARB_occlusion_query
|
---|
130 | GL_ARB_point_parameters
|
---|
131 | GL_ARB_texture_border_clamp
|
---|
132 | GL_ARB_texture_compression
|
---|
133 | GL_ARB_texture_cube_map
|
---|
134 | GL_ARB_texture_env_add
|
---|
135 | GL_ARB_texture_env_combine
|
---|
136 | GL_ARB_texture_env_crossbar
|
---|
137 | GL_ARB_texture_env_dot3
|
---|
138 | GL_ARB_texture_mirrored_repeat
|
---|
139 | GL_ARB_transpose_matrix
|
---|
140 | GL_ARB_vertex_blend
|
---|
141 | GL_ARB_vertex_buffer_object
|
---|
142 | GL_ARB_vertex_program
|
---|
143 | GL_ARB_window_pos
|
---|
144 | GL_ATI_element_array
|
---|
145 | GL_ATI_envmap_bumpmap
|
---|
146 | GL_ATI_fragment_shader
|
---|
147 | GL_ATI_map_object_buffer
|
---|
148 | GL_ATI_texture_env_combine3
|
---|
149 | GL_ATI_texture_mirror_once
|
---|
150 | GL_ATI_vertex_array_object
|
---|
151 | GL_ATI_vertex_attrib_array_object
|
---|
152 | GL_ATI_vertex_streams
|
---|
153 | GL_ATIX_texture_env_combine3
|
---|
154 | GL_ATIX_texture_env_route
|
---|
155 | GL_ATIX_vertex_shader_output_point_size
|
---|
156 | GL_EXT_abgr
|
---|
157 | GL_EXT_bgra
|
---|
158 | GL_EXT_blend_color
|
---|
159 | GL_EXT_blend_func_separate
|
---|
160 | GL_EXT_blend_minmax
|
---|
161 | GL_EXT_blend_subtract
|
---|
162 | GL_EXT_clip_volume_hint
|
---|
163 | GL_EXT_draw_range_elements
|
---|
164 | GL_EXT_fog_coord
|
---|
165 | GL_EXT_multi_draw_arrays
|
---|
166 | GL_EXT_packed_pixels
|
---|
167 | GL_EXT_point_parameters
|
---|
168 | GL_EXT_polygon_offset
|
---|
169 | GL_EXT_rescale_normal
|
---|
170 | GL_EXT_secondary_color
|
---|
171 | GL_EXT_separate_specular_color
|
---|
172 | GL_EXT_stencil_wrap
|
---|
173 | GL_EXT_texgen_reflection
|
---|
174 | GL_EXT_texture3D
|
---|
175 | GL_EXT_texture_compression_s3tc
|
---|
176 | GL_EXT_texture_cube_map
|
---|
177 | GL_EXT_texture_edge_clamp
|
---|
178 | GL_EXT_texture_env_combine
|
---|
179 | GL_EXT_texture_env_dot3
|
---|
180 | GL_EXT_texture_filter_anisotropic
|
---|
181 | GL_EXT_texture_lod_bias
|
---|
182 | GL_EXT_texture_mirror_clamp
|
---|
183 | GL_EXT_texture_object
|
---|
184 | GL_EXT_texture_rectangle
|
---|
185 | GL_EXT_vertex_array
|
---|
186 | GL_EXT_vertex_shader
|
---|
187 | GL_HP_occlusion_test
|
---|
188 | GL_KTX_buffer_region
|
---|
189 | GL_NV_blend_square
|
---|
190 | GL_NV_occlusion_query
|
---|
191 | GL_NV_texgen_reflection
|
---|
192 | GL_SGI_color_matrix
|
---|
193 | GL_SGIS_generate_mipmap
|
---|
194 | GL_SGIS_multitexture
|
---|
195 | GL_SGIS_texture_border_clamp
|
---|
196 | GL_SGIS_texture_edge_clamp
|
---|
197 | GL_SGIS_texture_lod
|
---|
198 | GL_SUN_multi_draw_arrays
|
---|
199 | GL_WIN_swap_hint
|
---|
200 | WGL_EXT_extensions_string
|
---|
201 | #endif
|
---|
202 |
|
---|