VirtualBox

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

Last change on this file since 93956 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 49.5 KB
Line 
1/* $Id: DevVGA-SVGA3d.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * DevVMWare - VMWare SVGA device - 3D part.
4 */
5
6/*
7 * Copyright (C) 2013-2022 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_h
19#define VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "DevVGA-SVGA.h"
25
26
27/** Arbitrary limit */
28#define SVGA3D_MAX_SHADER_IDS 0x800
29/** D3D allows up to 8 texture stages. */
30#define SVGA3D_MAX_TEXTURE_STAGES 8
31/** Samplers: 16 Pixel Shader + 1 Displacement Map + 4 Vertex Shader */
32#define SVGA3D_MAX_SAMPLERS_PS 16
33#define SVGA3D_MAX_SAMPLERS_DMAP 1
34#define SVGA3D_MAX_SAMPLERS_VS 4
35#define SVGA3D_MAX_SAMPLERS (SVGA3D_MAX_SAMPLERS_PS + SVGA3D_MAX_SAMPLERS_DMAP + SVGA3D_MAX_SAMPLERS_VS)
36/** Arbitrary upper limit; seen 8 so far. */
37#define SVGA3D_MAX_LIGHTS 32
38/** Arbitrary upper limit; 2GB enough for 32768x16384*4. */
39#define SVGA3D_MAX_SURFACE_MEM_SIZE 0x80000000
40/** Arbitrary upper limit. [0,15] is enough for 2^15=32768x32768. */
41#define SVGA3D_MAX_MIP_LEVELS 16
42
43
44typedef enum VMSVGA3D_SURFACE_MAP
45{
46 VMSVGA3D_SURFACE_MAP_READ,
47 VMSVGA3D_SURFACE_MAP_WRITE,
48 VMSVGA3D_SURFACE_MAP_READ_WRITE,
49 VMSVGA3D_SURFACE_MAP_WRITE_DISCARD,
50} VMSVGA3D_SURFACE_MAP;
51
52typedef struct VMSVGA3D_MAPPED_SURFACE
53{
54 VMSVGA3D_SURFACE_MAP enmMapType;
55 SVGA3dBox box;
56 uint32_t cbPixel;
57 uint32_t cbRowPitch;
58 uint32_t cbDepthPitch;
59 void *pvData;
60} VMSVGA3D_MAPPED_SURFACE;
61
62/* Write render targets to bitmaps. */
63//#define DUMP_BITMAPS
64void vmsvga3dMapWriteBmpFile(VMSVGA3D_MAPPED_SURFACE const *pMap, char const *pszPrefix);
65
66/* DevVGA-SVGA.cpp: */
67void vmsvgaR33dSurfaceUpdateHeapBuffersOnFifoThread(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t sid);
68
69
70/* DevVGA-SVGA3d-ogl.cpp & DevVGA-SVGA3d-win.cpp: */
71int vmsvga3dLoadExec(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
72int vmsvga3dSaveExec(PPDMDEVINS pDevIns, PVGASTATECC pThisCC, PSSMHANDLE pSSM);
73void vmsvga3dUpdateHostScreenViewport(PVGASTATECC pThisCC, uint32_t idScreen, VMSVGAVIEWPORT const *pOldViewport);
74int vmsvga3dQueryCaps(PVGASTATECC pThisCC, SVGA3dDevCapIndex idx3dCaps, uint32_t *pu32Val);
75
76int vmsvga3dSurfaceDefine(PVGASTATECC pThisCC, uint32_t sid, SVGA3dSurface1Flags surfaceFlags, SVGA3dSurfaceFormat format,
77 uint32_t multisampleCount, SVGA3dTextureFilter autogenFilter,
78 uint32_t cMipLevels, SVGA3dSize const *pMipLevel0Size, bool fAllocMipLevels);
79int vmsvga3dSurfaceDestroy(PVGASTATECC pThisCC, uint32_t sid);
80int vmsvga3dSurfaceCopy(PVGASTATECC pThisCC, SVGA3dSurfaceImageId dest, SVGA3dSurfaceImageId src,
81 uint32_t cCopyBoxes, SVGA3dCopyBox *pBox);
82int vmsvga3dSurfaceStretchBlt(PVGASTATE pThis, PVGASTATECC pThisCC,
83 SVGA3dSurfaceImageId const *pDstSfcImg, SVGA3dBox const *pDstBox,
84 SVGA3dSurfaceImageId const *pSrcSfcImg, SVGA3dBox const *pSrcBox, SVGA3dStretchBltMode enmMode);
85int vmsvga3dSurfaceDMA(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAGuestImage guest, SVGA3dSurfaceImageId host, SVGA3dTransferType transfer, uint32_t cCopyBoxes, SVGA3dCopyBox *pBoxes);
86int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t dest, SVGASignedRect destRect, SVGA3dSurfaceImageId srcImage, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect);
87
88int vmsvga3dContextDefine(PVGASTATECC pThisCC, uint32_t cid);
89int vmsvga3dContextDestroy(PVGASTATECC pThisCC, uint32_t cid);
90
91int vmsvga3dChangeMode(PVGASTATECC pThisCC);
92
93int vmsvga3dDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen);
94int vmsvga3dDestroyScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen);
95
96int vmsvga3dSetTransform(PVGASTATECC pThisCC, uint32_t cid, SVGA3dTransformType type, float matrix[16]);
97int vmsvga3dSetZRange(PVGASTATECC pThisCC, uint32_t cid, SVGA3dZRange zRange);
98int vmsvga3dSetRenderState(PVGASTATECC pThisCC, uint32_t cid, uint32_t cRenderStates, SVGA3dRenderState *pRenderState);
99int vmsvga3dSetRenderTarget(PVGASTATECC pThisCC, uint32_t cid, SVGA3dRenderTargetType type, SVGA3dSurfaceImageId target);
100int vmsvga3dSetTextureState(PVGASTATECC pThisCC, uint32_t cid, uint32_t cTextureStates, SVGA3dTextureState *pTextureState);
101int vmsvga3dSetMaterial(PVGASTATECC pThisCC, uint32_t cid, SVGA3dFace face, SVGA3dMaterial *pMaterial);
102int vmsvga3dSetLightData(PVGASTATECC pThisCC, uint32_t cid, uint32_t index, SVGA3dLightData *pData);
103int vmsvga3dSetLightEnabled(PVGASTATECC pThisCC, uint32_t cid, uint32_t index, uint32_t enabled);
104int vmsvga3dSetViewPort(PVGASTATECC pThisCC, uint32_t cid, SVGA3dRect *pRect);
105int vmsvga3dSetClipPlane(PVGASTATECC pThisCC, uint32_t cid, uint32_t index, float plane[4]);
106int vmsvga3dCommandClear(PVGASTATECC pThisCC, uint32_t cid, SVGA3dClearFlag clearFlag, uint32_t color, float depth, uint32_t stencil, uint32_t cRects, SVGA3dRect *pRect);
107int vmsvga3dCommandPresent(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t sid, uint32_t cRects, SVGA3dCopyRect *pRect);
108int vmsvga3dDrawPrimitives(PVGASTATECC pThisCC, uint32_t cid, uint32_t numVertexDecls, SVGA3dVertexDecl *pVertexDecl, uint32_t numRanges, SVGA3dPrimitiveRange *pNumRange, uint32_t cVertexDivisor, SVGA3dVertexDivisor *pVertexDivisor);
109int vmsvga3dSetScissorRect(PVGASTATECC pThisCC, uint32_t cid, SVGA3dRect *pRect);
110int vmsvga3dGenerateMipmaps(PVGASTATECC pThisCC, uint32_t sid, SVGA3dTextureFilter filter);
111
112int vmsvga3dShaderDefine(PVGASTATECC pThisCC, uint32_t cid, uint32_t shid, SVGA3dShaderType type, uint32_t cbData, uint32_t *pShaderData);
113int vmsvga3dShaderDestroy(PVGASTATECC pThisCC, uint32_t cid, uint32_t shid, SVGA3dShaderType type);
114int vmsvga3dShaderSet(PVGASTATECC pThisCC, struct VMSVGA3DCONTEXT *pContext, uint32_t cid, SVGA3dShaderType type, uint32_t shid);
115int vmsvga3dShaderSetConst(PVGASTATECC pThisCC, uint32_t cid, uint32_t reg, SVGA3dShaderType type, SVGA3dShaderConstType ctype, uint32_t cRegisters, uint32_t *pValues);
116
117int vmsvga3dQueryCreate(PVGASTATECC pThisCC, uint32_t cid, SVGA3dQueryType type);
118int vmsvga3dQueryBegin(PVGASTATECC pThisCC, uint32_t cid, SVGA3dQueryType type);
119int vmsvga3dQueryEnd(PVGASTATECC pThisCC, uint32_t cid, SVGA3dQueryType type);
120int vmsvga3dQueryWait(PVGASTATECC pThisCC, uint32_t cid, SVGA3dQueryType type, PVGASTATE pThis, SVGAGuestPtr const *pGuestResult);
121
122int vmsvga3dSurfaceInvalidate(PVGASTATECC pThisCC, uint32_t sid, uint32_t face, uint32_t mipmap);
123
124int vmsvga3dSurfaceMap(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, SVGA3dBox const *pBox,
125 VMSVGA3D_SURFACE_MAP enmMapType, VMSVGA3D_MAPPED_SURFACE *pMap);
126int vmsvga3dSurfaceUnmap(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, VMSVGA3D_MAPPED_SURFACE *pMap, bool fWritten);
127
128uint32_t vmsvga3dCalcSubresourceOffset(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage);
129
130typedef struct VMSGA3D_BOX_DIMENSIONS
131{
132 uint32_t offSubresource; /* Offset of the miplevel. */
133 uint32_t offBox; /* Offset of the box in the miplevel. */
134 uint32_t cbRow; /* Bytes per row. */
135 int32_t cbPitch; /* Bytes between rows. */
136 uint32_t cyBlocks; /* Number of rows. */
137 uint32_t cDepth; /* Number of planes. */
138} VMSGA3D_BOX_DIMENSIONS;
139
140int vmsvga3dGetBoxDimensions(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, SVGA3dBox const *pBox,
141 VMSGA3D_BOX_DIMENSIONS *pResult);
142
143DECLINLINE(void) vmsvga3dCalcMipmapSize(SVGA3dSize const *pSize0, uint32_t iMipmap, SVGA3dSize *pSize)
144{
145 pSize->width = RT_MAX(pSize0->width >> iMipmap, 1);
146 pSize->height = RT_MAX(pSize0->height >> iMipmap, 1);
147 pSize->depth = RT_MAX(pSize0->depth >> iMipmap, 1);
148}
149
150DECLINLINE(uint32_t) vmsvga3dCalcSubresource(uint32_t iMipLevel, uint32_t iFace, uint32_t cMipLevels)
151{
152 /* Same as in D3D */
153 return iMipLevel + iFace * cMipLevels;
154}
155
156DECLINLINE(void) vmsvga3dCalcMipmapAndFace(uint32_t cMipLevels, uint32_t iSubresource, uint32_t *piMipmap, uint32_t *piFace)
157{
158 *piFace = iSubresource / cMipLevels;
159 *piMipmap = iSubresource % cMipLevels;
160}
161
162int vmsvga3dCalcSurfaceMipmapAndFace(PVGASTATECC pThisCC, uint32_t sid, uint32_t iSubresource, uint32_t *piMipmap, uint32_t *piFace);
163
164
165/* DevVGA-SVGA3d-shared.h: */
166#if defined(RT_OS_WINDOWS) && defined(IN_RING3)
167# include <iprt/win/windows.h>
168
169# define WM_VMSVGA3D_WAKEUP (WM_APP+1)
170# define WM_VMSVGA3D_CREATEWINDOW (WM_APP+2)
171# define WM_VMSVGA3D_DESTROYWINDOW (WM_APP+3)
172# define WM_VMSVGA3D_EXIT (WM_APP+5)
173# if 0
174# define WM_VMSVGA3D_CREATE_DEVICE (WM_APP+6)
175typedef struct VMSVGA3DCREATEDEVICEPARAMS
176{
177 struct VMSVGA3DSTATE *pState;
178 struct VMSVGA3DCONTEXT *pContext;
179 struct _D3DPRESENT_PARAMETERS_ *pPresParams;
180 HRESULT hrc;
181} VMSVGA3DCREATEDEVICEPARAMS;
182# endif
183
184DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD ThreadSelf, void *pvUser);
185int vmsvga3dSendThreadMessage(RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, UINT msg, WPARAM wParam, LPARAM lParam);
186int vmsvga3dContextWindowCreate(HINSTANCE hInstance, RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, HWND *pHwnd);
187
188#endif
189
190void vmsvga3dUpdateHeapBuffersForSurfaces(PVGASTATECC pThisCC, uint32_t sid);
191void vmsvga3dInfoContextWorker(PVGASTATECC pThisCC, PCDBGFINFOHLP pHlp, uint32_t cid, bool fVerbose);
192void vmsvga3dInfoSurfaceWorker(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, PCDBGFINFOHLP pHlp, uint32_t sid,
193 bool fVerbose, uint32_t cxAscii, bool fInvY, const char *pszBitmapPath);
194
195/* DevVGA-SVGA3d-shared.cpp: */
196
197/**
198 * Structure for use with vmsvga3dInfoU32Flags.
199 */
200typedef struct VMSVGAINFOFLAGS32
201{
202 /** The flags. */
203 uint32_t fFlags;
204 /** The corresponding mnemonic. */
205 const char *pszJohnny;
206} VMSVGAINFOFLAGS32;
207/** Pointer to a read-only flag translation entry. */
208typedef VMSVGAINFOFLAGS32 const *PCVMSVGAINFOFLAGS32;
209void vmsvga3dInfoU32Flags(PCDBGFINFOHLP pHlp, uint32_t fFlags, const char *pszPrefix, PCVMSVGAINFOFLAGS32 paFlags, uint32_t cFlags);
210
211/**
212 * Structure for use with vmsvgaFormatEnumValueEx and vmsvgaFormatEnumValue.
213 */
214typedef struct VMSVGAINFOENUM
215{
216 /** The enum value. */
217 int32_t iValue;
218 /** The corresponding value name. */
219 const char *pszName;
220} VMSVGAINFOENUM;
221/** Pointer to a read-only enum value translation entry. */
222typedef VMSVGAINFOENUM const *PCVMSVGAINFOENUM;
223/**
224 * Structure for use with vmsvgaFormatEnumValueEx and vmsvgaFormatEnumValue.
225 */
226typedef struct VMSVGAINFOENUMMAP
227{
228 /** Pointer to the value mapping array. */
229 PCVMSVGAINFOENUM paValues;
230 /** The number of value mappings. */
231 size_t cValues;
232 /** The prefix. */
233 const char *pszPrefix;
234#ifdef RT_STRICT
235 /** Indicates whether we've checked that it's sorted or not. */
236 bool *pfAsserted;
237#endif
238} VMSVGAINFOENUMMAP;
239typedef VMSVGAINFOENUMMAP const *PCVMSVGAINFOENUMMAP;
240/** @def VMSVGAINFOENUMMAP_MAKE
241 * Macro for defining a VMSVGAINFOENUMMAP, silently dealing with pfAsserted.
242 *
243 * @param a_Scope The scope. RT_NOTHING or static.
244 * @param a_VarName The variable name for this map.
245 * @param a_aValues The variable name of the value mapping array.
246 * @param a_pszPrefix The value name prefix.
247 */
248#ifdef VBOX_STRICT
249# define VMSVGAINFOENUMMAP_MAKE(a_Scope, a_VarName, a_aValues, a_pszPrefix) \
250 static bool RT_CONCAT(a_VarName,_AssertedSorted) = false; \
251 a_Scope VMSVGAINFOENUMMAP const a_VarName = { \
252 a_aValues, RT_ELEMENTS(a_aValues), a_pszPrefix, &RT_CONCAT(a_VarName,_AssertedSorted) \
253 }
254#else
255# define VMSVGAINFOENUMMAP_MAKE(a_Scope, a_VarName, a_aValues, a_pszPrefix) \
256 a_Scope VMSVGAINFOENUMMAP const a_VarName = { a_aValues, RT_ELEMENTS(a_aValues), a_pszPrefix }
257#endif
258extern VMSVGAINFOENUMMAP const g_SVGA3dSurfaceFormat2String;
259const char *vmsvgaLookupEnum(int32_t iValue, PCVMSVGAINFOENUMMAP pEnumMap);
260char *vmsvgaFormatEnumValueEx(char *pszBuffer, size_t cbBuffer, const char *pszName, int32_t iValue,
261 bool fPrefix, PCVMSVGAINFOENUMMAP pEnumMap);
262char *vmsvgaFormatEnumValue(char *pszBuffer, size_t cbBuffer, const char *pszName, uint32_t uValue,
263 const char *pszPrefix, const char * const *papszValues, size_t cValues);
264
265/**
266 * ASCII "art" scanline printer callback.
267 *
268 * @param pszLine The line to output.
269 * @param pvUser The user argument.
270 */
271typedef DECLCALLBACKTYPE(void, FNVMSVGAASCIIPRINTLN,(const char *pszLine, void *pvUser));
272/** Pointer to an ASCII "art" print line callback. */
273typedef FNVMSVGAASCIIPRINTLN *PFNVMSVGAASCIIPRINTLN;
274void vmsvga3dAsciiPrint(PFNVMSVGAASCIIPRINTLN pfnPrintLine, void *pvUser, void const *pvImage, size_t cbImage,
275 uint32_t cx, uint32_t cy, uint32_t cbScanline, SVGA3dSurfaceFormat enmFormat, bool fInvY,
276 uint32_t cchMaxX, uint32_t cchMaxY);
277DECLCALLBACK(void) vmsvga3dAsciiPrintlnInfo(const char *pszLine, void *pvUser);
278DECLCALLBACK(void) vmsvga3dAsciiPrintlnLog(const char *pszLine, void *pvUser);
279
280char *vmsvga3dFormatRenderState(char *pszBuffer, size_t cbBuffer, SVGA3dRenderState const *pRenderState);
281char *vmsvga3dFormatTextureState(char *pszBuffer, size_t cbBuffer, SVGA3dTextureState const *pTextureState);
282void vmsvga3dInfoHostWindow(PCDBGFINFOHLP pHlp, uint64_t idHostWindow);
283
284uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format,
285 uint32_t *pu32BlockWidth,
286 uint32_t *pu32BlockHeight);
287
288#ifdef LOG_ENABLED
289const char *vmsvga3dGetCapString(uint32_t idxCap);
290const char *vmsvga3dGet3dFormatString(uint32_t format);
291const char *vmsvga3dGetRenderStateName(uint32_t state);
292const char *vmsvga3dTextureStateToString(SVGA3dTextureStateName textureState);
293const char *vmsvgaTransformToString(SVGA3dTransformType type);
294const char *vmsvgaDeclUsage2String(SVGA3dDeclUsage usage);
295const char *vmsvgaDeclType2String(SVGA3dDeclType type);
296const char *vmsvgaDeclMethod2String(SVGA3dDeclMethod method);
297const char *vmsvgaSurfaceType2String(SVGA3dSurfaceFormat format);
298const char *vmsvga3dPrimitiveType2String(SVGA3dPrimitiveType PrimitiveType);
299#endif
300
301
302/*
303 * Backend interfaces.
304 */
305bool vmsvga3dIsLegacyBackend(PVGASTATECC pThisCC);
306
307typedef struct VMSVGA3DSURFACE *PVMSVGA3DSURFACE;
308typedef struct VMSVGA3DMIPMAPLEVEL *PVMSVGA3DMIPMAPLEVEL;
309typedef struct VMSVGA3DCONTEXT *PVMSVGA3DCONTEXT;
310
311/* Essential 3D backend function. */
312#define VMSVGA3D_BACKEND_INTERFACE_NAME_3D "3D"
313typedef struct
314{
315 DECLCALLBACKMEMBER(int, pfnInit, (PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC));
316 DECLCALLBACKMEMBER(int, pfnPowerOn, (PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC));
317 DECLCALLBACKMEMBER(int, pfnTerminate, (PVGASTATECC pThisCC));
318 DECLCALLBACKMEMBER(int, pfnReset, (PVGASTATECC pThisCC));
319 DECLCALLBACKMEMBER(int, pfnQueryCaps, (PVGASTATECC pThisCC, SVGA3dDevCapIndex idx3dCaps, uint32_t *pu32Val));
320 DECLCALLBACKMEMBER(int, pfnChangeMode, (PVGASTATECC pThisCC));
321 DECLCALLBACKMEMBER(int, pfnCreateTexture, (PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext, uint32_t idAssociatedContext, PVMSVGA3DSURFACE pSurface));
322 DECLCALLBACKMEMBER(void, pfnSurfaceDestroy, (PVGASTATECC pThisCC, PVMSVGA3DSURFACE pSurface));
323 DECLCALLBACKMEMBER(int, pfnSurfaceCopy, (PVGASTATECC pThisCC, SVGA3dSurfaceImageId dest, SVGA3dSurfaceImageId src, uint32_t cCopyBoxes, SVGA3dCopyBox *pBox));
324 DECLCALLBACKMEMBER(int, pfnSurfaceDMACopyBox, (PVGASTATE pThis, PVGASTATECC pThisCC, PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface,
325 PVMSVGA3DMIPMAPLEVEL pMipLevel, uint32_t uHostFace, uint32_t uHostMipmap,
326 SVGAGuestPtr GuestPtr, uint32_t cbGuestPitch, SVGA3dTransferType transfer,
327 SVGA3dCopyBox const *pBox, PVMSVGA3DCONTEXT pContext, int rc, int iBox));
328 DECLCALLBACKMEMBER(int, pfnSurfaceStretchBlt, (PVGASTATE pThis, PVMSVGA3DSTATE pState,
329 PVMSVGA3DSURFACE pDstSurface, uint32_t uDstFace, uint32_t uDstMipmap, SVGA3dBox const *pDstBox,
330 PVMSVGA3DSURFACE pSrcSurface, uint32_t uSrcFace, uint32_t uSrcMipmap, SVGA3dBox const *pSrcBox,
331 SVGA3dStretchBltMode enmMode, PVMSVGA3DCONTEXT pContext));
332 DECLCALLBACKMEMBER(void, pfnUpdateHostScreenViewport, (PVGASTATECC pThisCC, uint32_t idScreen, VMSVGAVIEWPORT const *pOldViewport));
333 /** @todo HW accelerated screen output probably needs a separate interface. */
334 DECLCALLBACKMEMBER(int, pfnDefineScreen, (PVGASTATE pThis, PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen));
335 DECLCALLBACKMEMBER(int, pfnDestroyScreen, (PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen));
336 DECLCALLBACKMEMBER(int, pfnSurfaceBlitToScreen, (PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen,
337 SVGASignedRect destRect, SVGA3dSurfaceImageId srcImage,
338 SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *paRects));
339 /* Various helpers. */
340 DECLCALLBACKMEMBER(int, pfnSurfaceUpdateHeapBuffers, (PVGASTATECC pThisCC, PVMSVGA3DSURFACE pSurface));
341} VMSVGA3DBACKENDFUNCS3D;
342
343/* VGPU9 3D */
344#define VMSVGA3D_BACKEND_INTERFACE_NAME_VGPU9 "VGPU9"
345typedef struct
346{
347 DECLCALLBACKMEMBER(int, pfnContextDefine, (PVGASTATECC pThisCC, uint32_t cid));
348 DECLCALLBACKMEMBER(int, pfnContextDestroy, (PVGASTATECC pThisCC, uint32_t cid));
349 DECLCALLBACKMEMBER(int, pfnSetTransform, (PVGASTATECC pThisCC, uint32_t cid, SVGA3dTransformType type, float matrix[16]));
350 DECLCALLBACKMEMBER(int, pfnSetZRange, (PVGASTATECC pThisCC, uint32_t cid, SVGA3dZRange zRange));
351 DECLCALLBACKMEMBER(int, pfnSetRenderState, (PVGASTATECC pThisCC, uint32_t cid, uint32_t cRenderStates, SVGA3dRenderState *pRenderState));
352 DECLCALLBACKMEMBER(int, pfnSetRenderTarget, (PVGASTATECC pThisCC, uint32_t cid, SVGA3dRenderTargetType type, SVGA3dSurfaceImageId target));
353 DECLCALLBACKMEMBER(int, pfnSetTextureState, (PVGASTATECC pThisCC, uint32_t cid, uint32_t cTextureStates, SVGA3dTextureState *pTextureState));
354 DECLCALLBACKMEMBER(int, pfnSetMaterial, (PVGASTATECC pThisCC, uint32_t cid, SVGA3dFace face, SVGA3dMaterial *pMaterial));
355 DECLCALLBACKMEMBER(int, pfnSetLightData, (PVGASTATECC pThisCC, uint32_t cid, uint32_t index, SVGA3dLightData *pData));
356 DECLCALLBACKMEMBER(int, pfnSetLightEnabled, (PVGASTATECC pThisCC, uint32_t cid, uint32_t index, uint32_t enabled));
357 DECLCALLBACKMEMBER(int, pfnSetViewPort, (PVGASTATECC pThisCC, uint32_t cid, SVGA3dRect *pRect));
358 DECLCALLBACKMEMBER(int, pfnSetClipPlane, (PVGASTATECC pThisCC, uint32_t cid, uint32_t index, float plane[4]));
359 DECLCALLBACKMEMBER(int, pfnCommandClear, (PVGASTATECC pThisCC, uint32_t cid, SVGA3dClearFlag clearFlag, uint32_t color, float depth, uint32_t stencil, uint32_t cRects, SVGA3dRect *pRect));
360 DECLCALLBACKMEMBER(int, pfnDrawPrimitives, (PVGASTATECC pThisCC, uint32_t cid, uint32_t numVertexDecls, SVGA3dVertexDecl *pVertexDecl, uint32_t numRanges, SVGA3dPrimitiveRange *pNumRange, uint32_t cVertexDivisor, SVGA3dVertexDivisor *pVertexDivisor));
361 DECLCALLBACKMEMBER(int, pfnSetScissorRect, (PVGASTATECC pThisCC, uint32_t cid, SVGA3dRect *pRect));
362 DECLCALLBACKMEMBER(int, pfnGenerateMipmaps, (PVGASTATECC pThisCC, uint32_t sid, SVGA3dTextureFilter filter));
363 DECLCALLBACKMEMBER(int, pfnShaderDefine, (PVGASTATECC pThisCC, uint32_t cid, uint32_t shid, SVGA3dShaderType type, uint32_t cbData, uint32_t *pShaderData));
364 DECLCALLBACKMEMBER(int, pfnShaderDestroy, (PVGASTATECC pThisCC, uint32_t cid, uint32_t shid, SVGA3dShaderType type));
365 DECLCALLBACKMEMBER(int, pfnShaderSet, (PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext, uint32_t cid, SVGA3dShaderType type, uint32_t shid));
366 DECLCALLBACKMEMBER(int, pfnShaderSetConst, (PVGASTATECC pThisCC, uint32_t cid, uint32_t reg, SVGA3dShaderType type, SVGA3dShaderConstType ctype, uint32_t cRegisters, uint32_t *pValues));
367 DECLCALLBACKMEMBER(int, pfnOcclusionQueryCreate, (PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext));
368 DECLCALLBACKMEMBER(int, pfnOcclusionQueryDelete, (PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext));
369 DECLCALLBACKMEMBER(int, pfnOcclusionQueryBegin, (PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext));
370 DECLCALLBACKMEMBER(int, pfnOcclusionQueryEnd, (PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext));
371 DECLCALLBACKMEMBER(int, pfnOcclusionQueryGetData, (PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext, uint32_t *pu32Pixels));
372} VMSVGA3DBACKENDFUNCSVGPU9;
373
374/* Support for Guest-Backed Objects. */
375#define VMSVGA3D_BACKEND_INTERFACE_NAME_GBO "GBO"
376typedef struct
377{
378 DECLCALLBACKMEMBER(int, pfnScreenTargetBind, (PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen, uint32_t sid));
379 DECLCALLBACKMEMBER(int, pfnScreenTargetUpdate, (PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen, SVGA3dRect const *pRect));
380} VMSVGA3DBACKENDFUNCSGBO;
381
382#define VMSVGA3D_BACKEND_INTERFACE_NAME_MAP "MAP"
383typedef struct
384{
385 DECLCALLBACKMEMBER(int, pfnSurfaceMap, (PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, SVGA3dBox const *pBox, VMSVGA3D_SURFACE_MAP enmMapType, VMSVGA3D_MAPPED_SURFACE *pMap));
386 DECLCALLBACKMEMBER(int, pfnSurfaceUnmap, (PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, VMSVGA3D_MAPPED_SURFACE *pMap, bool fWritten));
387} VMSVGA3DBACKENDFUNCSMAP;
388
389typedef struct VMSVGA3DSHADER *PVMSVGA3DSHADER;
390typedef struct VMSVGA3DDXCONTEXT *PVMSVGA3DDXCONTEXT;
391#define VMSVGA3D_BACKEND_INTERFACE_NAME_DX "DX"
392typedef struct
393{
394 DECLCALLBACKMEMBER(int, pfnDXDefineContext, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
395 DECLCALLBACKMEMBER(int, pfnDXDestroyContext, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
396 DECLCALLBACKMEMBER(int, pfnDXBindContext, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
397 DECLCALLBACKMEMBER(int, pfnDXReadbackContext, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
398 DECLCALLBACKMEMBER(int, pfnDXInvalidateContext, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
399 DECLCALLBACKMEMBER(int, pfnDXSetSingleConstantBuffer, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t slot, SVGA3dShaderType type, SVGA3dSurfaceId sid, uint32_t offsetInBytes, uint32_t sizeInBytes));
400 DECLCALLBACKMEMBER(int, pfnDXSetShaderResources, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t startView, SVGA3dShaderType type, uint32_t cShaderResourceViewId, SVGA3dShaderResourceViewId const *paShaderResourceViewId));
401 DECLCALLBACKMEMBER(int, pfnDXSetShader, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderType type, PVMSVGA3DSHADER pShader));
402 DECLCALLBACKMEMBER(int, pfnDXSetSamplers, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t startSampler, SVGA3dShaderType type, uint32_t cSamplerId, SVGA3dSamplerId const *paSamplerId));
403 DECLCALLBACKMEMBER(int, pfnDXDraw, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t vertexCount, uint32_t startVertexLocation));
404 DECLCALLBACKMEMBER(int, pfnDXDrawIndexed, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t indexCount, uint32_t startIndexLocation, int32_t baseVertexLocation));
405 DECLCALLBACKMEMBER(int, pfnDXDrawInstanced, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t vertexCountPerInstance, uint32_t instanceCount, uint32_t startVertexLocation, uint32_t startInstanceLocation));
406 DECLCALLBACKMEMBER(int, pfnDXDrawIndexedInstanced, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t indexCountPerInstance, uint32_t instanceCount, uint32_t startIndexLocation, int32_t baseVertexLocation, uint32_t startInstanceLocation));
407 DECLCALLBACKMEMBER(int, pfnDXDrawAuto, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
408 DECLCALLBACKMEMBER(int, pfnDXSetInputLayout, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dElementLayoutId elementLayoutId));
409 DECLCALLBACKMEMBER(int, pfnDXSetVertexBuffers, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t startBuffer, uint32_t cVertexBuffer, SVGA3dVertexBuffer const *paVertexBuffer));
410 DECLCALLBACKMEMBER(int, pfnDXSetIndexBuffer, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSurfaceId sid, SVGA3dSurfaceFormat format, uint32_t offset));
411 DECLCALLBACKMEMBER(int, pfnDXSetTopology, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dPrimitiveType topology));
412 DECLCALLBACKMEMBER(int, pfnDXSetRenderTargets, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId, uint32_t cRenderTargetViewId, SVGA3dRenderTargetViewId const *paRenderTargetViewId));
413 DECLCALLBACKMEMBER(int, pfnDXSetBlendState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dBlendStateId blendId, float const blendFactor[4], uint32_t sampleMask));
414 DECLCALLBACKMEMBER(int, pfnDXSetDepthStencilState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilStateId depthStencilId, uint32_t stencilRef));
415 DECLCALLBACKMEMBER(int, pfnDXSetRasterizerState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRasterizerStateId rasterizerId));
416 DECLCALLBACKMEMBER(int, pfnDXDefineQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
417 DECLCALLBACKMEMBER(int, pfnDXDestroyQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
418 DECLCALLBACKMEMBER(int, pfnDXBindQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
419 DECLCALLBACKMEMBER(int, pfnDXSetQueryOffset, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
420 DECLCALLBACKMEMBER(int, pfnDXBeginQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
421 DECLCALLBACKMEMBER(int, pfnDXEndQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
422 DECLCALLBACKMEMBER(int, pfnDXReadbackQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
423 DECLCALLBACKMEMBER(int, pfnDXSetPredication, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
424 DECLCALLBACKMEMBER(int, pfnDXSetSOTargets, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t cSoTarget, SVGA3dSoTarget const *paSoTarget));
425 DECLCALLBACKMEMBER(int, pfnDXSetViewports, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t cViewport, SVGA3dViewport const *paViewport));
426 DECLCALLBACKMEMBER(int, pfnDXSetScissorRects, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t cRect, SVGASignedRect const *paRect));
427 DECLCALLBACKMEMBER(int, pfnDXClearRenderTargetView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGA3dRGBAFloat const *pRGBA));
428 DECLCALLBACKMEMBER(int, pfnDXClearDepthStencilView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t flags, SVGA3dDepthStencilViewId depthStencilViewId, float depth, uint8_t stencil));
429 DECLCALLBACKMEMBER(int, pfnDXPredCopyRegion, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSurfaceId dstSid, uint32_t dstSubResource, SVGA3dSurfaceId srcSid, uint32_t srcSubResource, SVGA3dCopyBox const *pBox));
430 DECLCALLBACKMEMBER(int, pfnDXPredCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
431 DECLCALLBACKMEMBER(int, pfnDXPresentBlt, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
432 DECLCALLBACKMEMBER(int, pfnDXGenMips, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderResourceViewId shaderResourceViewId));
433 DECLCALLBACKMEMBER(int, pfnDXDefineShaderResourceView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderResourceViewId shaderResourceViewId, SVGACOTableDXSRViewEntry const *pEntry));
434 DECLCALLBACKMEMBER(int, pfnDXDestroyShaderResourceView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderResourceViewId shaderResourceViewId));
435 DECLCALLBACKMEMBER(int, pfnDXDefineRenderTargetView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGACOTableDXRTViewEntry const *pEntry));
436 DECLCALLBACKMEMBER(int, pfnDXDestroyRenderTargetView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId));
437 DECLCALLBACKMEMBER(int, pfnDXDefineDepthStencilView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId, SVGACOTableDXDSViewEntry const *pEntry));
438 DECLCALLBACKMEMBER(int, pfnDXDestroyDepthStencilView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId));
439 DECLCALLBACKMEMBER(int, pfnDXDefineElementLayout, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dElementLayoutId elementLayoutId, SVGACOTableDXElementLayoutEntry const *pEntry));
440 DECLCALLBACKMEMBER(int, pfnDXDestroyElementLayout, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
441 DECLCALLBACKMEMBER(int, pfnDXDefineBlendState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dBlendStateId blendId, SVGACOTableDXBlendStateEntry const *pEntry));
442 DECLCALLBACKMEMBER(int, pfnDXDestroyBlendState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
443 DECLCALLBACKMEMBER(int, pfnDXDefineDepthStencilState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilStateId depthStencilId, SVGACOTableDXDepthStencilEntry const *pEntry));
444 DECLCALLBACKMEMBER(int, pfnDXDestroyDepthStencilState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
445 DECLCALLBACKMEMBER(int, pfnDXDefineRasterizerState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRasterizerStateId rasterizerId, SVGACOTableDXRasterizerStateEntry const *pEntry));
446 DECLCALLBACKMEMBER(int, pfnDXDestroyRasterizerState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
447 DECLCALLBACKMEMBER(int, pfnDXDefineSamplerState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSamplerId samplerId, SVGACOTableDXSamplerEntry const *pEntry));
448 DECLCALLBACKMEMBER(int, pfnDXDestroySamplerState, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
449 DECLCALLBACKMEMBER(int, pfnDXDefineShader, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderId shaderId, SVGACOTableDXShaderEntry const *pEntry));
450 DECLCALLBACKMEMBER(int, pfnDXDestroyShader, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderId shaderId));
451 DECLCALLBACKMEMBER(int, pfnDXBindShader, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, PVMSVGA3DSHADER pShader, void const *pvShaderBytecode));
452 DECLCALLBACKMEMBER(int, pfnDXDefineStreamOutput, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dStreamOutputId soid, SVGACOTableDXStreamOutputEntry const *pEntry));
453 DECLCALLBACKMEMBER(int, pfnDXDestroyStreamOutput, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dStreamOutputId soid));
454 DECLCALLBACKMEMBER(int, pfnDXSetStreamOutput, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dStreamOutputId soid));
455 DECLCALLBACKMEMBER(int, pfnDXSetCOTable, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGACOTableType type, uint32_t cValidEntries));
456 DECLCALLBACKMEMBER(int, pfnDXBufferCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
457 DECLCALLBACKMEMBER(int, pfnDXSurfaceCopyAndReadback, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
458 DECLCALLBACKMEMBER(int, pfnDXMoveQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
459 DECLCALLBACKMEMBER(int, pfnDXBindAllQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
460 DECLCALLBACKMEMBER(int, pfnDXReadbackAllQuery, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
461 DECLCALLBACKMEMBER(int, pfnDXMobFence64, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
462 DECLCALLBACKMEMBER(int, pfnDXBindAllShader, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
463 DECLCALLBACKMEMBER(int, pfnDXHint, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
464 DECLCALLBACKMEMBER(int, pfnDXBufferUpdate, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
465 DECLCALLBACKMEMBER(int, pfnDXSetVSConstantBufferOffset, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
466 DECLCALLBACKMEMBER(int, pfnDXSetPSConstantBufferOffset, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
467 DECLCALLBACKMEMBER(int, pfnDXSetGSConstantBufferOffset, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
468 DECLCALLBACKMEMBER(int, pfnDXSetHSConstantBufferOffset, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
469 DECLCALLBACKMEMBER(int, pfnDXSetDSConstantBufferOffset, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
470 DECLCALLBACKMEMBER(int, pfnDXSetCSConstantBufferOffset, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
471 DECLCALLBACKMEMBER(int, pfnDXCondBindAllShader, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
472 DECLCALLBACKMEMBER(int, pfnScreenCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
473 DECLCALLBACKMEMBER(int, pfnGrowOTable, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
474 DECLCALLBACKMEMBER(int, pfnDXGrowCOTable, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
475 DECLCALLBACKMEMBER(int, pfnIntraSurfaceCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
476 DECLCALLBACKMEMBER(int, pfnDefineGBSurface_v3, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
477 DECLCALLBACKMEMBER(int, pfnDXResolveCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
478 DECLCALLBACKMEMBER(int, pfnDXPredResolveCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
479 DECLCALLBACKMEMBER(int, pfnDXPredConvertRegion, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
480 DECLCALLBACKMEMBER(int, pfnDXPredConvert, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
481 DECLCALLBACKMEMBER(int, pfnWholeSurfaceCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
482 DECLCALLBACKMEMBER(int, pfnDXDefineUAView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
483 DECLCALLBACKMEMBER(int, pfnDXDestroyUAView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
484 DECLCALLBACKMEMBER(int, pfnDXClearUAViewUint, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
485 DECLCALLBACKMEMBER(int, pfnDXClearUAViewFloat, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
486 DECLCALLBACKMEMBER(int, pfnDXCopyStructureCount, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
487 DECLCALLBACKMEMBER(int, pfnDXSetUAViews, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
488 DECLCALLBACKMEMBER(int, pfnDXDrawIndexedInstancedIndirect, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
489 DECLCALLBACKMEMBER(int, pfnDXDrawInstancedIndirect, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
490 DECLCALLBACKMEMBER(int, pfnDXDispatch, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
491 DECLCALLBACKMEMBER(int, pfnDXDispatchIndirect, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
492 DECLCALLBACKMEMBER(int, pfnWriteZeroSurface, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
493 DECLCALLBACKMEMBER(int, pfnHintZeroSurface, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
494 DECLCALLBACKMEMBER(int, pfnDXTransferToBuffer, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
495 DECLCALLBACKMEMBER(int, pfnDXSetStructureCount, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
496 DECLCALLBACKMEMBER(int, pfnLogicOpsBitBlt, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
497 DECLCALLBACKMEMBER(int, pfnLogicOpsTransBlt, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
498 DECLCALLBACKMEMBER(int, pfnLogicOpsStretchBlt, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
499 DECLCALLBACKMEMBER(int, pfnLogicOpsColorFill, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
500 DECLCALLBACKMEMBER(int, pfnLogicOpsAlphaBlend, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
501 DECLCALLBACKMEMBER(int, pfnLogicOpsClearTypeBlend, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
502 DECLCALLBACKMEMBER(int, pfnDefineGBSurface_v4, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
503 DECLCALLBACKMEMBER(int, pfnDXSetCSUAViews, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
504 DECLCALLBACKMEMBER(int, pfnDXSetMinLOD, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
505 DECLCALLBACKMEMBER(int, pfnDXDefineStreamOutputWithMob, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
506 DECLCALLBACKMEMBER(int, pfnDXSetShaderIface, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
507 DECLCALLBACKMEMBER(int, pfnDXBindStreamOutput, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
508 DECLCALLBACKMEMBER(int, pfnSurfaceStretchBltNonMSToMS, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
509 DECLCALLBACKMEMBER(int, pfnDXBindShaderIface, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
510} VMSVGA3DBACKENDFUNCSDX;
511
512typedef struct VMSVGA3DBACKENDDESC
513{
514 char const *pszName;
515 DECLCALLBACKMEMBER(int, pfnQueryInterface, (PVGASTATECC pThisCC, char const *pszInterfaceName, void *pvInterfaceFuncs, size_t cbInterfaceFuncs));
516} VMSVGA3DBACKENDDESC;
517
518#ifdef VMSVGA3D_DX
519/* Helpers. */
520int vmsvga3dDXUnbindContext(PVGASTATECC pThisCC, uint32_t cid, SVGADXContextMobFormat *pSvgaDXContext);
521
522/* Command handlers. */
523int vmsvga3dDXDefineContext(PVGASTATECC pThisCC, uint32_t cid);
524int vmsvga3dDXDestroyContext(PVGASTATECC pThisCC, uint32_t cid);
525int vmsvga3dDXBindContext(PVGASTATECC pThisCC, uint32_t cid, SVGADXContextMobFormat *pSvgaDXContext);
526int vmsvga3dDXReadbackContext(PVGASTATECC pThisCC, uint32_t idDXContext, SVGADXContextMobFormat *pSvgaDXContext);
527int vmsvga3dDXInvalidateContext(PVGASTATECC pThisCC, uint32_t idDXContext);
528int vmsvga3dDXSetSingleConstantBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSingleConstantBuffer const *pCmd);
529int vmsvga3dDXSetShaderResources(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShaderResources const *pCmd, uint32_t cShaderResourceViewId, SVGA3dShaderResourceViewId const *paShaderResourceViewId);
530int vmsvga3dDXSetShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShader const *pCmd);
531int vmsvga3dDXSetSamplers(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSamplers const *pCmd, uint32_t cSamplerId, SVGA3dSamplerId const *paSamplerId);
532int vmsvga3dDXDraw(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDraw const *pCmd);
533int vmsvga3dDXDrawIndexed(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexed const *pCmd);
534int vmsvga3dDXDrawInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawInstanced const *pCmd);
535int vmsvga3dDXDrawIndexedInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexedInstanced const *pCmd);
536int vmsvga3dDXDrawAuto(PVGASTATECC pThisCC, uint32_t idDXContext);
537int vmsvga3dDXSetInputLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dElementLayoutId elementLayoutId);
538int vmsvga3dDXSetVertexBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, uint32_t startBuffer, uint32_t cVertexBuffer, SVGA3dVertexBuffer const *paVertexBuffer);
539int vmsvga3dDXSetIndexBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetIndexBuffer const *pCmd);
540int vmsvga3dDXSetTopology(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dPrimitiveType topology);
541int vmsvga3dDXSetRenderTargets(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dDepthStencilViewId depthStencilViewId, uint32_t cRenderTargetViewId, SVGA3dRenderTargetViewId const *paRenderTargetViewId);
542int vmsvga3dDXSetBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetBlendState const *pCmd);
543int vmsvga3dDXSetDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetDepthStencilState const *pCmd);
544int vmsvga3dDXSetRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dRasterizerStateId rasterizerId);
545int vmsvga3dDXDefineQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
546int vmsvga3dDXDestroyQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
547int vmsvga3dDXBindQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
548int vmsvga3dDXSetQueryOffset(PVGASTATECC pThisCC, uint32_t idDXContext);
549int vmsvga3dDXBeginQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
550int vmsvga3dDXEndQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
551int vmsvga3dDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
552int vmsvga3dDXSetPredication(PVGASTATECC pThisCC, uint32_t idDXContext);
553int vmsvga3dDXSetSOTargets(PVGASTATECC pThisCC, uint32_t idDXContext, uint32_t cSoTarget, SVGA3dSoTarget const *paSoTarget);
554int vmsvga3dDXSetViewports(PVGASTATECC pThisCC, uint32_t idDXContext, uint32_t cViewport, SVGA3dViewport const *paViewport);
555int vmsvga3dDXSetScissorRects(PVGASTATECC pThisCC, uint32_t idDXContext, uint32_t cRect, SVGASignedRect const *paRect);
556int vmsvga3dDXClearRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearRenderTargetView const *pCmd);
557int vmsvga3dDXClearDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearDepthStencilView const *pCmd);
558int vmsvga3dDXPredCopyRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopyRegion const *pCmd);
559int vmsvga3dDXPredCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
560int vmsvga3dDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext);
561int vmsvga3dDXGenMips(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXGenMips const *pCmd);
562int vmsvga3dDXDefineShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShaderResourceView const *pCmd);
563int vmsvga3dDXDestroyShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShaderResourceView const *pCmd);
564int vmsvga3dDXDefineRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRenderTargetView const *pCmd);
565int vmsvga3dDXDestroyRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRenderTargetView const *pCmd);
566int vmsvga3dDXDefineDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilView_v2 const *pCmd);
567int vmsvga3dDXDestroyDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilView const *pCmd);
568int vmsvga3dDXDefineElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dElementLayoutId elementLayoutId, uint32_t cDesc, SVGA3dInputElementDesc const *paDesc);
569int vmsvga3dDXDestroyElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext);
570int vmsvga3dDXDefineBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineBlendState const *pCmd);
571int vmsvga3dDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext);
572int vmsvga3dDXDefineDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilState const *pCmd);
573int vmsvga3dDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext);
574int vmsvga3dDXDefineRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRasterizerState const *pCmd);
575int vmsvga3dDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext);
576int vmsvga3dDXDefineSamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineSamplerState const *pCmd);
577int vmsvga3dDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext);
578int vmsvga3dDXDefineShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShader const *pCmd);
579int vmsvga3dDXDestroyShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShader const *pCmd);
580int vmsvga3dDXBindShader(PVGASTATECC pThisCC, SVGA3dCmdDXBindShader const *pCmd, PVMSVGAMOB pMob);
581int vmsvga3dDXDefineStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineStreamOutput const *pCmd);
582int vmsvga3dDXDestroyStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyStreamOutput const *pCmd);
583int vmsvga3dDXSetStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetStreamOutput const *pCmd);
584int vmsvga3dDXSetCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXSetCOTable const *pCmd, PVMSVGAMOB pMob);
585int vmsvga3dDXReadbackCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXReadbackCOTable const *pCmd);
586int vmsvga3dDXBufferCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
587int vmsvga3dDXSurfaceCopyAndReadback(PVGASTATECC pThisCC, uint32_t idDXContext);
588int vmsvga3dDXMoveQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
589int vmsvga3dDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
590int vmsvga3dDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
591int vmsvga3dDXMobFence64(PVGASTATECC pThisCC, uint32_t idDXContext);
592int vmsvga3dDXBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext);
593int vmsvga3dDXHint(PVGASTATECC pThisCC, uint32_t idDXContext);
594int vmsvga3dDXBufferUpdate(PVGASTATECC pThisCC, uint32_t idDXContext);
595int vmsvga3dDXSetVSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext);
596int vmsvga3dDXSetPSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext);
597int vmsvga3dDXSetGSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext);
598int vmsvga3dDXSetHSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext);
599int vmsvga3dDXSetDSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext);
600int vmsvga3dDXSetCSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext);
601int vmsvga3dDXCondBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext);
602int vmsvga3dScreenCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
603int vmsvga3dGrowOTable(PVGASTATECC pThisCC, uint32_t idDXContext);
604int vmsvga3dDXGrowCOTable(PVGASTATECC pThisCC, uint32_t idDXContext);
605int vmsvga3dIntraSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
606int vmsvga3dDefineGBSurface_v3(PVGASTATECC pThisCC, uint32_t idDXContext);
607int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
608int vmsvga3dDXPredResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
609int vmsvga3dDXPredConvertRegion(PVGASTATECC pThisCC, uint32_t idDXContext);
610int vmsvga3dDXPredConvert(PVGASTATECC pThisCC, uint32_t idDXContext);
611int vmsvga3dWholeSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
612int vmsvga3dDXDefineUAView(PVGASTATECC pThisCC, uint32_t idDXContext);
613int vmsvga3dDXDestroyUAView(PVGASTATECC pThisCC, uint32_t idDXContext);
614int vmsvga3dDXClearUAViewUint(PVGASTATECC pThisCC, uint32_t idDXContext);
615int vmsvga3dDXClearUAViewFloat(PVGASTATECC pThisCC, uint32_t idDXContext);
616int vmsvga3dDXCopyStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext);
617int vmsvga3dDXSetUAViews(PVGASTATECC pThisCC, uint32_t idDXContext);
618int vmsvga3dDXDrawIndexedInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext);
619int vmsvga3dDXDrawInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext);
620int vmsvga3dDXDispatch(PVGASTATECC pThisCC, uint32_t idDXContext);
621int vmsvga3dDXDispatchIndirect(PVGASTATECC pThisCC, uint32_t idDXContext);
622int vmsvga3dWriteZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext);
623int vmsvga3dHintZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext);
624int vmsvga3dDXTransferToBuffer(PVGASTATECC pThisCC, uint32_t idDXContext);
625int vmsvga3dDXSetStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext);
626int vmsvga3dLogicOpsBitBlt(PVGASTATECC pThisCC, uint32_t idDXContext);
627int vmsvga3dLogicOpsTransBlt(PVGASTATECC pThisCC, uint32_t idDXContext);
628int vmsvga3dLogicOpsStretchBlt(PVGASTATECC pThisCC, uint32_t idDXContext);
629int vmsvga3dLogicOpsColorFill(PVGASTATECC pThisCC, uint32_t idDXContext);
630int vmsvga3dLogicOpsAlphaBlend(PVGASTATECC pThisCC, uint32_t idDXContext);
631int vmsvga3dLogicOpsClearTypeBlend(PVGASTATECC pThisCC, uint32_t idDXContext);
632int vmsvga3dDefineGBSurface_v4(PVGASTATECC pThisCC, uint32_t idDXContext);
633int vmsvga3dDXSetCSUAViews(PVGASTATECC pThisCC, uint32_t idDXContext);
634int vmsvga3dDXSetMinLOD(PVGASTATECC pThisCC, uint32_t idDXContext);
635int vmsvga3dDXDefineStreamOutputWithMob(PVGASTATECC pThisCC, uint32_t idDXContext);
636int vmsvga3dDXSetShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext);
637int vmsvga3dDXBindStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext);
638int vmsvga3dSurfaceStretchBltNonMSToMS(PVGASTATECC pThisCC, uint32_t idDXContext);
639int vmsvga3dDXBindShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext);
640#endif /* VMSVGA3D_DX */
641
642
643#endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_h */
644
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