1 | /* $Id: DevVGA-SVGA3d-internal.h 86905 2020-11-17 23:36:12Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DevVMWare - VMWare SVGA device - 3D part, internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-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_internal_h
|
---|
19 | #define VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_internal_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /*
|
---|
25 | * Assert sane compilation environment.
|
---|
26 | */
|
---|
27 | #ifndef IN_RING3
|
---|
28 | # error "VMSVGA3D_INCL_INTERNALS is only for ring-3 code"
|
---|
29 | #endif
|
---|
30 | #ifdef VMSVGA3D_OPENGL
|
---|
31 | # if defined(VMSVGA3D_DIRECT3D) || defined(VMSVGA3D_DX)
|
---|
32 | # error "Both VMSVGA3D_DIRECT3D and VMSVGA3D_OPENGL cannot be defined at the same time."
|
---|
33 | # endif
|
---|
34 | #elif !defined(VMSVGA3D_DIRECT3D) && !defined(VMSVGA3D_DX)
|
---|
35 | # error "Either VMSVGA3D_OPENGL or VMSVGA3D_DIRECT3D must be defined."
|
---|
36 | #endif
|
---|
37 |
|
---|
38 |
|
---|
39 | /*********************************************************************************************************************************
|
---|
40 | * Header Files *
|
---|
41 | *********************************************************************************************************************************/
|
---|
42 | #include "DevVGA-SVGA3d.h"
|
---|
43 |
|
---|
44 | #if defined(VMSVGA3D_DYNAMIC_LOAD) && defined(VMSVGA3D_OPENGL)
|
---|
45 | # include "DevVGA-SVGA3d-glLdr.h"
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | #ifdef RT_OS_WINDOWS
|
---|
49 | # include <iprt/win/windows.h>
|
---|
50 | # ifdef VMSVGA3D_DIRECT3D
|
---|
51 | # include <d3d9.h>
|
---|
52 | # include <iprt/avl.h>
|
---|
53 | # elif defined(VMSVGA3D_DX)
|
---|
54 | # include <d3d11.h>
|
---|
55 | # else
|
---|
56 | # include <GL/gl.h>
|
---|
57 | # include "vmsvga_glext/wglext.h"
|
---|
58 | # endif
|
---|
59 |
|
---|
60 | #elif defined(RT_OS_DARWIN)
|
---|
61 | # include <OpenGL/OpenGL.h>
|
---|
62 | # include <OpenGL/gl3.h>
|
---|
63 | # include <OpenGL/gl3ext.h>
|
---|
64 | # define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
|
---|
65 | # include <OpenGL/gl.h>
|
---|
66 | # include <OpenGL/glext.h>
|
---|
67 | # include "DevVGA-SVGA3d-cocoa.h"
|
---|
68 | /* work around conflicting definition of GLhandleARB in VMware's glext.h */
|
---|
69 | //#define GL_ARB_shader_objects
|
---|
70 | // HACK
|
---|
71 | typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
|
---|
72 | typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
|
---|
73 | typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
---|
74 | # define GL_RGBA_S3TC 0x83A2
|
---|
75 | # define GL_ALPHA8_EXT 0x803c
|
---|
76 | # define GL_LUMINANCE8_EXT 0x8040
|
---|
77 | # define GL_LUMINANCE16_EXT 0x8042
|
---|
78 | # define GL_LUMINANCE4_ALPHA4_EXT 0x8043
|
---|
79 | # define GL_LUMINANCE8_ALPHA8_EXT 0x8045
|
---|
80 | # define GL_INT_2_10_10_10_REV 0x8D9F
|
---|
81 |
|
---|
82 | #else
|
---|
83 | # include <X11/Xlib.h>
|
---|
84 | # include <X11/Xatom.h>
|
---|
85 | # include <GL/gl.h>
|
---|
86 | # include <GL/glx.h>
|
---|
87 | # include <GL/glext.h>
|
---|
88 | # define VBOX_VMSVGA3D_GL_HACK_LEVEL 0x103
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #ifdef VMSVGA3D_OPENGL
|
---|
92 | # include "vmsvga_glext/glext.h"
|
---|
93 | # include "shaderlib/shaderlib.h"
|
---|
94 | #endif
|
---|
95 |
|
---|
96 |
|
---|
97 | /*********************************************************************************************************************************
|
---|
98 | * Defined Constants And Macros *
|
---|
99 | *********************************************************************************************************************************/
|
---|
100 | #ifdef VMSVGA3D_OPENGL
|
---|
101 | /** OpenGL: Create a dedicated context for handling surfaces in, thus
|
---|
102 | * avoiding orphaned surfaces after context destruction.
|
---|
103 | *
|
---|
104 | * This cures, for instance, an assertion on fedora 21 that happens in
|
---|
105 | * vmsvga3dSurfaceStretchBlt if the login screen and the desktop has different
|
---|
106 | * sizes. The context of the login screen seems to have just been destroyed
|
---|
107 | * earlier and I believe the driver/X/whoever is attemting to strech the old
|
---|
108 | * screen content onto the new sized screen.
|
---|
109 | *
|
---|
110 | * @remarks This probably comes at a slight preformance expense, as we currently
|
---|
111 | * switches context when setting up the surface the first time. Not sure
|
---|
112 | * if we really need to, but as this is an experiment, I'm playing it safe.
|
---|
113 | * @remarks The define has been made default, thus should no longer be used.
|
---|
114 | */
|
---|
115 | # define VMSVGA3D_OGL_WITH_SHARED_CTX
|
---|
116 | /** Fake surface ID for the shared context. */
|
---|
117 | # define VMSVGA3D_SHARED_CTX_ID UINT32_C(0xffffeeee)
|
---|
118 |
|
---|
119 | /** @def VBOX_VMSVGA3D_GL_HACK_LEVEL
|
---|
120 | * Turns out that on Linux gl.h may often define the first 2-4 OpenGL versions
|
---|
121 | * worth of extensions, but missing out on a function pointer of fifteen. This
|
---|
122 | * causes headache for us when we use the function pointers below. This hack
|
---|
123 | * changes the code to call the known problematic functions directly.
|
---|
124 | * The value is ((x)<<16 | (y)) where x and y are taken from the GL_VERSION_x_y.
|
---|
125 | */
|
---|
126 | # ifndef VBOX_VMSVGA3D_GL_HACK_LEVEL
|
---|
127 | # define VBOX_VMSVGA3D_GL_HACK_LEVEL 0
|
---|
128 | # endif
|
---|
129 |
|
---|
130 | /** Invalid OpenGL ID. */
|
---|
131 | # define OPENGL_INVALID_ID 0
|
---|
132 |
|
---|
133 | # define VMSVGA3D_CLEAR_CURRENT_CONTEXT(pState) \
|
---|
134 | do { (pState)->idActiveContext = OPENGL_INVALID_ID; } while (0)
|
---|
135 |
|
---|
136 | /** @def VMSVGA3D_SET_CURRENT_CONTEXT
|
---|
137 | * Makes sure the @a pContext is the active OpenGL context.
|
---|
138 | * @parm pState The VMSVGA3d state.
|
---|
139 | * @parm pContext The new context.
|
---|
140 | */
|
---|
141 | # ifdef RT_OS_WINDOWS
|
---|
142 | # define VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext) \
|
---|
143 | do { \
|
---|
144 | if ((pState)->idActiveContext != (pContext)->id) \
|
---|
145 | { \
|
---|
146 | BOOL fMakeCurrentRc = wglMakeCurrent((pContext)->hdc, (pContext)->hglrc); \
|
---|
147 | Assert(fMakeCurrentRc == TRUE); RT_NOREF_PV(fMakeCurrentRc); \
|
---|
148 | LogFlowFunc(("Changing context: %#x -> %#x\n", (pState)->idActiveContext, (pContext)->id)); \
|
---|
149 | (pState)->idActiveContext = (pContext)->id; \
|
---|
150 | } \
|
---|
151 | } while (0)
|
---|
152 |
|
---|
153 | # elif defined(RT_OS_DARWIN)
|
---|
154 | # define VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext) \
|
---|
155 | do { \
|
---|
156 | if ((pState)->idActiveContext != (pContext)->id) \
|
---|
157 | { \
|
---|
158 | vmsvga3dCocoaViewMakeCurrentContext((pContext)->cocoaView, (pContext)->cocoaContext); \
|
---|
159 | LogFlowFunc(("Changing context: %#x -> %#x\n", (pState)->idActiveContext, (pContext)->id)); \
|
---|
160 | (pState)->idActiveContext = (pContext)->id; \
|
---|
161 | } \
|
---|
162 | } while (0)
|
---|
163 | # else
|
---|
164 | # define VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext) \
|
---|
165 | do { \
|
---|
166 | if ((pState)->idActiveContext != (pContext)->id) \
|
---|
167 | { \
|
---|
168 | Bool fMakeCurrentRc = glXMakeCurrent((pState)->display, \
|
---|
169 | (pContext)->window, \
|
---|
170 | (pContext)->glxContext); \
|
---|
171 | Assert(fMakeCurrentRc == True); RT_NOREF_PV(fMakeCurrentRc); \
|
---|
172 | LogFlowFunc(("Changing context: %#x -> %#x\n", (pState)->idActiveContext, (pContext)->id)); \
|
---|
173 | (pState)->idActiveContext = (pContext)->id; \
|
---|
174 | } \
|
---|
175 | } while (0)
|
---|
176 | # endif
|
---|
177 |
|
---|
178 | /** @def VMSVGA3D_CLEAR_GL_ERRORS
|
---|
179 | * Clears all pending OpenGL errors.
|
---|
180 | *
|
---|
181 | * If I understood this correctly, OpenGL maintains a bitmask internally and
|
---|
182 | * glGetError gets the next bit (clearing it) from the bitmap and translates it
|
---|
183 | * into a GL_XXX constant value which it then returns. A single OpenGL call can
|
---|
184 | * set more than one bit, and they stick around across calls, from what I
|
---|
185 | * understand.
|
---|
186 | *
|
---|
187 | * So in order to be able to use glGetError to check whether a function
|
---|
188 | * succeeded, we need to call glGetError until all error bits have been cleared.
|
---|
189 | * This macro does that (in all types of builds).
|
---|
190 | *
|
---|
191 | * @sa VMSVGA3D_GET_GL_ERROR, VMSVGA3D_GL_IS_SUCCESS
|
---|
192 | */
|
---|
193 | # define VMSVGA3D_CLEAR_GL_ERRORS() \
|
---|
194 | do { \
|
---|
195 | if (RT_UNLIKELY(glGetError() != GL_NO_ERROR)) /* predict no errors pending */ \
|
---|
196 | { \
|
---|
197 | uint32_t iErrorClearingLoopsLeft = 64; \
|
---|
198 | while (glGetError() != GL_NO_ERROR && iErrorClearingLoopsLeft > 0) \
|
---|
199 | iErrorClearingLoopsLeft--; \
|
---|
200 | } \
|
---|
201 | } while (0)
|
---|
202 |
|
---|
203 | /** @def VMSVGA3D_GET_LAST_GL_ERROR
|
---|
204 | * Gets the last OpenGL error, stores it in a_pContext->lastError and returns
|
---|
205 | * it.
|
---|
206 | *
|
---|
207 | * @returns Same as glGetError.
|
---|
208 | * @param a_pContext The context to store the error in.
|
---|
209 | *
|
---|
210 | * @sa VMSVGA3D_GL_IS_SUCCESS, VMSVGA3D_GL_COMPLAIN
|
---|
211 | */
|
---|
212 | # define VMSVGA3D_GET_GL_ERROR(a_pContext) ((a_pContext)->lastError = glGetError())
|
---|
213 |
|
---|
214 | /** @def VMSVGA3D_GL_SUCCESS
|
---|
215 | * Checks whether VMSVGA3D_GET_LAST_GL_ERROR() return GL_NO_ERROR.
|
---|
216 | *
|
---|
217 | * Will call glGetError() and store the result in a_pContext->lastError.
|
---|
218 | * Will predict GL_NO_ERROR outcome.
|
---|
219 | *
|
---|
220 | * @returns True on success, false on error.
|
---|
221 | * @parm a_pContext The context to store the error in.
|
---|
222 | *
|
---|
223 | * @sa VMSVGA3D_GET_GL_ERROR, VMSVGA3D_GL_COMPLAIN
|
---|
224 | */
|
---|
225 | # define VMSVGA3D_GL_IS_SUCCESS(a_pContext) RT_LIKELY((((a_pContext)->lastError = glGetError()) == GL_NO_ERROR))
|
---|
226 |
|
---|
227 | /** @def VMSVGA3D_GL_COMPLAIN
|
---|
228 | * Complains about one or more OpenGL errors (first in a_pContext->lastError).
|
---|
229 | *
|
---|
230 | * Strict builds will trigger an assertion, while other builds will put the
|
---|
231 | * first few occurences in the release log.
|
---|
232 | *
|
---|
233 | * All GL errors will be cleared after invocation. Assumes lastError
|
---|
234 | * is an error, will not check for GL_NO_ERROR.
|
---|
235 | *
|
---|
236 | * @param a_pState The 3D state structure.
|
---|
237 | * @param a_pContext The context that holds the first error.
|
---|
238 | * @param a_LogRelDetails Argument list for LogRel or similar that describes
|
---|
239 | * the operation in greater detail.
|
---|
240 | *
|
---|
241 | * @sa VMSVGA3D_GET_GL_ERROR, VMSVGA3D_GL_IS_SUCCESS
|
---|
242 | */
|
---|
243 | # ifdef VBOX_STRICT
|
---|
244 | # define VMSVGA3D_GL_COMPLAIN(a_pState, a_pContext, a_LogRelDetails) \
|
---|
245 | do { \
|
---|
246 | AssertMsg((a_pState)->idActiveContext == (a_pContext)->id, \
|
---|
247 | ("idActiveContext=%#x id=%x\n", (a_pState)->idActiveContext, (a_pContext)->id)); \
|
---|
248 | RTAssertMsg2Weak a_LogRelDetails; \
|
---|
249 | GLenum iNextError; \
|
---|
250 | while ((iNextError = glGetError()) != GL_NO_ERROR) \
|
---|
251 | RTAssertMsg2Weak("next error: %#x\n", iNextError); \
|
---|
252 | AssertMsgFailed(("first error: %#x (idActiveContext=%#x)\n", (a_pContext)->lastError, (a_pContext)->id)); \
|
---|
253 | } while (0)
|
---|
254 | # else
|
---|
255 | # define VMSVGA3D_GL_COMPLAIN(a_pState, a_pContext, a_LogRelDetails) \
|
---|
256 | do { \
|
---|
257 | LogRelMax(32, ("VMSVGA3d: OpenGL error %#x (idActiveContext=%#x) on line %u ", (a_pContext)->lastError, (a_pContext)->id, __LINE__)); \
|
---|
258 | GLenum iNextError; \
|
---|
259 | while ((iNextError = glGetError()) != GL_NO_ERROR) \
|
---|
260 | LogRelMax(32, (" - also error %#x ", iNextError)); \
|
---|
261 | LogRelMax(32, a_LogRelDetails); \
|
---|
262 | } while (0)
|
---|
263 | # endif
|
---|
264 |
|
---|
265 | /** @def VMSVGA3D_GL_GET_AND_COMPLAIN
|
---|
266 | * Combination of VMSVGA3D_GET_GL_ERROR and VMSVGA3D_GL_COMPLAIN, assuming that
|
---|
267 | * there is a pending error.
|
---|
268 | *
|
---|
269 | * @param a_pState The 3D state structure.
|
---|
270 | * @param a_pContext The context that holds the first error.
|
---|
271 | * @param a_LogRelDetails Argument list for LogRel or similar that describes
|
---|
272 | * the operation in greater detail.
|
---|
273 | *
|
---|
274 | * @sa VMSVGA3D_GET_GL_ERROR, VMSVGA3D_GL_IS_SUCCESS, VMSVGA3D_GL_COMPLAIN
|
---|
275 | */
|
---|
276 | # define VMSVGA3D_GL_GET_AND_COMPLAIN(a_pState, a_pContext, a_LogRelDetails) \
|
---|
277 | do { \
|
---|
278 | VMSVGA3D_GET_GL_ERROR(a_pContext); \
|
---|
279 | VMSVGA3D_GL_COMPLAIN(a_pState, a_pContext, a_LogRelDetails); \
|
---|
280 | } while (0)
|
---|
281 |
|
---|
282 | /** @def VMSVGA3D_GL_ASSERT_SUCCESS
|
---|
283 | * Asserts that VMSVGA3D_GL_IS_SUCCESS is true, complains if not.
|
---|
284 | *
|
---|
285 | * Uses VMSVGA3D_GL_COMPLAIN for complaining, so check it out wrt to release
|
---|
286 | * logging in non-strict builds.
|
---|
287 | *
|
---|
288 | * @param a_pState The 3D state structure.
|
---|
289 | * @param a_pContext The context that holds the first error.
|
---|
290 | * @param a_LogRelDetails Argument list for LogRel or similar that describes
|
---|
291 | * the operation in greater detail.
|
---|
292 | *
|
---|
293 | * @sa VMSVGA3D_GET_GL_ERROR, VMSVGA3D_GL_IS_SUCCESS, VMSVGA3D_GL_COMPLAIN
|
---|
294 | */
|
---|
295 | # define VMSVGA3D_GL_ASSERT_SUCCESS(a_pState, a_pContext, a_LogRelDetails) \
|
---|
296 | if (VMSVGA3D_GL_IS_SUCCESS(a_pContext)) \
|
---|
297 | { /* likely */ } \
|
---|
298 | else do { \
|
---|
299 | VMSVGA3D_GL_COMPLAIN(a_pState, a_pContext, a_LogRelDetails); \
|
---|
300 | } while (0)
|
---|
301 |
|
---|
302 | /** @def VMSVGA3D_ASSERT_GL_CALL_EX
|
---|
303 | * Executes the specified OpenGL API call and asserts that it succeeded, variant
|
---|
304 | * with extra logging flexibility.
|
---|
305 | *
|
---|
306 | * ASSUMES no GL errors pending prior to invocation - caller should use
|
---|
307 | * VMSVGA3D_CLEAR_GL_ERRORS if uncertain.
|
---|
308 | *
|
---|
309 | * Uses VMSVGA3D_GL_COMPLAIN for complaining, so check it out wrt to release
|
---|
310 | * logging in non-strict builds.
|
---|
311 | *
|
---|
312 | * @param a_GlCall Expression making an OpenGL call.
|
---|
313 | * @param a_pState The 3D state structure.
|
---|
314 | * @param a_pContext The context that holds the first error.
|
---|
315 | * @param a_LogRelDetails Argument list for LogRel or similar that describes
|
---|
316 | * the operation in greater detail.
|
---|
317 | *
|
---|
318 | * @sa VMSVGA3D_ASSERT_GL_CALL, VMSVGA3D_GL_ASSERT_SUCCESS,
|
---|
319 | * VMSVGA3D_GET_GL_ERROR, VMSVGA3D_GL_IS_SUCCESS, VMSVGA3D_GL_COMPLAIN
|
---|
320 | */
|
---|
321 | # define VMSVGA3D_ASSERT_GL_CALL_EX(a_GlCall, a_pState, a_pContext, a_LogRelDetails) \
|
---|
322 | do { \
|
---|
323 | (a_GlCall); \
|
---|
324 | VMSVGA3D_GL_ASSERT_SUCCESS(a_pState, a_pContext, a_LogRelDetails); \
|
---|
325 | } while (0)
|
---|
326 |
|
---|
327 | /** @def VMSVGA3D_ASSERT_GL_CALL
|
---|
328 | * Executes the specified OpenGL API call and asserts that it succeeded.
|
---|
329 | *
|
---|
330 | * ASSUMES no GL errors pending prior to invocation - caller should use
|
---|
331 | * VMSVGA3D_CLEAR_GL_ERRORS if uncertain.
|
---|
332 | *
|
---|
333 | * Uses VMSVGA3D_GL_COMPLAIN for complaining, so check it out wrt to release
|
---|
334 | * logging in non-strict builds.
|
---|
335 | *
|
---|
336 | * @param a_GlCall Expression making an OpenGL call.
|
---|
337 | * @param a_pState The 3D state structure.
|
---|
338 | * @param a_pContext The context that holds the first error.
|
---|
339 | *
|
---|
340 | * @sa VMSVGA3D_ASSERT_GL_CALL_EX, VMSVGA3D_GL_ASSERT_SUCCESS,
|
---|
341 | * VMSVGA3D_GET_GL_ERROR, VMSVGA3D_GL_IS_SUCCESS, VMSVGA3D_GL_COMPLAIN
|
---|
342 | */
|
---|
343 | # define VMSVGA3D_ASSERT_GL_CALL(a_GlCall, a_pState, a_pContext) \
|
---|
344 | VMSVGA3D_ASSERT_GL_CALL_EX(a_GlCall, a_pState, a_pContext, ("%s\n", #a_GlCall))
|
---|
345 |
|
---|
346 |
|
---|
347 | /** @def VMSVGA3D_CHECK_LAST_ERROR
|
---|
348 | * Checks that the last OpenGL error code indicates success.
|
---|
349 | *
|
---|
350 | * Will assert and return VERR_INTERNAL_ERROR in strict builds, in other
|
---|
351 | * builds it will do nothing and is a NOOP.
|
---|
352 | *
|
---|
353 | * @parm pState The VMSVGA3d state.
|
---|
354 | * @parm pContext The context.
|
---|
355 | *
|
---|
356 | * @todo Replace with proper error handling, it's crazy to return
|
---|
357 | * VERR_INTERNAL_ERROR in strict builds and just barge on ahead in
|
---|
358 | * release builds.
|
---|
359 | */
|
---|
360 | /** @todo Rename to VMSVGA3D_CHECK_LAST_ERROR_RETURN */
|
---|
361 | # ifdef VBOX_STRICT
|
---|
362 | # define VMSVGA3D_CHECK_LAST_ERROR(pState, pContext) do { \
|
---|
363 | Assert((pState)->idActiveContext == (pContext)->id); \
|
---|
364 | (pContext)->lastError = glGetError(); \
|
---|
365 | AssertMsgReturn((pContext)->lastError == GL_NO_ERROR, \
|
---|
366 | ("%s (%d): last error 0x%x\n", __FUNCTION__, __LINE__, (pContext)->lastError), \
|
---|
367 | VERR_INTERNAL_ERROR); \
|
---|
368 | } while (0)
|
---|
369 | # else
|
---|
370 | # define VMSVGA3D_CHECK_LAST_ERROR(pState, pContext) do { } while (0)
|
---|
371 | # endif
|
---|
372 |
|
---|
373 | /** @def VMSVGA3D_CHECK_LAST_ERROR_WARN
|
---|
374 | * Checks that the last OpenGL error code indicates success.
|
---|
375 | *
|
---|
376 | * Will assert in strict builds, otherwise it's a NOOP.
|
---|
377 | *
|
---|
378 | * @parm pState The VMSVGA3d state.
|
---|
379 | * @parm pContext The new context.
|
---|
380 | */
|
---|
381 | # ifdef VBOX_STRICT
|
---|
382 | # define VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext) do { \
|
---|
383 | Assert((pState)->idActiveContext == (pContext)->id); \
|
---|
384 | (pContext)->lastError = glGetError(); \
|
---|
385 | AssertMsg((pContext)->lastError == GL_NO_ERROR, ("%s (%d): last error 0x%x\n", __FUNCTION__, __LINE__, (pContext)->lastError)); \
|
---|
386 | } while (0)
|
---|
387 | # else
|
---|
388 | # define VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext) do { } while (0)
|
---|
389 | # endif
|
---|
390 |
|
---|
391 | #endif /* VMSVGA3D_OPENGL */
|
---|
392 |
|
---|
393 | #ifdef VMSVGA3D_DIRECT3D
|
---|
394 | /* Enable to use Wine to convert D3D to opengl */
|
---|
395 | //#define VBOX_VMSVGA3D_WITH_WINE_OPENGL
|
---|
396 | #endif
|
---|
397 |
|
---|
398 |
|
---|
399 | /*********************************************************************************************************************************
|
---|
400 | * Structures and Typedefs *
|
---|
401 | *********************************************************************************************************************************/
|
---|
402 | /**
|
---|
403 | * Mipmap level.
|
---|
404 | */
|
---|
405 | typedef struct VMSVGA3DMIPMAPLEVEL
|
---|
406 | {
|
---|
407 | /** The mipmap size: width, height and depth. */
|
---|
408 | SVGA3dSize mipmapSize;
|
---|
409 | /** Width in blocks: (width + cxBlock - 1) / cxBlock. SSM: not saved, recalculated on load. */
|
---|
410 | uint32_t cBlocksX;
|
---|
411 | /** Height in blocks: (height + cyBlock - 1) / cyBlock. SSM: not saved, recalculated on load. */
|
---|
412 | uint32_t cBlocksY;
|
---|
413 | /** Number of blocks: cBlocksX * cBlocksY * mipmapSize.depth. SSM: not saved, recalculated on load. */
|
---|
414 | uint32_t cBlocks;
|
---|
415 | /** The scanline/pitch size in bytes: at least cBlocksX * cbBlock. */
|
---|
416 | uint32_t cbSurfacePitch;
|
---|
417 | /** The size (in bytes) of the mipmap plane: cbSurfacePitch * cBlocksY */
|
---|
418 | uint32_t cbSurfacePlane;
|
---|
419 | /** The size (in bytes) of the mipmap data when using the format the surface was
|
---|
420 | * defined with: cbSurfacePlane * mipmapSize.z */
|
---|
421 | uint32_t cbSurface;
|
---|
422 | /** Pointer to the mipmap bytes (cbSurface). Often NULL. If the surface has
|
---|
423 | * been realized in hardware, this may be outdated. */
|
---|
424 | void *pSurfaceData;
|
---|
425 | /** Set if pvSurfaceData contains data not realized in hardware or pushed to the
|
---|
426 | * hardware surface yet. */
|
---|
427 | bool fDirty;
|
---|
428 | } VMSVGA3DMIPMAPLEVEL;
|
---|
429 | /** Pointer to a mipmap level. */
|
---|
430 | typedef VMSVGA3DMIPMAPLEVEL *PVMSVGA3DMIPMAPLEVEL;
|
---|
431 |
|
---|
432 |
|
---|
433 | #ifdef VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
|
---|
434 | /**
|
---|
435 | * SSM descriptor table for the VMSVGA3DMIPMAPLEVEL structure.
|
---|
436 | */
|
---|
437 | static SSMFIELD const g_aVMSVGA3DMIPMAPLEVELFields[] =
|
---|
438 | {
|
---|
439 | SSMFIELD_ENTRY( VMSVGA3DMIPMAPLEVEL, mipmapSize),
|
---|
440 | SSMFIELD_ENTRY( VMSVGA3DMIPMAPLEVEL, cbSurface),
|
---|
441 | SSMFIELD_ENTRY( VMSVGA3DMIPMAPLEVEL, cbSurfacePitch),
|
---|
442 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DMIPMAPLEVEL, pSurfaceData),
|
---|
443 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DMIPMAPLEVEL, fDirty),
|
---|
444 | SSMFIELD_ENTRY_TERM()
|
---|
445 | };
|
---|
446 | #endif
|
---|
447 |
|
---|
448 | typedef struct VMSVGATRANSFORMSTATE
|
---|
449 | {
|
---|
450 | bool fValid;
|
---|
451 | float matrix[16];
|
---|
452 | } VMSVGATRANSFORMSTATE;
|
---|
453 | typedef VMSVGATRANSFORMSTATE *PVMSVGATRANSFORMSTATE;
|
---|
454 |
|
---|
455 | typedef struct VMSVGAMATERIALSTATE
|
---|
456 | {
|
---|
457 | bool fValid;
|
---|
458 | SVGA3dMaterial material;
|
---|
459 | } VMSVGAMATERIALSTATE;
|
---|
460 | typedef VMSVGAMATERIALSTATE *PVMSVGAMATERIALSTATE;
|
---|
461 |
|
---|
462 | typedef struct VMSVGACLIPPLANESTATE
|
---|
463 | {
|
---|
464 | bool fValid;
|
---|
465 | float plane[4];
|
---|
466 | } VMSVGACLIPPLANESTATE;
|
---|
467 | typedef VMSVGACLIPPLANESTATE *PVMSVGACLIPPLANESTATE;
|
---|
468 |
|
---|
469 | typedef struct VMSVGALIGHTSTATE
|
---|
470 | {
|
---|
471 | bool fEnabled;
|
---|
472 | bool fValidData;
|
---|
473 | SVGA3dLightData data;
|
---|
474 | } VMSVGALIGHTSTATE;
|
---|
475 | typedef VMSVGALIGHTSTATE *PVMSVGALIGHTSTATE;
|
---|
476 |
|
---|
477 | typedef struct VMSVGASHADERCONST
|
---|
478 | {
|
---|
479 | bool fValid;
|
---|
480 | SVGA3dShaderConstType ctype;
|
---|
481 | uint32_t value[4];
|
---|
482 | } VMSVGASHADERCONST;
|
---|
483 | typedef VMSVGASHADERCONST *PVMSVGASHADERCONST;
|
---|
484 |
|
---|
485 | #ifdef VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
|
---|
486 | /**
|
---|
487 | * SSM descriptor table for the VMSVGASHADERCONST structure.
|
---|
488 | */
|
---|
489 | static SSMFIELD const g_aVMSVGASHADERCONSTFields[] =
|
---|
490 | {
|
---|
491 | SSMFIELD_ENTRY( VMSVGASHADERCONST, fValid),
|
---|
492 | SSMFIELD_ENTRY( VMSVGASHADERCONST, ctype),
|
---|
493 | SSMFIELD_ENTRY( VMSVGASHADERCONST, value),
|
---|
494 | SSMFIELD_ENTRY_TERM()
|
---|
495 | };
|
---|
496 | #endif
|
---|
497 |
|
---|
498 | #ifdef VMSVGA3D_DIRECT3D
|
---|
499 |
|
---|
500 | /* What kind of Direct3D resource has been created for the VMSVGA3D surface. */
|
---|
501 | typedef enum VMSVGA3DD3DRESTYPE
|
---|
502 | {
|
---|
503 | VMSVGA3D_D3DRESTYPE_NONE = 0,
|
---|
504 | VMSVGA3D_D3DRESTYPE_SURFACE = 1,
|
---|
505 | VMSVGA3D_D3DRESTYPE_TEXTURE = 2,
|
---|
506 | VMSVGA3D_D3DRESTYPE_CUBE_TEXTURE = 3,
|
---|
507 | VMSVGA3D_D3DRESTYPE_VOLUME_TEXTURE = 4,
|
---|
508 | VMSVGA3D_D3DRESTYPE_VERTEX_BUFFER = 5,
|
---|
509 | VMSVGA3D_D3DRESTYPE_INDEX_BUFFER = 6
|
---|
510 | } VMSVGA3DD3DRESTYPE;
|
---|
511 |
|
---|
512 | /**
|
---|
513 | *
|
---|
514 | */
|
---|
515 | typedef struct
|
---|
516 | {
|
---|
517 | /** Key is context id. */
|
---|
518 | AVLU32NODECORE Core;
|
---|
519 | union
|
---|
520 | {
|
---|
521 | IDirect3DTexture9 *pTexture;
|
---|
522 | IDirect3DCubeTexture9 *pCubeTexture;
|
---|
523 | IDirect3DVolumeTexture9 *pVolumeTexture;
|
---|
524 | } u;
|
---|
525 | } VMSVGA3DSHAREDSURFACE;
|
---|
526 | typedef VMSVGA3DSHAREDSURFACE *PVMSVGA3DSHAREDSURFACE;
|
---|
527 | #endif /* VMSVGA3D_DIRECT3D */
|
---|
528 |
|
---|
529 | #ifdef VMSVGA3D_OPENGL
|
---|
530 | /* What kind of OpenGL resource has been created for the VMSVGA3D surface. */
|
---|
531 | typedef enum VMSVGA3DOGLRESTYPE
|
---|
532 | {
|
---|
533 | VMSVGA3D_OGLRESTYPE_NONE = 0,
|
---|
534 | VMSVGA3D_OGLRESTYPE_BUFFER = 1,
|
---|
535 | VMSVGA3D_OGLRESTYPE_TEXTURE = 2,
|
---|
536 | VMSVGA3D_OGLRESTYPE_RENDERBUFFER = 3
|
---|
537 | } VMSVGA3DOGLRESTYPE;
|
---|
538 | #endif
|
---|
539 |
|
---|
540 | /* The 3D backend surface. The actual structure is 3D API specific. */
|
---|
541 | typedef struct VMSVGA3DBACKENDSURFACE *PVMSVGA3DBACKENDSURFACE;
|
---|
542 |
|
---|
543 | /**
|
---|
544 | * VMSVGA3d surface.
|
---|
545 | */
|
---|
546 | typedef struct VMSVGA3DSURFACE
|
---|
547 | {
|
---|
548 | PVMSVGA3DBACKENDSURFACE pBackendSurface;
|
---|
549 |
|
---|
550 | uint32_t id;
|
---|
551 | #ifdef VMSVGA3D_OPENGL
|
---|
552 | uint32_t idWeakContextAssociation;
|
---|
553 | #else
|
---|
554 | uint32_t idAssociatedContext;
|
---|
555 | #endif
|
---|
556 | SVGA3dSurface1Flags surfaceFlags; /* @todo SVGA3dSurfaceAllFlags as an union. */
|
---|
557 | SVGA3dSurfaceFormat format;
|
---|
558 | #ifdef VMSVGA3D_OPENGL
|
---|
559 | GLint internalFormatGL;
|
---|
560 | GLint formatGL;
|
---|
561 | GLint typeGL;
|
---|
562 | VMSVGA3DOGLRESTYPE enmOGLResType; /* Which resource was created for the surface. */
|
---|
563 | union
|
---|
564 | {
|
---|
565 | GLuint texture;
|
---|
566 | GLuint buffer;
|
---|
567 | GLuint renderbuffer;
|
---|
568 | } oglId;
|
---|
569 | GLenum targetGL; /* GL_TEXTURE_* */
|
---|
570 | GLenum bindingGL; /* GL_TEXTURE_BINDING_* */
|
---|
571 | /* Emulated formats */
|
---|
572 | bool fEmulated; /* Whether the texture format is emulated. */
|
---|
573 | GLuint idEmulated; /* GL name of the intermediate texture. */
|
---|
574 | #endif
|
---|
575 | uint32_t cFaces; /* Number of faces: 6 for cubemaps, 1 for everything else. */
|
---|
576 | uint32_t cLevels; /* Number of mipmap levels per face. */
|
---|
577 | PVMSVGA3DMIPMAPLEVEL paMipmapLevels; /* cFaces * cLevels elements. */
|
---|
578 | uint32_t multiSampleCount;
|
---|
579 | SVGA3dTextureFilter autogenFilter;
|
---|
580 | #ifdef VMSVGA3D_DIRECT3D
|
---|
581 | D3DFORMAT formatD3D;
|
---|
582 | DWORD fUsageD3D;
|
---|
583 | D3DMULTISAMPLE_TYPE multiSampleTypeD3D;
|
---|
584 | #endif
|
---|
585 |
|
---|
586 | uint32_t cbBlock; /* block/pixel size in bytes */
|
---|
587 | /* Dimensions of the surface block, usually 1x1 except for compressed formats. */
|
---|
588 | uint32_t cxBlock; /* Block width in pixels. SSM: not saved, recalculated on load. */
|
---|
589 | uint32_t cyBlock; /* Block height in pixels. SSM: not saved, recalculated on load. */
|
---|
590 | #ifdef VMSVGA3D_OPENGL
|
---|
591 | uint32_t cbBlockGL; /* Block size of the OpenGL texture, same as cbBlock for not-emulated formats. */
|
---|
592 | #endif
|
---|
593 |
|
---|
594 | /* Dirty state; surface was manually updated. */
|
---|
595 | bool fDirty;
|
---|
596 |
|
---|
597 | #ifdef VMSVGA3D_DIRECT3D
|
---|
598 | /* Handle for shared objects (currently only textures & render targets). */
|
---|
599 | HANDLE hSharedObject;
|
---|
600 | /** Event query inserted after each GPU operation that updates or uses this surface. */
|
---|
601 | IDirect3DQuery9 *pQuery;
|
---|
602 | /** The context id where the query has been created. */
|
---|
603 | uint32_t idQueryContext;
|
---|
604 | /** The type of actually created D3D resource. */
|
---|
605 | VMSVGA3DD3DRESTYPE enmD3DResType;
|
---|
606 | union
|
---|
607 | {
|
---|
608 | IDirect3DSurface9 *pSurface;
|
---|
609 | IDirect3DTexture9 *pTexture;
|
---|
610 | IDirect3DCubeTexture9 *pCubeTexture;
|
---|
611 | IDirect3DVolumeTexture9 *pVolumeTexture;
|
---|
612 | IDirect3DVertexBuffer9 *pVertexBuffer;
|
---|
613 | IDirect3DIndexBuffer9 *pIndexBuffer;
|
---|
614 | } u;
|
---|
615 | union
|
---|
616 | {
|
---|
617 | IDirect3DTexture9 *pTexture;
|
---|
618 | IDirect3DCubeTexture9 *pCubeTexture;
|
---|
619 | IDirect3DVolumeTexture9 *pVolumeTexture;
|
---|
620 | } bounce;
|
---|
621 | /** AVL tree containing VMSVGA3DSHAREDSURFACE structures. */
|
---|
622 | AVLU32TREE pSharedObjectTree;
|
---|
623 | bool fStencilAsTexture;
|
---|
624 | D3DFORMAT d3dfmtRequested;
|
---|
625 | union
|
---|
626 | {
|
---|
627 | IDirect3DTexture9 *pTexture;
|
---|
628 | IDirect3DCubeTexture9 *pCubeTexture;
|
---|
629 | IDirect3DVolumeTexture9 *pVolumeTexture;
|
---|
630 | } emulated;
|
---|
631 | #endif
|
---|
632 | } VMSVGA3DSURFACE;
|
---|
633 | /** Pointer to a 3d surface. */
|
---|
634 | typedef VMSVGA3DSURFACE *PVMSVGA3DSURFACE;
|
---|
635 |
|
---|
636 | #ifdef VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
|
---|
637 | /**
|
---|
638 | * SSM descriptor table for the VMSVGA3DSURFACE structure.
|
---|
639 | */
|
---|
640 | static SSMFIELD const g_aVMSVGA3DSURFACEFields[] =
|
---|
641 | {
|
---|
642 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, id),
|
---|
643 | # ifdef VMSVGA3D_OPENGL
|
---|
644 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, idWeakContextAssociation),
|
---|
645 | # else
|
---|
646 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, idAssociatedContext),
|
---|
647 | # endif
|
---|
648 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, surfaceFlags),
|
---|
649 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, format),
|
---|
650 | # ifdef VMSVGA3D_OPENGL
|
---|
651 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, internalFormatGL),
|
---|
652 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, formatGL),
|
---|
653 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, typeGL),
|
---|
654 | # endif
|
---|
655 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, cFaces),
|
---|
656 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, cLevels),
|
---|
657 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, multiSampleCount),
|
---|
658 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, autogenFilter),
|
---|
659 | SSMFIELD_ENTRY( VMSVGA3DSURFACE, cbBlock),
|
---|
660 | SSMFIELD_ENTRY_TERM()
|
---|
661 | };
|
---|
662 | #endif
|
---|
663 |
|
---|
664 | /** Mask we frequently apply to VMSVGA3DSURFACE::flags for decing what kind
|
---|
665 | * of surface we're dealing. */
|
---|
666 | #define VMSVGA3D_SURFACE_HINT_SWITCH_MASK \
|
---|
667 | ( SVGA3D_SURFACE_HINT_INDEXBUFFER | SVGA3D_SURFACE_HINT_VERTEXBUFFER \
|
---|
668 | | SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET \
|
---|
669 | | SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_CUBEMAP )
|
---|
670 |
|
---|
671 | /** @def VMSVGA3DSURFACE_HAS_HW_SURFACE
|
---|
672 | * Checks whether the surface has a host hardware/library surface.
|
---|
673 | * @returns true/false
|
---|
674 | * @param a_pSurface The VMSVGA3d surface.
|
---|
675 | */
|
---|
676 | #ifdef VMSVGA3D_DIRECT3D
|
---|
677 | # define VMSVGA3DSURFACE_HAS_HW_SURFACE(a_pSurface) ((a_pSurface)->u.pSurface != NULL)
|
---|
678 | #elif defined(VMSVGA3D_DX)
|
---|
679 | # define VMSVGA3DSURFACE_HAS_HW_SURFACE(a_pSurface) ((a_pSurface)->pBackendSurface != NULL)
|
---|
680 | #else
|
---|
681 | # define VMSVGA3DSURFACE_HAS_HW_SURFACE(a_pSurface) ((a_pSurface)->oglId.texture != OPENGL_INVALID_ID)
|
---|
682 | #endif
|
---|
683 |
|
---|
684 | /** @def VMSVGA3DSURFACE_NEEDS_DATA
|
---|
685 | * Checks whether SurfaceDMA transfers must always update pSurfaceData,
|
---|
686 | * even if the surface has a host hardware resource.
|
---|
687 | * @returns true/false
|
---|
688 | * @param a_pSurface The VMSVGA3d surface.
|
---|
689 | */
|
---|
690 | #ifdef VMSVGA3D_DIRECT3D
|
---|
691 | # define VMSVGA3DSURFACE_NEEDS_DATA(a_pSurface) \
|
---|
692 | ( (a_pSurface)->enmD3DResType == VMSVGA3D_D3DRESTYPE_VERTEX_BUFFER \
|
---|
693 | || (a_pSurface)->enmD3DResType == VMSVGA3D_D3DRESTYPE_INDEX_BUFFER)
|
---|
694 | #elif defined(VMSVGA3D_DX)
|
---|
695 | /** @todo */
|
---|
696 | # define VMSVGA3DSURFACE_NEEDS_DATA(a_pSurface) (false)
|
---|
697 | #else
|
---|
698 | # define VMSVGA3DSURFACE_NEEDS_DATA(a_pSurface) \
|
---|
699 | ((a_pSurface)->enmOGLResType == VMSVGA3D_OGLRESTYPE_BUFFER)
|
---|
700 | #endif
|
---|
701 |
|
---|
702 |
|
---|
703 | typedef struct VMSVGA3DSHADER
|
---|
704 | {
|
---|
705 | uint32_t id;
|
---|
706 | uint32_t cid;
|
---|
707 | SVGA3dShaderType type;
|
---|
708 | uint32_t cbData;
|
---|
709 | void *pShaderProgram;
|
---|
710 | union
|
---|
711 | {
|
---|
712 | #ifdef VMSVGA3D_DIRECT3D
|
---|
713 | IDirect3DVertexShader9 *pVertexShader;
|
---|
714 | IDirect3DPixelShader9 *pPixelShader;
|
---|
715 | #elif defined(VMSVGA3D_DX)
|
---|
716 | /** todo */
|
---|
717 | #else
|
---|
718 | void *pVertexShader;
|
---|
719 | void *pPixelShader;
|
---|
720 | #endif
|
---|
721 | void *pv;
|
---|
722 | } u;
|
---|
723 | } VMSVGA3DSHADER;
|
---|
724 | typedef VMSVGA3DSHADER *PVMSVGA3DSHADER;
|
---|
725 |
|
---|
726 | #ifdef VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
|
---|
727 | /**
|
---|
728 | * SSM descriptor table for the VMSVGA3DSHADER structure.
|
---|
729 | */
|
---|
730 | static SSMFIELD const g_aVMSVGA3DSHADERFields[] =
|
---|
731 | {
|
---|
732 | SSMFIELD_ENTRY( VMSVGA3DSHADER, id),
|
---|
733 | SSMFIELD_ENTRY( VMSVGA3DSHADER, cid),
|
---|
734 | SSMFIELD_ENTRY( VMSVGA3DSHADER, type),
|
---|
735 | SSMFIELD_ENTRY( VMSVGA3DSHADER, cbData),
|
---|
736 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DSHADER, pShaderProgram),
|
---|
737 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DSHADER, u.pv),
|
---|
738 | SSMFIELD_ENTRY_TERM()
|
---|
739 | };
|
---|
740 | #endif
|
---|
741 |
|
---|
742 | /** @name VMSVGA3D_UPDATE_XXX - ...
|
---|
743 | * @{ */
|
---|
744 | #define VMSVGA3D_UPDATE_SCISSORRECT RT_BIT_32(0)
|
---|
745 | #define VMSVGA3D_UPDATE_ZRANGE RT_BIT_32(1)
|
---|
746 | #define VMSVGA3D_UPDATE_VIEWPORT RT_BIT_32(2)
|
---|
747 | #define VMSVGA3D_UPDATE_VERTEXSHADER RT_BIT_32(3)
|
---|
748 | #define VMSVGA3D_UPDATE_PIXELSHADER RT_BIT_32(4)
|
---|
749 | #define VMSVGA3D_UPDATE_TRANSFORM RT_BIT_32(5)
|
---|
750 | #define VMSVGA3D_UPDATE_MATERIAL RT_BIT_32(6)
|
---|
751 | /** @} */
|
---|
752 |
|
---|
753 | /* Query states. Mostly used for saved state. */
|
---|
754 | typedef enum VMSVGA3DQUERYSTATE
|
---|
755 | {
|
---|
756 | VMSVGA3DQUERYSTATE_NULL = 0, /* Not created. */
|
---|
757 | VMSVGA3DQUERYSTATE_SIGNALED = 1, /* Result obtained. The guest may or may not read the result yet. */
|
---|
758 | VMSVGA3DQUERYSTATE_BUILDING = 2, /* In process of collecting data. */
|
---|
759 | VMSVGA3DQUERYSTATE_ISSUED = 3, /* Data collected, but result is not yet obtained. */
|
---|
760 | VMSVGA3DQUERYSTATE_32BIT = 0x7fffffff
|
---|
761 | } VMSVGA3DQUERYSTATE;
|
---|
762 | AssertCompileSize(VMSVGA3DQUERYSTATE, sizeof(uint32_t));
|
---|
763 |
|
---|
764 | typedef struct VMSVGA3DQUERY
|
---|
765 | {
|
---|
766 | #ifdef VMSVGA3D_DIRECT3D
|
---|
767 | IDirect3DQuery9 *pQuery;
|
---|
768 | #elif defined(VMSVGA3D_DX)
|
---|
769 | /** @todo */
|
---|
770 | #else /* VMSVGA3D_OPENGL */
|
---|
771 | GLuint idQuery;
|
---|
772 | #endif
|
---|
773 | VMSVGA3DQUERYSTATE enmQueryState; /* VMSVGA3DQUERYSTATE_*. State is implicitly _NULL if pQuery is NULL. */
|
---|
774 | uint32_t u32QueryResult; /* Generic result. Enough for all VGPU9 queries. */
|
---|
775 | } VMSVGA3DQUERY;
|
---|
776 |
|
---|
777 | #ifdef VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
|
---|
778 | /**
|
---|
779 | * SSM descriptor table for the VMSVGA3DQUERY structure.
|
---|
780 | */
|
---|
781 | static SSMFIELD const g_aVMSVGA3DQUERYFields[] =
|
---|
782 | {
|
---|
783 | #ifdef VMSVGA3D_DIRECT3D
|
---|
784 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DQUERY, pQuery),
|
---|
785 | #elif defined(VMSVGA3D_DX)
|
---|
786 | /** @todo */
|
---|
787 | #else /* VMSVGA3D_OPENGL */
|
---|
788 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DQUERY, idQuery),
|
---|
789 | #endif
|
---|
790 | SSMFIELD_ENTRY( VMSVGA3DQUERY, enmQueryState),
|
---|
791 | SSMFIELD_ENTRY( VMSVGA3DQUERY, u32QueryResult),
|
---|
792 | SSMFIELD_ENTRY_TERM()
|
---|
793 | };
|
---|
794 | #endif
|
---|
795 |
|
---|
796 | #ifdef VMSVGA3D_DIRECT3D
|
---|
797 | #define VMSVGA3DQUERY_EXISTS(p) ((p)->pQuery && (p)->enmQueryState != VMSVGA3DQUERYSTATE_NULL)
|
---|
798 | #elif defined(VMSVGA3D_DX)
|
---|
799 | /** @todo */
|
---|
800 | #define VMSVGA3DQUERY_EXISTS(p) (false)
|
---|
801 | #else
|
---|
802 | #define VMSVGA3DQUERY_EXISTS(p) ((p)->idQuery && (p)->enmQueryState != VMSVGA3DQUERYSTATE_NULL)
|
---|
803 | #endif
|
---|
804 |
|
---|
805 | /**
|
---|
806 | * VMSVGA3d context.
|
---|
807 | */
|
---|
808 | typedef struct VMSVGA3DCONTEXT
|
---|
809 | {
|
---|
810 | uint32_t id;
|
---|
811 | #ifdef RT_OS_WINDOWS
|
---|
812 | # ifdef VMSVGA3D_DIRECT3D
|
---|
813 | # ifdef VBOX_VMSVGA3D_WITH_WINE_OPENGL
|
---|
814 | IDirect3DDevice9 *pDevice;
|
---|
815 | # else
|
---|
816 | IDirect3DDevice9Ex *pDevice;
|
---|
817 | # endif
|
---|
818 | # elif defined(VMSVGA3D_DX)
|
---|
819 | /** @todo */
|
---|
820 | # else
|
---|
821 | /* Device context of the context window. */
|
---|
822 | HDC hdc;
|
---|
823 | /* OpenGL rendering context handle. */
|
---|
824 | HGLRC hglrc;
|
---|
825 | # endif
|
---|
826 | /* Device context window handle. */
|
---|
827 | HWND hwnd;
|
---|
828 | #elif defined(RT_OS_DARWIN)
|
---|
829 | /* OpenGL rendering context */
|
---|
830 | NativeNSOpenGLContextRef cocoaContext;
|
---|
831 | NativeNSViewRef cocoaView;
|
---|
832 | bool fOtherProfile;
|
---|
833 | #else
|
---|
834 | /** XGL rendering context handle */
|
---|
835 | GLXContext glxContext;
|
---|
836 | /** Device context window handle */
|
---|
837 | Window window;
|
---|
838 | #endif
|
---|
839 |
|
---|
840 | #ifdef VMSVGA3D_OPENGL
|
---|
841 | /* Framebuffer object associated with this context. */
|
---|
842 | GLuint idFramebuffer;
|
---|
843 | /* Read and draw framebuffer objects for various operations. */
|
---|
844 | GLuint idReadFramebuffer;
|
---|
845 | GLuint idDrawFramebuffer;
|
---|
846 | /* Last GL error recorded. */
|
---|
847 | GLenum lastError;
|
---|
848 | void *pShaderContext;
|
---|
849 | #endif
|
---|
850 |
|
---|
851 | /* Current selected texture surfaces (if any) */
|
---|
852 | uint32_t aSidActiveTextures[SVGA3D_MAX_SAMPLERS];
|
---|
853 | /* Per context pixel and vertex shaders. */
|
---|
854 | uint32_t cPixelShaders;
|
---|
855 | PVMSVGA3DSHADER paPixelShader;
|
---|
856 | uint32_t cVertexShaders;
|
---|
857 | PVMSVGA3DSHADER paVertexShader;
|
---|
858 | /* Keep track of the internal state to be able to recreate the context properly (save/restore, window resize). */
|
---|
859 | struct
|
---|
860 | {
|
---|
861 | /** VMSVGA3D_UPDATE_XXX */
|
---|
862 | uint32_t u32UpdateFlags;
|
---|
863 |
|
---|
864 | SVGA3dRenderState aRenderState[SVGA3D_RS_MAX];
|
---|
865 | /* aTextureStates contains both TextureStageStates and SamplerStates, therefore [SVGA3D_MAX_SAMPLERS]. */
|
---|
866 | SVGA3dTextureState aTextureStates[SVGA3D_MAX_SAMPLERS][SVGA3D_TS_MAX];
|
---|
867 | VMSVGATRANSFORMSTATE aTransformState[SVGA3D_TRANSFORM_MAX];
|
---|
868 | VMSVGAMATERIALSTATE aMaterial[SVGA3D_FACE_MAX];
|
---|
869 | /* The aClipPlane array has a wrong (greater) size. Keep it for now because the array is a part of the saved state. */
|
---|
870 | /** @todo Replace SVGA3D_CLIPPLANE_5 with SVGA3D_NUM_CLIPPLANES and increase the saved state version. */
|
---|
871 | VMSVGACLIPPLANESTATE aClipPlane[SVGA3D_CLIPPLANE_5];
|
---|
872 | VMSVGALIGHTSTATE aLightData[SVGA3D_MAX_LIGHTS];
|
---|
873 |
|
---|
874 | uint32_t aRenderTargets[SVGA3D_RT_MAX];
|
---|
875 | SVGA3dRect RectScissor;
|
---|
876 | SVGA3dRect RectViewPort;
|
---|
877 | SVGA3dZRange zRange;
|
---|
878 | uint32_t shidPixel;
|
---|
879 | uint32_t shidVertex;
|
---|
880 |
|
---|
881 | uint32_t cPixelShaderConst;
|
---|
882 | PVMSVGASHADERCONST paPixelShaderConst;
|
---|
883 | uint32_t cVertexShaderConst;
|
---|
884 | PVMSVGASHADERCONST paVertexShaderConst;
|
---|
885 | } state;
|
---|
886 |
|
---|
887 | /* Occlusion query. */
|
---|
888 | VMSVGA3DQUERY occlusion;
|
---|
889 |
|
---|
890 | #ifdef VMSVGA3D_DIRECT3D
|
---|
891 | /* State which is currently applied to the D3D device. It is recreated as needed and not saved.
|
---|
892 | * The purpose is to remember the currently applied state and do not re-apply it if it has not changed.
|
---|
893 | * Unnecessary state changes are very bad for performance.
|
---|
894 | */
|
---|
895 | struct
|
---|
896 | {
|
---|
897 | /* Vertex declaration. */
|
---|
898 | IDirect3DVertexDeclaration9 *pVertexDecl;
|
---|
899 | uint32_t cVertexElements;
|
---|
900 | D3DVERTEXELEMENT9 aVertexElements[SVGA3D_MAX_VERTEX_ARRAYS + 1];
|
---|
901 | } d3dState;
|
---|
902 | #endif
|
---|
903 | } VMSVGA3DCONTEXT;
|
---|
904 | /** Pointer to a VMSVGA3d context. */
|
---|
905 | typedef VMSVGA3DCONTEXT *PVMSVGA3DCONTEXT;
|
---|
906 |
|
---|
907 | #ifdef VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
|
---|
908 | /**
|
---|
909 | * SSM descriptor table for the VMSVGA3DCONTEXT structure.
|
---|
910 | */
|
---|
911 | static SSMFIELD const g_aVMSVGA3DCONTEXTFields[] =
|
---|
912 | {
|
---|
913 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, id),
|
---|
914 |
|
---|
915 | # ifdef RT_OS_WINDOWS
|
---|
916 | # ifdef VMSVGA3D_DIRECT3D
|
---|
917 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DCONTEXT, pDevice),
|
---|
918 | # elif defined(VMSVGA3D_DX)
|
---|
919 | /** @todo */
|
---|
920 | # else
|
---|
921 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, hdc),
|
---|
922 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, hglrc),
|
---|
923 | # endif
|
---|
924 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, hwnd),
|
---|
925 | # elif defined(RT_OS_DARWIN)
|
---|
926 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, cocoaContext),
|
---|
927 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, cocoaView),
|
---|
928 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, fOtherProfile),
|
---|
929 | # else
|
---|
930 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, glxContext),
|
---|
931 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, window),
|
---|
932 | # endif
|
---|
933 |
|
---|
934 | #ifdef VMSVGA3D_OPENGL
|
---|
935 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, idFramebuffer),
|
---|
936 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, idReadFramebuffer),
|
---|
937 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, idDrawFramebuffer),
|
---|
938 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, lastError),
|
---|
939 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DCONTEXT, pShaderContext),
|
---|
940 | #endif
|
---|
941 |
|
---|
942 | SSMFIELD_ENTRY_IGNORE( VMSVGA3DCONTEXT, aSidActiveTextures),
|
---|
943 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, cPixelShaders),
|
---|
944 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DCONTEXT, paPixelShader),
|
---|
945 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, cVertexShaders),
|
---|
946 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DCONTEXT, paVertexShader),
|
---|
947 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.u32UpdateFlags),
|
---|
948 |
|
---|
949 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.aRenderState),
|
---|
950 | SSMFIELD_ENTRY_OLD( state.aTextureStates,
|
---|
951 | sizeof(SVGA3dTextureState) * /*SVGA3D_MAX_TEXTURE_STAGE=*/ 8 * /*SVGA3D_TS_MAX=*/ 30),
|
---|
952 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.aTransformState),
|
---|
953 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.aMaterial),
|
---|
954 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.aClipPlane),
|
---|
955 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.aLightData),
|
---|
956 |
|
---|
957 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.aRenderTargets),
|
---|
958 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.RectScissor),
|
---|
959 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.RectViewPort),
|
---|
960 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.zRange),
|
---|
961 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.shidPixel),
|
---|
962 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.shidVertex),
|
---|
963 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.cPixelShaderConst),
|
---|
964 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DCONTEXT, state.paPixelShaderConst),
|
---|
965 | SSMFIELD_ENTRY( VMSVGA3DCONTEXT, state.cVertexShaderConst),
|
---|
966 | SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DCONTEXT, state.paVertexShaderConst),
|
---|
967 | SSMFIELD_ENTRY_TERM()
|
---|
968 | };
|
---|
969 | #endif /* VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS */
|
---|
970 |
|
---|
971 |
|
---|
972 | #ifdef VMSVGA3D_OPENGL
|
---|
973 | typedef struct VMSVGA3DFORMATCONVERTER *PVMSVGA3DFORMATCONVERTER;
|
---|
974 | #endif
|
---|
975 |
|
---|
976 | /* The 3D backend. The actual structure is 3D API specific. */
|
---|
977 | typedef struct VMSVGA3DBACKEND *PVMSVGA3DBACKEND;
|
---|
978 |
|
---|
979 | /**
|
---|
980 | * VMSVGA3d state data.
|
---|
981 | *
|
---|
982 | * Allocated on the heap and pointed to by VMSVGAState::p3dState.
|
---|
983 | */
|
---|
984 | typedef struct VMSVGA3DSTATE
|
---|
985 | {
|
---|
986 | /** The size of papContexts. */
|
---|
987 | uint32_t cContexts;
|
---|
988 | /** The size of papSurfaces. */
|
---|
989 | uint32_t cSurfaces;
|
---|
990 | /** Contexts indexed by ID. Grown as needed. */
|
---|
991 | PVMSVGA3DCONTEXT *papContexts;
|
---|
992 | /** Surfaces indexed by ID. Grown as needed. */
|
---|
993 | PVMSVGA3DSURFACE *papSurfaces;
|
---|
994 |
|
---|
995 | #ifdef RT_OS_WINDOWS
|
---|
996 | # ifdef VMSVGA3D_DIRECT3D
|
---|
997 | # ifdef VBOX_VMSVGA3D_WITH_WINE_OPENGL
|
---|
998 | IDirect3D9 *pD3D9;
|
---|
999 | # else
|
---|
1000 | IDirect3D9Ex *pD3D9;
|
---|
1001 | # endif
|
---|
1002 | D3DCAPS9 caps;
|
---|
1003 | bool fSupportedSurfaceINTZ;
|
---|
1004 | bool fSupportedSurfaceNULL;
|
---|
1005 | bool fSupportedFormatUYVY : 1;
|
---|
1006 | bool fSupportedFormatYUY2 : 1;
|
---|
1007 | bool fSupportedFormatA8B8G8R8 : 1;
|
---|
1008 | # elif defined(VMSVGA3D_DX)
|
---|
1009 | PVMSVGA3DBACKEND pBackend;
|
---|
1010 | # endif
|
---|
1011 | /** Window Thread. */
|
---|
1012 | R3PTRTYPE(RTTHREAD) pWindowThread;
|
---|
1013 | DWORD idWindowThread;
|
---|
1014 | HMODULE hInstance;
|
---|
1015 | /** Window request semaphore. */
|
---|
1016 | RTSEMEVENT WndRequestSem;
|
---|
1017 | #elif defined(RT_OS_DARWIN)
|
---|
1018 | #else
|
---|
1019 | /* The X display */
|
---|
1020 | Display *display;
|
---|
1021 | R3PTRTYPE(RTTHREAD) pWindowThread;
|
---|
1022 | bool bTerminate;
|
---|
1023 | #endif
|
---|
1024 |
|
---|
1025 | #ifdef VMSVGA3D_OPENGL
|
---|
1026 | float rsGLVersion;
|
---|
1027 | /* Current active context. */
|
---|
1028 | uint32_t idActiveContext;
|
---|
1029 |
|
---|
1030 | struct
|
---|
1031 | {
|
---|
1032 | PFNGLISRENDERBUFFERPROC glIsRenderbuffer;
|
---|
1033 | PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
|
---|
1034 | PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers;
|
---|
1035 | PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
---|
1036 | PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
|
---|
1037 | PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv;
|
---|
1038 | PFNGLISFRAMEBUFFERPROC glIsFramebuffer;
|
---|
1039 | PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
---|
1040 | PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
---|
1041 | PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
---|
1042 | PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
|
---|
1043 | PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D;
|
---|
1044 | PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
---|
1045 | PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D;
|
---|
1046 | PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
|
---|
1047 | PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv;
|
---|
1048 | PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
|
---|
1049 | PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
---|
1050 | PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample;
|
---|
1051 | PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer;
|
---|
1052 | PFNGLPOINTPARAMETERFPROC glPointParameterf;
|
---|
1053 | #if VBOX_VMSVGA3D_GL_HACK_LEVEL < 0x102
|
---|
1054 | PFNGLBLENDCOLORPROC glBlendColor;
|
---|
1055 | PFNGLBLENDEQUATIONPROC glBlendEquation;
|
---|
1056 | #endif
|
---|
1057 | PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate;
|
---|
1058 | PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
|
---|
1059 | PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate;
|
---|
1060 | PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate;
|
---|
1061 | PFNGLBINDBUFFERPROC glBindBuffer;
|
---|
1062 | PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
---|
1063 | PFNGLGENBUFFERSPROC glGenBuffers;
|
---|
1064 | PFNGLBUFFERDATAPROC glBufferData;
|
---|
1065 | PFNGLMAPBUFFERPROC glMapBuffer;
|
---|
1066 | PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
---|
1067 | PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
---|
1068 | PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
---|
1069 | PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
---|
1070 | PFNGLFOGCOORDPOINTERPROC glFogCoordPointer;
|
---|
1071 | PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glDrawElementsInstancedBaseVertex;
|
---|
1072 | PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex;
|
---|
1073 | PFNGLACTIVETEXTUREPROC glActiveTexture;
|
---|
1074 | #if VBOX_VMSVGA3D_GL_HACK_LEVEL < 0x103
|
---|
1075 | PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
|
---|
1076 | #endif
|
---|
1077 | PFNGLGETPROGRAMIVARBPROC glGetProgramivARB;
|
---|
1078 | PFNGLPROVOKINGVERTEXPROC glProvokingVertex;
|
---|
1079 | PFNGLGENQUERIESPROC glGenQueries;
|
---|
1080 | PFNGLDELETEQUERIESPROC glDeleteQueries;
|
---|
1081 | PFNGLBEGINQUERYPROC glBeginQuery;
|
---|
1082 | PFNGLENDQUERYPROC glEndQuery;
|
---|
1083 | PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv;
|
---|
1084 | PFNGLTEXIMAGE3DPROC glTexImage3D;
|
---|
1085 | PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D;
|
---|
1086 | PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
|
---|
1087 | PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
|
---|
1088 | PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
|
---|
1089 | PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
|
---|
1090 | PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
|
---|
1091 | PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D;
|
---|
1092 | PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D;
|
---|
1093 | PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D;
|
---|
1094 | PFNGLDRAWBUFFERSPROC glDrawBuffers;
|
---|
1095 | PFNGLCREATESHADERPROC glCreateShader;
|
---|
1096 | PFNGLSHADERSOURCEPROC glShaderSource;
|
---|
1097 | PFNGLCOMPILESHADERPROC glCompileShader;
|
---|
1098 | PFNGLGETSHADERIVPROC glGetShaderiv;
|
---|
1099 | PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
---|
1100 | PFNGLCREATEPROGRAMPROC glCreateProgram;
|
---|
1101 | PFNGLATTACHSHADERPROC glAttachShader;
|
---|
1102 | PFNGLLINKPROGRAMPROC glLinkProgram;
|
---|
1103 | PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
---|
1104 | PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
---|
1105 | PFNGLUSEPROGRAMPROC glUseProgram;
|
---|
1106 | PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
---|
1107 | PFNGLUNIFORM1IPROC glUniform1i;
|
---|
1108 | PFNGLUNIFORM4FVPROC glUniform4fv;
|
---|
1109 | PFNGLDETACHSHADERPROC glDetachShader;
|
---|
1110 | PFNGLDELETESHADERPROC glDeleteShader;
|
---|
1111 | PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
---|
1112 | PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv;
|
---|
1113 | PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv;
|
---|
1114 | PFNGLVERTEXATTRIB4NUBVPROC glVertexAttrib4Nubv;
|
---|
1115 | PFNGLVERTEXATTRIB4SVPROC glVertexAttrib4sv;
|
---|
1116 | PFNGLVERTEXATTRIB4NSVPROC glVertexAttrib4Nsv;
|
---|
1117 | PFNGLVERTEXATTRIB4NUSVPROC glVertexAttrib4Nusv;
|
---|
1118 | } ext;
|
---|
1119 |
|
---|
1120 | struct
|
---|
1121 | {
|
---|
1122 | bool fS3TCSupported : 1;
|
---|
1123 | bool fTextureFilterAnisotropicSupported : 1;
|
---|
1124 | GLint maxActiveLights;
|
---|
1125 | GLint maxTextures;
|
---|
1126 | GLint maxClipDistances;
|
---|
1127 | GLint maxColorAttachments;
|
---|
1128 | GLint maxRectangleTextureSize;
|
---|
1129 | GLint maxTextureAnisotropy;
|
---|
1130 | GLint maxVertexShaderInstructions;
|
---|
1131 | GLint maxFragmentShaderInstructions;
|
---|
1132 | GLint maxVertexShaderTemps;
|
---|
1133 | GLint maxFragmentShaderTemps;
|
---|
1134 | GLfloat flPointSize[2];
|
---|
1135 | SVGA3dPixelShaderVersion fragmentShaderVersion;
|
---|
1136 | SVGA3dVertexShaderVersion vertexShaderVersion;
|
---|
1137 | } caps;
|
---|
1138 |
|
---|
1139 | /** The GL_EXTENSIONS value (space padded) for the default OpenGL profile.
|
---|
1140 | * Free with RTStrFree. */
|
---|
1141 | R3PTRTYPE(char *) pszExtensions;
|
---|
1142 |
|
---|
1143 | /** The GL_EXTENSIONS value (space padded) for the other OpenGL profile.
|
---|
1144 | * Free with RTStrFree.
|
---|
1145 | *
|
---|
1146 | * This is used to detect shader model version since some implementations
|
---|
1147 | * (darwin) hides extensions that have made it into core and probably a
|
---|
1148 | * bunch of others when using a OpenGL core profile instead of a legacy one */
|
---|
1149 | R3PTRTYPE(char *) pszOtherExtensions;
|
---|
1150 | /** The version of the other GL profile. */
|
---|
1151 | float rsOtherGLVersion;
|
---|
1152 |
|
---|
1153 | /** Shader talk back interface. */
|
---|
1154 | VBOXVMSVGASHADERIF ShaderIf;
|
---|
1155 |
|
---|
1156 | # ifdef VMSVGA3D_OPENGL
|
---|
1157 | /** The shared context. */
|
---|
1158 | VMSVGA3DCONTEXT SharedCtx;
|
---|
1159 |
|
---|
1160 | /** Conversion of emulated formats. Resources are created on the SharedCtx. */
|
---|
1161 | PVMSVGA3DFORMATCONVERTER pConv;
|
---|
1162 | # endif
|
---|
1163 | #endif /* VMSVGA3D_OPENGL */
|
---|
1164 | } VMSVGA3DSTATE;
|
---|
1165 |
|
---|
1166 | #ifdef VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
|
---|
1167 | /**
|
---|
1168 | * SSM descriptor table for the VMSVGA3DSTATE structure.
|
---|
1169 | *
|
---|
1170 | * @remarks This isn't a complete structure markup, only fields with state.
|
---|
1171 | */
|
---|
1172 | static SSMFIELD const g_aVMSVGA3DSTATEFields[] =
|
---|
1173 | {
|
---|
1174 | # ifdef VMSVGA3D_OPENGL
|
---|
1175 | SSMFIELD_ENTRY( VMSVGA3DSTATE, rsGLVersion), /** @todo Why are we saving the GL version?? */
|
---|
1176 | # endif
|
---|
1177 | SSMFIELD_ENTRY( VMSVGA3DSTATE, cContexts),
|
---|
1178 | SSMFIELD_ENTRY( VMSVGA3DSTATE, cSurfaces),
|
---|
1179 | SSMFIELD_ENTRY_TERM()
|
---|
1180 | };
|
---|
1181 | #endif /* VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS */
|
---|
1182 |
|
---|
1183 | int vmsvga3dBackDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen);
|
---|
1184 | int vmsvga3dBackDestroyScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen);
|
---|
1185 |
|
---|
1186 | int vmsvga3dBackSurfaceBlitToScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen,
|
---|
1187 | SVGASignedRect destRect, SVGA3dSurfaceImageId srcImage,
|
---|
1188 | SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *paRects);
|
---|
1189 |
|
---|
1190 | #ifdef VMSVGA3D_DIRECT3D
|
---|
1191 | D3DFORMAT vmsvga3dSurfaceFormat2D3D(SVGA3dSurfaceFormat format);
|
---|
1192 | D3DMULTISAMPLE_TYPE vmsvga3dMultipeSampleCount2D3D(uint32_t multisampleCount);
|
---|
1193 | DECLCALLBACK(int) vmsvga3dSharedSurfaceDestroyTree(PAVLU32NODECORE pNode, void *pvParam);
|
---|
1194 | int vmsvga3dSurfaceFlush(PVMSVGA3DSURFACE pSurface);
|
---|
1195 | #endif /* VMSVGA3D_DIRECT3D */
|
---|
1196 |
|
---|
1197 |
|
---|
1198 | #ifdef VMSVGA3D_OPENGL
|
---|
1199 | /** Save and setup everything. */
|
---|
1200 | # define VMSVGA3D_PARANOID_TEXTURE_PACKING
|
---|
1201 |
|
---|
1202 | /** @name VMSVGAPACKPARAMS_* - which packing parameters were set.
|
---|
1203 | * @{ */
|
---|
1204 | # define VMSVGAPACKPARAMS_ALIGNMENT RT_BIT_32(0)
|
---|
1205 | # define VMSVGAPACKPARAMS_ROW_LENGTH RT_BIT_32(1)
|
---|
1206 | # define VMSVGAPACKPARAMS_IMAGE_HEIGHT RT_BIT_32(2)
|
---|
1207 | # define VMSVGAPACKPARAMS_SWAP_BYTES RT_BIT_32(3)
|
---|
1208 | # define VMSVGAPACKPARAMS_LSB_FIRST RT_BIT_32(4)
|
---|
1209 | # define VMSVGAPACKPARAMS_SKIP_ROWS RT_BIT_32(5)
|
---|
1210 | # define VMSVGAPACKPARAMS_SKIP_PIXELS RT_BIT_32(6)
|
---|
1211 | # define VMSVGAPACKPARAMS_SKIP_IMAGES RT_BIT_32(7)
|
---|
1212 | /** @} */
|
---|
1213 |
|
---|
1214 | /**
|
---|
1215 | * Saved texture packing parameters (shared by both pack and unpack).
|
---|
1216 | */
|
---|
1217 | typedef struct VMSVGAPACKPARAMS
|
---|
1218 | {
|
---|
1219 | uint32_t fChanged;
|
---|
1220 | GLint iAlignment;
|
---|
1221 | GLint cxRow;
|
---|
1222 | GLint cyImage;
|
---|
1223 | # ifdef VMSVGA3D_PARANOID_TEXTURE_PACKING
|
---|
1224 | GLboolean fSwapBytes;
|
---|
1225 | GLboolean fLsbFirst;
|
---|
1226 | GLint cSkipRows;
|
---|
1227 | GLint cSkipPixels;
|
---|
1228 | GLint cSkipImages;
|
---|
1229 | # endif
|
---|
1230 | } VMSVGAPACKPARAMS;
|
---|
1231 | /** Pointer to saved texture packing parameters. */
|
---|
1232 | typedef VMSVGAPACKPARAMS *PVMSVGAPACKPARAMS;
|
---|
1233 | /** Pointer to const saved texture packing parameters. */
|
---|
1234 | typedef VMSVGAPACKPARAMS const *PCVMSVGAPACKPARAMS;
|
---|
1235 |
|
---|
1236 | void vmsvga3dOglSetPackParams(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, PVMSVGA3DSURFACE pSurface,
|
---|
1237 | PVMSVGAPACKPARAMS pSave);
|
---|
1238 | void vmsvga3dOglRestorePackParams(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, PVMSVGA3DSURFACE pSurface,
|
---|
1239 | PCVMSVGAPACKPARAMS pSave);
|
---|
1240 | void vmsvga3dOglSetUnpackParams(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, GLint cxRow, GLint cyImage,
|
---|
1241 | PVMSVGAPACKPARAMS pSave);
|
---|
1242 | void vmsvga3dOglRestoreUnpackParams(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext,
|
---|
1243 | PCVMSVGAPACKPARAMS pSave);
|
---|
1244 |
|
---|
1245 | /** @name VMSVGA3D_DEF_CTX_F_XXX - vmsvga3dContextDefineOgl flags.
|
---|
1246 | * @{ */
|
---|
1247 | /** When clear, the context is created using the default OpenGL profile.
|
---|
1248 | * When set, it's created using the alternative profile. The latter is only
|
---|
1249 | * allowed if the VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE is set. */
|
---|
1250 | # define VMSVGA3D_DEF_CTX_F_OTHER_PROFILE RT_BIT_32(0)
|
---|
1251 | /** Defining the shared context. */
|
---|
1252 | # define VMSVGA3D_DEF_CTX_F_SHARED_CTX RT_BIT_32(1)
|
---|
1253 | /** Defining the init time context (EMT). */
|
---|
1254 | # define VMSVGA3D_DEF_CTX_F_INIT RT_BIT_32(2)
|
---|
1255 | /** @} */
|
---|
1256 | int vmsvga3dContextDefineOgl(PVGASTATECC pThisCC, uint32_t cid, uint32_t fFlags);
|
---|
1257 | void vmsvga3dSurfaceFormat2OGL(PVMSVGA3DSURFACE pSurface, SVGA3dSurfaceFormat format);
|
---|
1258 |
|
---|
1259 | #endif /* VMSVGA3D_OPENGL */
|
---|
1260 |
|
---|
1261 |
|
---|
1262 | /* DevVGA-SVGA3d-shared.cpp: */
|
---|
1263 | int vmsvga3dSaveShaderConst(PVMSVGA3DCONTEXT pContext, uint32_t reg, SVGA3dShaderType type, SVGA3dShaderConstType ctype,
|
---|
1264 | uint32_t val1, uint32_t val2, uint32_t val3, uint32_t val4);
|
---|
1265 |
|
---|
1266 |
|
---|
1267 |
|
---|
1268 | /* Command implementation workers. */
|
---|
1269 | void vmsvga3dBackSurfaceDestroy(PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface);
|
---|
1270 | int vmsvga3dBackSurfaceStretchBlt(PVGASTATE pThis, PVMSVGA3DSTATE pState,
|
---|
1271 | PVMSVGA3DSURFACE pDstSurface, uint32_t uDstFace, uint32_t uDstMipmap, SVGA3dBox const *pDstBox,
|
---|
1272 | PVMSVGA3DSURFACE pSrcSurface, uint32_t uSrcFace, uint32_t uSrcMipmap, SVGA3dBox const *pSrcBox,
|
---|
1273 | SVGA3dStretchBltMode enmMode, PVMSVGA3DCONTEXT pContext);
|
---|
1274 | int vmsvga3dBackSurfaceDMACopyBox(PVGASTATE pThis, PVGASTATECC pThisCC, PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface,
|
---|
1275 | PVMSVGA3DMIPMAPLEVEL pMipLevel, uint32_t uHostFace, uint32_t uHostMipmap,
|
---|
1276 | SVGAGuestPtr GuestPtr, uint32_t cbGuestPitch, SVGA3dTransferType transfer,
|
---|
1277 | SVGA3dCopyBox const *pBox, PVMSVGA3DCONTEXT pContext, int rc, int iBox);
|
---|
1278 |
|
---|
1279 | int vmsvga3dBackCreateTexture(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, uint32_t idAssociatedContext,
|
---|
1280 | PVMSVGA3DSURFACE pSurface);
|
---|
1281 |
|
---|
1282 | DECLINLINE(int) vmsvga3dContextFromCid(PVMSVGA3DSTATE pState, uint32_t cid, PVMSVGA3DCONTEXT *ppContext)
|
---|
1283 | {
|
---|
1284 | AssertReturn(cid < pState->cContexts, VERR_INVALID_PARAMETER);
|
---|
1285 | PVMSVGA3DCONTEXT const pContext = pState->papContexts[cid];
|
---|
1286 | if (RT_LIKELY(pContext && pContext->id == cid))
|
---|
1287 | {
|
---|
1288 | *ppContext = pContext;
|
---|
1289 | return VINF_SUCCESS;
|
---|
1290 | }
|
---|
1291 | LogRelMax(64, ("VMSVGA: unknown cid=%u (%s cid=%u)\n", cid, pContext ? "expected" : "null", pContext ? pContext->id : -1));
|
---|
1292 | return VERR_INVALID_PARAMETER;
|
---|
1293 | }
|
---|
1294 |
|
---|
1295 | DECLINLINE(int) vmsvga3dSurfaceFromSid(PVMSVGA3DSTATE pState, uint32_t sid, PVMSVGA3DSURFACE *ppSurface)
|
---|
1296 | {
|
---|
1297 | AssertReturn(sid < pState->cSurfaces, VERR_INVALID_PARAMETER);
|
---|
1298 | PVMSVGA3DSURFACE const pSurface = pState->papSurfaces[sid];
|
---|
1299 | if (RT_LIKELY(pSurface && pSurface->id == sid))
|
---|
1300 | {
|
---|
1301 | *ppSurface = pSurface;
|
---|
1302 | return VINF_SUCCESS;
|
---|
1303 | }
|
---|
1304 | LogRelMax(64, ("VMSVGA: unknown sid=%u (%s sid=%u)\n", sid, pSurface ? "expected" : "null", pSurface ? pSurface->id : -1));
|
---|
1305 | return VERR_INVALID_PARAMETER;
|
---|
1306 | }
|
---|
1307 |
|
---|
1308 | DECLINLINE(int) vmsvga3dMipmapLevel(PVMSVGA3DSURFACE pSurface, uint32_t face, uint32_t mipmap,
|
---|
1309 | PVMSVGA3DMIPMAPLEVEL *ppMipmapLevel)
|
---|
1310 | {
|
---|
1311 | AssertMsgReturn(face < pSurface->cFaces,
|
---|
1312 | ("cFaces %d, face %d\n", pSurface->cFaces, face),
|
---|
1313 | VERR_INVALID_PARAMETER);
|
---|
1314 | AssertMsgReturn(mipmap < pSurface->cLevels,
|
---|
1315 | ("numMipLevels %d, mipmap %d", pSurface->cLevels, mipmap),
|
---|
1316 | VERR_INVALID_PARAMETER);
|
---|
1317 |
|
---|
1318 | *ppMipmapLevel = &pSurface->paMipmapLevels[face * pSurface->cLevels + mipmap];
|
---|
1319 | return VINF_SUCCESS;
|
---|
1320 | }
|
---|
1321 |
|
---|
1322 | #ifdef VMSVGA3D_DIRECT3D
|
---|
1323 | DECLINLINE(D3DCUBEMAP_FACES) vmsvga3dCubemapFaceFromIndex(uint32_t iFace)
|
---|
1324 | {
|
---|
1325 | D3DCUBEMAP_FACES Face;
|
---|
1326 | switch (iFace)
|
---|
1327 | {
|
---|
1328 | case 0: Face = D3DCUBEMAP_FACE_POSITIVE_X; break;
|
---|
1329 | case 1: Face = D3DCUBEMAP_FACE_NEGATIVE_X; break;
|
---|
1330 | case 2: Face = D3DCUBEMAP_FACE_POSITIVE_Y; break;
|
---|
1331 | case 3: Face = D3DCUBEMAP_FACE_NEGATIVE_Y; break;
|
---|
1332 | case 4: Face = D3DCUBEMAP_FACE_POSITIVE_Z; break;
|
---|
1333 | default:
|
---|
1334 | case 5: Face = D3DCUBEMAP_FACE_NEGATIVE_Z; break;
|
---|
1335 | }
|
---|
1336 | return Face;
|
---|
1337 | }
|
---|
1338 | #elif defined(VMSVGA3D_DX)
|
---|
1339 | DECLINLINE(D3D11_TEXTURECUBE_FACE) vmsvga3dCubemapFaceFromIndex(uint32_t iFace)
|
---|
1340 | {
|
---|
1341 | D3D11_TEXTURECUBE_FACE Face;
|
---|
1342 | switch (iFace)
|
---|
1343 | {
|
---|
1344 | case 0: Face = D3D11_TEXTURECUBE_FACE_POSITIVE_X; break;
|
---|
1345 | case 1: Face = D3D11_TEXTURECUBE_FACE_NEGATIVE_X; break;
|
---|
1346 | case 2: Face = D3D11_TEXTURECUBE_FACE_POSITIVE_Y; break;
|
---|
1347 | case 3: Face = D3D11_TEXTURECUBE_FACE_NEGATIVE_Y; break;
|
---|
1348 | case 4: Face = D3D11_TEXTURECUBE_FACE_POSITIVE_Z; break;
|
---|
1349 | default:
|
---|
1350 | case 5: Face = D3D11_TEXTURECUBE_FACE_NEGATIVE_Z; break;
|
---|
1351 | }
|
---|
1352 | return Face;
|
---|
1353 | }
|
---|
1354 | #else /* VMSVGA3D_OPENGL */
|
---|
1355 | DECLINLINE(GLenum) vmsvga3dCubemapFaceFromIndex(uint32_t iFace)
|
---|
1356 | {
|
---|
1357 | GLint Face;
|
---|
1358 | switch (iFace)
|
---|
1359 | {
|
---|
1360 | case 0: Face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; break;
|
---|
1361 | case 1: Face = GL_TEXTURE_CUBE_MAP_NEGATIVE_X; break;
|
---|
1362 | case 2: Face = GL_TEXTURE_CUBE_MAP_POSITIVE_Y; break;
|
---|
1363 | case 3: Face = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; break;
|
---|
1364 | case 4: Face = GL_TEXTURE_CUBE_MAP_POSITIVE_Z; break;
|
---|
1365 | default:
|
---|
1366 | case 5: Face = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; break;
|
---|
1367 | }
|
---|
1368 | return Face;
|
---|
1369 | }
|
---|
1370 | #endif
|
---|
1371 |
|
---|
1372 | int vmsvga3dOcclusionQueryCreate(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext);
|
---|
1373 | int vmsvga3dOcclusionQueryDelete(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext);
|
---|
1374 | int vmsvga3dOcclusionQueryBegin(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext);
|
---|
1375 | int vmsvga3dOcclusionQueryEnd(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext);
|
---|
1376 | int vmsvga3dOcclusionQueryGetData(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, uint32_t *pu32Pixels);
|
---|
1377 |
|
---|
1378 | void vmsvga3dInfoSurfaceToBitmap(PCDBGFINFOHLP pHlp, PVMSVGA3DSURFACE pSurface,
|
---|
1379 | const char *pszPath, const char *pszNamePrefix, const char *pszNameSuffix);
|
---|
1380 |
|
---|
1381 | #if defined(VMSVGA3D_DIRECT3D) || defined(VMSVGA3D_DX)
|
---|
1382 | #define D3D_RELEASE(ptr) do { \
|
---|
1383 | if (ptr) \
|
---|
1384 | { \
|
---|
1385 | (ptr)->Release(); \
|
---|
1386 | (ptr) = 0; \
|
---|
1387 | } \
|
---|
1388 | } while (0)
|
---|
1389 | #endif
|
---|
1390 |
|
---|
1391 | #if defined(VMSVGA3D_DIRECT3D)
|
---|
1392 | HRESULT D3D9UpdateTexture(PVMSVGA3DCONTEXT pContext,
|
---|
1393 | PVMSVGA3DSURFACE pSurface);
|
---|
1394 | HRESULT D3D9GetRenderTargetData(PVMSVGA3DCONTEXT pContext,
|
---|
1395 | PVMSVGA3DSURFACE pSurface,
|
---|
1396 | uint32_t uFace,
|
---|
1397 | uint32_t uMipmap);
|
---|
1398 | HRESULT D3D9GetSurfaceLevel(PVMSVGA3DSURFACE pSurface,
|
---|
1399 | uint32_t uFace,
|
---|
1400 | uint32_t uMipmap,
|
---|
1401 | bool fBounce,
|
---|
1402 | IDirect3DSurface9 **ppD3DSurface);
|
---|
1403 | D3DFORMAT D3D9GetActualFormat(PVMSVGA3DSTATE pState,
|
---|
1404 | D3DFORMAT d3dfmt);
|
---|
1405 | bool D3D9CheckDeviceFormat(IDirect3D9 *pD3D9,
|
---|
1406 | DWORD Usage,
|
---|
1407 | D3DRESOURCETYPE RType,
|
---|
1408 | D3DFORMAT CheckFormat);
|
---|
1409 | #endif
|
---|
1410 |
|
---|
1411 | #ifdef VMSVGA3D_OPENGL
|
---|
1412 | void vmsvga3dOnSharedContextDefine(PVMSVGA3DSTATE pState);
|
---|
1413 | void vmsvga3dOnSharedContextDestroy(PVMSVGA3DSTATE pState);
|
---|
1414 |
|
---|
1415 | DECLINLINE(GLuint) GLTextureId(PVMSVGA3DSURFACE pSurface)
|
---|
1416 | {
|
---|
1417 | return pSurface->fEmulated ? pSurface->idEmulated : pSurface->oglId.texture;
|
---|
1418 | }
|
---|
1419 |
|
---|
1420 | void FormatConvUpdateTexture(PVMSVGA3DSTATE pState,
|
---|
1421 | PVMSVGA3DCONTEXT pCurrentContext,
|
---|
1422 | PVMSVGA3DSURFACE pSurface,
|
---|
1423 | uint32_t iMipmap);
|
---|
1424 | void FormatConvReadTexture(PVMSVGA3DSTATE pState,
|
---|
1425 | PVMSVGA3DCONTEXT pCurrentContext,
|
---|
1426 | PVMSVGA3DSURFACE pSurface,
|
---|
1427 | uint32_t iMipmap);
|
---|
1428 | #endif
|
---|
1429 |
|
---|
1430 | int vmsvga3dShaderParse(SVGA3dShaderType type, uint32_t cbShaderData, uint32_t const *pShaderData);
|
---|
1431 | void vmsvga3dShaderLogRel(char const *pszMsg, SVGA3dShaderType type, uint32_t cbShaderData, uint32_t const *pShaderData);
|
---|
1432 |
|
---|
1433 | #endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_internal_h */
|
---|
1434 |
|
---|