1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * OpenGL support info used for 2D support detection
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox base platform packages, as
|
---|
11 | * available from https://www.virtualbox.org.
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU General Public License
|
---|
15 | * as published by the Free Software Foundation, in version 3 of the
|
---|
16 | * License.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful, but
|
---|
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | *
|
---|
26 | * The contents of this file may alternatively be used under the terms
|
---|
27 | * of the Common Development and Distribution License Version 1.0
|
---|
28 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
29 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
30 | * CDDL are applicable instead of those of the GPL.
|
---|
31 | *
|
---|
32 | * You may elect to license modified versions of this file under the
|
---|
33 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
34 | *
|
---|
35 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifndef VBOX_INCLUDED_VBoxGL2D_h
|
---|
39 | #define VBOX_INCLUDED_VBoxGL2D_h
|
---|
40 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
41 | # pragma once
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #include <iprt/types.h>
|
---|
45 |
|
---|
46 | typedef char GLchar;
|
---|
47 |
|
---|
48 | #ifndef GL_COMPILE_STATUS
|
---|
49 | # define GL_COMPILE_STATUS 0x8b81
|
---|
50 | #endif
|
---|
51 | #ifndef GL_LINK_STATUS
|
---|
52 | # define GL_LINK_STATUS 0x8b82
|
---|
53 | #endif
|
---|
54 | #ifndef GL_FRAGMENT_SHADER
|
---|
55 | # define GL_FRAGMENT_SHADER 0x8b30
|
---|
56 | #endif
|
---|
57 | #ifndef GL_VERTEX_SHADER
|
---|
58 | # define GL_VERTEX_SHADER 0x8b31
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | /* GL_ARB_multitexture */
|
---|
62 | #ifndef GL_TEXTURE0
|
---|
63 | # define GL_TEXTURE0 0x84c0
|
---|
64 | #endif
|
---|
65 | #ifndef GL_TEXTURE1
|
---|
66 | # define GL_TEXTURE1 0x84c1
|
---|
67 | #endif
|
---|
68 | #ifndef GL_MAX_TEXTURE_COORDS
|
---|
69 | # define GL_MAX_TEXTURE_COORDS 0x8871
|
---|
70 | #endif
|
---|
71 | #ifndef GL_MAX_TEXTURE_IMAGE_UNITS
|
---|
72 | # define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #ifndef APIENTRY
|
---|
76 | # define APIENTRY
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_ACTIVE_TEXTURE) (GLenum texture);
|
---|
80 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_MULTI_TEX_COORD2I) (GLenum texture, GLint v0, GLint v1);
|
---|
81 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_MULTI_TEX_COORD2F) (GLenum texture, GLfloat v0, GLfloat v1);
|
---|
82 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_MULTI_TEX_COORD2D) (GLenum texture, GLdouble v0, GLdouble v1);
|
---|
83 |
|
---|
84 | /* GL_ARB_texture_rectangle */
|
---|
85 | #ifndef GL_TEXTURE_RECTANGLE
|
---|
86 | # define GL_TEXTURE_RECTANGLE 0x84F5
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | /* GL_ARB_shader_objects */
|
---|
90 | /* GL_ARB_fragment_shader */
|
---|
91 |
|
---|
92 | typedef GLuint (APIENTRY *PFNVBOXVHWA_CREATE_SHADER) (GLenum type);
|
---|
93 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_SHADER_SOURCE) (GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
|
---|
94 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_COMPILE_SHADER) (GLuint shader);
|
---|
95 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_DELETE_SHADER) (GLuint shader);
|
---|
96 |
|
---|
97 | typedef GLuint (APIENTRY *PFNVBOXVHWA_CREATE_PROGRAM) ();
|
---|
98 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_ATTACH_SHADER) (GLuint program, GLuint shader);
|
---|
99 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_DETACH_SHADER) (GLuint program, GLuint shader);
|
---|
100 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_LINK_PROGRAM) (GLuint program);
|
---|
101 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_USE_PROGRAM) (GLuint program);
|
---|
102 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_DELETE_PROGRAM) (GLuint program);
|
---|
103 |
|
---|
104 | typedef GLboolean (APIENTRY *PFNVBOXVHWA_IS_SHADER) (GLuint shader);
|
---|
105 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_SHADERIV) (GLuint shader, GLenum pname, GLint *params);
|
---|
106 | typedef GLboolean (APIENTRY *PFNVBOXVHWA_IS_PROGRAM) (GLuint program);
|
---|
107 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_PROGRAMIV) (GLuint program, GLenum pname, GLint *params);
|
---|
108 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_ATTACHED_SHADERS) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
---|
109 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_SHADER_INFO_LOG) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
---|
110 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_PROGRAM_INFO_LOG) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
---|
111 | typedef GLint (APIENTRY *PFNVBOXVHWA_GET_UNIFORM_LOCATION) (GLint programObj, const GLchar *name);
|
---|
112 |
|
---|
113 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM1F)(GLint location, GLfloat v0);
|
---|
114 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM2F)(GLint location, GLfloat v0, GLfloat v1);
|
---|
115 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM3F)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
---|
116 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM4F)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
---|
117 |
|
---|
118 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM1I)(GLint location, GLint v0);
|
---|
119 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM2I)(GLint location, GLint v0, GLint v1);
|
---|
120 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM3I)(GLint location, GLint v0, GLint v1, GLint v2);
|
---|
121 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM4I)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
---|
122 |
|
---|
123 | /* GL_ARB_pixel_buffer_object*/
|
---|
124 | #ifndef Q_WS_MAC
|
---|
125 | /* apears to be defined on mac */
|
---|
126 | typedef ptrdiff_t GLsizeiptr;
|
---|
127 | #endif
|
---|
128 |
|
---|
129 | #ifndef GL_READ_ONLY
|
---|
130 | # define GL_READ_ONLY 0x88B8
|
---|
131 | #endif
|
---|
132 | #ifndef GL_WRITE_ONLY
|
---|
133 | # define GL_WRITE_ONLY 0x88B9
|
---|
134 | #endif
|
---|
135 | #ifndef GL_READ_WRITE
|
---|
136 | # define GL_READ_WRITE 0x88BA
|
---|
137 | #endif
|
---|
138 | #ifndef GL_STREAM_DRAW
|
---|
139 | # define GL_STREAM_DRAW 0x88E0
|
---|
140 | #endif
|
---|
141 | #ifndef GL_STREAM_READ
|
---|
142 | # define GL_STREAM_READ 0x88E1
|
---|
143 | #endif
|
---|
144 | #ifndef GL_STREAM_COPY
|
---|
145 | # define GL_STREAM_COPY 0x88E2
|
---|
146 | #endif
|
---|
147 | #ifndef GL_DYNAMIC_DRAW
|
---|
148 | # define GL_DYNAMIC_DRAW 0x88E8
|
---|
149 | #endif
|
---|
150 |
|
---|
151 | #ifndef GL_PIXEL_PACK_BUFFER
|
---|
152 | # define GL_PIXEL_PACK_BUFFER 0x88EB
|
---|
153 | #endif
|
---|
154 | #ifndef GL_PIXEL_UNPACK_BUFFER
|
---|
155 | # define GL_PIXEL_UNPACK_BUFFER 0x88EC
|
---|
156 | #endif
|
---|
157 | #ifndef GL_PIXEL_PACK_BUFFER_BINDING
|
---|
158 | # define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
|
---|
159 | #endif
|
---|
160 | #ifndef GL_PIXEL_UNPACK_BUFFER_BINDING
|
---|
161 | # define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
|
---|
162 | #endif
|
---|
163 |
|
---|
164 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GEN_BUFFERS)(GLsizei n, GLuint *buffers);
|
---|
165 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_DELETE_BUFFERS)(GLsizei n, const GLuint *buffers);
|
---|
166 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_BIND_BUFFER)(GLenum target, GLuint buffer);
|
---|
167 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_BUFFER_DATA)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
|
---|
168 | typedef GLvoid* (APIENTRY *PFNVBOXVHWA_MAP_BUFFER)(GLenum target, GLenum access);
|
---|
169 | typedef GLboolean (APIENTRY *PFNVBOXVHWA_UNMAP_BUFFER)(GLenum target);
|
---|
170 |
|
---|
171 | /* GL_EXT_framebuffer_object */
|
---|
172 | #ifndef GL_FRAMEBUFFER
|
---|
173 | # define GL_FRAMEBUFFER 0x8D40
|
---|
174 | #endif
|
---|
175 | #ifndef GL_COLOR_ATTACHMENT0
|
---|
176 | # define GL_COLOR_ATTACHMENT0 0x8CE0
|
---|
177 | #endif
|
---|
178 |
|
---|
179 | typedef GLboolean (APIENTRY *PFNVBOXVHWA_IS_FRAMEBUFFER)(GLuint framebuffer);
|
---|
180 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_BIND_FRAMEBUFFER)(GLenum target, GLuint framebuffer);
|
---|
181 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_DELETE_FRAMEBUFFERS)(GLsizei n, const GLuint *framebuffers);
|
---|
182 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GEN_FRAMEBUFFERS)(GLsizei n, GLuint *framebuffers);
|
---|
183 | typedef GLenum (APIENTRY *PFNVBOXVHWA_CHECK_FRAMEBUFFER_STATUS)(GLenum target);
|
---|
184 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_FRAMEBUFFER_TEXTURE1D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
---|
185 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_FRAMEBUFFER_TEXTURE2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
---|
186 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_FRAMEBUFFER_TEXTURE3D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
---|
187 | typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_FRAMEBUFFER_ATTACHMENT_PARAMETRIV)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
---|
188 |
|
---|
189 |
|
---|
190 | /*****************/
|
---|
191 |
|
---|
192 | /* functions */
|
---|
193 |
|
---|
194 | /* @todo: move those to VBoxGLInfo class instance members ??? */
|
---|
195 | extern PFNVBOXVHWA_ACTIVE_TEXTURE vboxglActiveTexture;
|
---|
196 | extern PFNVBOXVHWA_MULTI_TEX_COORD2I vboxglMultiTexCoord2i;
|
---|
197 | extern PFNVBOXVHWA_MULTI_TEX_COORD2D vboxglMultiTexCoord2d;
|
---|
198 | extern PFNVBOXVHWA_MULTI_TEX_COORD2F vboxglMultiTexCoord2f;
|
---|
199 |
|
---|
200 |
|
---|
201 | extern PFNVBOXVHWA_CREATE_SHADER vboxglCreateShader;
|
---|
202 | extern PFNVBOXVHWA_SHADER_SOURCE vboxglShaderSource;
|
---|
203 | extern PFNVBOXVHWA_COMPILE_SHADER vboxglCompileShader;
|
---|
204 | extern PFNVBOXVHWA_DELETE_SHADER vboxglDeleteShader;
|
---|
205 |
|
---|
206 | extern PFNVBOXVHWA_CREATE_PROGRAM vboxglCreateProgram;
|
---|
207 | extern PFNVBOXVHWA_ATTACH_SHADER vboxglAttachShader;
|
---|
208 | extern PFNVBOXVHWA_DETACH_SHADER vboxglDetachShader;
|
---|
209 | extern PFNVBOXVHWA_LINK_PROGRAM vboxglLinkProgram;
|
---|
210 | extern PFNVBOXVHWA_USE_PROGRAM vboxglUseProgram;
|
---|
211 | extern PFNVBOXVHWA_DELETE_PROGRAM vboxglDeleteProgram;
|
---|
212 |
|
---|
213 | extern PFNVBOXVHWA_IS_SHADER vboxglIsShader;
|
---|
214 | extern PFNVBOXVHWA_GET_SHADERIV vboxglGetShaderiv;
|
---|
215 | extern PFNVBOXVHWA_IS_PROGRAM vboxglIsProgram;
|
---|
216 | extern PFNVBOXVHWA_GET_PROGRAMIV vboxglGetProgramiv;
|
---|
217 | extern PFNVBOXVHWA_GET_ATTACHED_SHADERS vboxglGetAttachedShaders;
|
---|
218 | extern PFNVBOXVHWA_GET_SHADER_INFO_LOG vboxglGetShaderInfoLog;
|
---|
219 | extern PFNVBOXVHWA_GET_PROGRAM_INFO_LOG vboxglGetProgramInfoLog;
|
---|
220 |
|
---|
221 | extern PFNVBOXVHWA_GET_UNIFORM_LOCATION vboxglGetUniformLocation;
|
---|
222 |
|
---|
223 | extern PFNVBOXVHWA_UNIFORM1F vboxglUniform1f;
|
---|
224 | extern PFNVBOXVHWA_UNIFORM2F vboxglUniform2f;
|
---|
225 | extern PFNVBOXVHWA_UNIFORM3F vboxglUniform3f;
|
---|
226 | extern PFNVBOXVHWA_UNIFORM4F vboxglUniform4f;
|
---|
227 |
|
---|
228 | extern PFNVBOXVHWA_UNIFORM1I vboxglUniform1i;
|
---|
229 | extern PFNVBOXVHWA_UNIFORM2I vboxglUniform2i;
|
---|
230 | extern PFNVBOXVHWA_UNIFORM3I vboxglUniform3i;
|
---|
231 | extern PFNVBOXVHWA_UNIFORM4I vboxglUniform4i;
|
---|
232 |
|
---|
233 | extern PFNVBOXVHWA_GEN_BUFFERS vboxglGenBuffers;
|
---|
234 | extern PFNVBOXVHWA_DELETE_BUFFERS vboxglDeleteBuffers;
|
---|
235 | extern PFNVBOXVHWA_BIND_BUFFER vboxglBindBuffer;
|
---|
236 | extern PFNVBOXVHWA_BUFFER_DATA vboxglBufferData;
|
---|
237 | extern PFNVBOXVHWA_MAP_BUFFER vboxglMapBuffer;
|
---|
238 | extern PFNVBOXVHWA_UNMAP_BUFFER vboxglUnmapBuffer;
|
---|
239 |
|
---|
240 | extern PFNVBOXVHWA_IS_FRAMEBUFFER vboxglIsFramebuffer;
|
---|
241 | extern PFNVBOXVHWA_BIND_FRAMEBUFFER vboxglBindFramebuffer;
|
---|
242 | extern PFNVBOXVHWA_DELETE_FRAMEBUFFERS vboxglDeleteFramebuffers;
|
---|
243 | extern PFNVBOXVHWA_GEN_FRAMEBUFFERS vboxglGenFramebuffers;
|
---|
244 | extern PFNVBOXVHWA_CHECK_FRAMEBUFFER_STATUS vboxglCheckFramebufferStatus;
|
---|
245 | extern PFNVBOXVHWA_FRAMEBUFFER_TEXTURE1D vboxglFramebufferTexture1D;
|
---|
246 | extern PFNVBOXVHWA_FRAMEBUFFER_TEXTURE2D vboxglFramebufferTexture2D;
|
---|
247 | extern PFNVBOXVHWA_FRAMEBUFFER_TEXTURE3D vboxglFramebufferTexture3D;
|
---|
248 | extern PFNVBOXVHWA_GET_FRAMEBUFFER_ATTACHMENT_PARAMETRIV vboxglGetFramebufferAttachmentParameteriv;
|
---|
249 |
|
---|
250 |
|
---|
251 | /*
|
---|
252 | * Glossing over qt 5 vs 6 differences.
|
---|
253 | *
|
---|
254 | * Note! We could use the qt6 classes in 5, but we probably don't have the
|
---|
255 | * necessary modules in our current qt builds.
|
---|
256 | */
|
---|
257 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
---|
258 | class QOpenGLWidget;
|
---|
259 | class QOpenGLContext;
|
---|
260 | # define MY_QOpenGLWidget QOpenGLWidget
|
---|
261 | # define MY_QOpenGLContext QOpenGLContext
|
---|
262 | #else
|
---|
263 | class QGLWidget;
|
---|
264 | class QGLContext;
|
---|
265 | # define MY_QOpenGLWidget QGLWidget
|
---|
266 | # define MY_QOpenGLContext QGLContext
|
---|
267 | #endif
|
---|
268 |
|
---|
269 |
|
---|
270 | class VBoxGLInfo
|
---|
271 | {
|
---|
272 | public:
|
---|
273 | VBoxGLInfo() :
|
---|
274 | mGLVersion(0),
|
---|
275 | mFragmentShaderSupported(false),
|
---|
276 | mTextureRectangleSupported(false),
|
---|
277 | mTextureNP2Supported(false),
|
---|
278 | mPBOSupported(false),
|
---|
279 | mFBOSupported(false),
|
---|
280 | mMultiTexNumSupported(1), /* 1 would mean it is not supported */
|
---|
281 | m_GL_ARB_multitexture(false),
|
---|
282 | m_GL_ARB_shader_objects(false),
|
---|
283 | m_GL_ARB_fragment_shader(false),
|
---|
284 | m_GL_ARB_pixel_buffer_object(false),
|
---|
285 | m_GL_ARB_texture_rectangle(false),
|
---|
286 | m_GL_EXT_texture_rectangle(false),
|
---|
287 | m_GL_NV_texture_rectangle(false),
|
---|
288 | m_GL_ARB_texture_non_power_of_two(false),
|
---|
289 | m_GL_EXT_framebuffer_object(false),
|
---|
290 | mInitialized(false)
|
---|
291 | {}
|
---|
292 |
|
---|
293 | void init(const MY_QOpenGLContext *pContext);
|
---|
294 |
|
---|
295 | bool isInitialized() const { return mInitialized; }
|
---|
296 |
|
---|
297 | int getGLVersion() const { return mGLVersion; }
|
---|
298 | bool isFragmentShaderSupported() const { return mFragmentShaderSupported; }
|
---|
299 | bool isTextureRectangleSupported() const { return mTextureRectangleSupported; }
|
---|
300 | bool isTextureNP2Supported() const { return mTextureNP2Supported; }
|
---|
301 | bool isPBOSupported() const { return mPBOSupported; }
|
---|
302 | /* some ATI drivers do not seem to support non-zero offsets when dealing with PBOs
|
---|
303 | * @todo: add a check for that, always unsupported currently */
|
---|
304 | bool isPBOOffsetSupported() const { return false; }
|
---|
305 | bool isFBOSupported() const { return mFBOSupported; }
|
---|
306 | /* 1 would mean it is not supported */
|
---|
307 | int getMultiTexNumSupported() const { return mMultiTexNumSupported; }
|
---|
308 |
|
---|
309 | static int parseVersion(const GLubyte * ver);
|
---|
310 | private:
|
---|
311 | void initExtSupport(const MY_QOpenGLContext &context);
|
---|
312 |
|
---|
313 | int mGLVersion;
|
---|
314 | bool mFragmentShaderSupported;
|
---|
315 | bool mTextureRectangleSupported;
|
---|
316 | bool mTextureNP2Supported;
|
---|
317 | bool mPBOSupported;
|
---|
318 | bool mFBOSupported;
|
---|
319 | int mMultiTexNumSupported; /* 1 would mean it is not supported */
|
---|
320 |
|
---|
321 | bool m_GL_ARB_multitexture;
|
---|
322 | bool m_GL_ARB_shader_objects;
|
---|
323 | bool m_GL_ARB_fragment_shader;
|
---|
324 | bool m_GL_ARB_pixel_buffer_object;
|
---|
325 | bool m_GL_ARB_texture_rectangle;
|
---|
326 | bool m_GL_EXT_texture_rectangle;
|
---|
327 | bool m_GL_NV_texture_rectangle;
|
---|
328 | bool m_GL_ARB_texture_non_power_of_two;
|
---|
329 | bool m_GL_EXT_framebuffer_object;
|
---|
330 |
|
---|
331 | bool mInitialized;
|
---|
332 | };
|
---|
333 |
|
---|
334 | class VBoxGLTmpContext
|
---|
335 | {
|
---|
336 | public:
|
---|
337 | VBoxGLTmpContext();
|
---|
338 | ~VBoxGLTmpContext();
|
---|
339 |
|
---|
340 | const MY_QOpenGLContext *makeCurrent();
|
---|
341 | private:
|
---|
342 | MY_QOpenGLWidget *mWidget;
|
---|
343 | };
|
---|
344 |
|
---|
345 |
|
---|
346 | #define VBOXQGL_MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
---|
347 | ((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \
|
---|
348 | ((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
|
---|
349 |
|
---|
350 | #define FOURCC_AYUV VBOXQGL_MAKEFOURCC('A', 'Y', 'U', 'V')
|
---|
351 | #define FOURCC_UYVY VBOXQGL_MAKEFOURCC('U', 'Y', 'V', 'Y')
|
---|
352 | #define FOURCC_YUY2 VBOXQGL_MAKEFOURCC('Y', 'U', 'Y', '2')
|
---|
353 | #define FOURCC_YV12 VBOXQGL_MAKEFOURCC('Y', 'V', '1', '2')
|
---|
354 | #define VBOXVHWA_NUMFOURCC 4
|
---|
355 |
|
---|
356 | class VBoxVHWAInfo
|
---|
357 | {
|
---|
358 | public:
|
---|
359 | VBoxVHWAInfo() :
|
---|
360 | mFourccSupportedCount(0),
|
---|
361 | mInitialized(false)
|
---|
362 | {}
|
---|
363 |
|
---|
364 | VBoxVHWAInfo(const VBoxGLInfo & glInfo) :
|
---|
365 | mglInfo(glInfo),
|
---|
366 | mFourccSupportedCount(0),
|
---|
367 | mInitialized(false)
|
---|
368 | {}
|
---|
369 |
|
---|
370 | void init(const MY_QOpenGLContext *pContext);
|
---|
371 |
|
---|
372 | bool isInitialized() const { return mInitialized; }
|
---|
373 |
|
---|
374 | const VBoxGLInfo & getGlInfo() const { return mglInfo; }
|
---|
375 |
|
---|
376 | bool isVHWASupported() const;
|
---|
377 |
|
---|
378 | int getFourccSupportedCount() const { return mFourccSupportedCount; }
|
---|
379 | const uint32_t * getFourccSupportedList() const { return mFourccSupportedList; }
|
---|
380 |
|
---|
381 | static bool checkVHWASupport();
|
---|
382 | private:
|
---|
383 | VBoxGLInfo mglInfo;
|
---|
384 | uint32_t mFourccSupportedList[VBOXVHWA_NUMFOURCC];
|
---|
385 | int mFourccSupportedCount;
|
---|
386 |
|
---|
387 | bool mInitialized;
|
---|
388 | };
|
---|
389 |
|
---|
390 | #endif /* !VBOX_INCLUDED_VBoxGL2D_h */
|
---|