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