VirtualBox

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

Last change on this file since 89442 was 89163, checked in by vboxsync, 4 years ago

Devices/Graphics: Build new and old 3D backend. bugref:9830

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