VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h@ 82303

Last change on this file since 82303 was 82165, checked in by vboxsync, 5 years ago

Devices/Graphics: OpenGL backend: fixes for compressed textures.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette