VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/VBoxGaD3DDevice9Ex.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.4 KB
Line 
1/* $Id: VBoxGaD3DDevice9Ex.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VirtualBox Windows Guest Mesa3D - Gallium driver interface.
4 *
5 * GaDirect3DDevice9Ex implements IDirect3DDevice9Ex wrapper.
6 */
7
8/*
9 * Copyright (C) 2016-2023 Oracle and/or its affiliates.
10 *
11 * This file is part of VirtualBox base platform packages, as
12 * available from https://www.virtualbox.org.
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation, in version 3 of the
17 * License.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see <https://www.gnu.org/licenses>.
26 *
27 * SPDX-License-Identifier: GPL-3.0-only
28 */
29
30#ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_VBoxGaD3DDevice9Ex_h
31#define GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_VBoxGaD3DDevice9Ex_h
32#ifndef RT_WITHOUT_PRAGMA_ONCE
33# pragma once
34#endif
35
36#include "VBoxPresent.h"
37#include "VBoxGallium.h"
38
39class GaDirect3DDevice9Ex: public IGaDirect3DDevice9Ex
40{
41 public:
42 GaDirect3DDevice9Ex(IGaDirect3D9Ex *pD3D9Ex,
43 HANDLE hAdapter,
44 HANDLE hDevice,
45 const D3DDDI_DEVICECALLBACKS *pDeviceCallbacks);
46 virtual ~GaDirect3DDevice9Ex();
47
48 HRESULT Init(D3DDEVTYPE DeviceType,
49 HWND hFocusWindow,
50 DWORD BehaviorFlags,
51 D3DPRESENT_PARAMETERS* pPresentationParameters,
52 D3DDISPLAYMODEEX* pFullscreenDisplayMode);
53
54 /* IUnknown methods */
55 STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj);
56 STDMETHOD_(ULONG,AddRef)(THIS);
57 STDMETHOD_(ULONG,Release)(THIS);
58
59 /* IDirect3DDevice9Ex methods */
60 STDMETHOD(TestCooperativeLevel)(THIS);
61 STDMETHOD_(UINT, GetAvailableTextureMem)(THIS);
62 STDMETHOD(EvictManagedResources)(THIS);
63 STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9);
64 STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps);
65 STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode);
66 STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters);
67 STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap);
68 STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags);
69 STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow);
70 STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain);
71 STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain);
72 STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS);
73 STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters);
74 STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
75 STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer);
76 STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus);
77 STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs);
78 STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp);
79 STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp);
80 STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle);
81 STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle);
82 STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle);
83 STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle);
84 STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle);
85 STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
86 STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
87 STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint);
88 STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture);
89 STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface);
90 STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface);
91 STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter);
92 STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color);
93 STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
94 STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget);
95 STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget);
96 STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil);
97 STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface);
98 STDMETHOD(BeginScene)(THIS);
99 STDMETHOD(EndScene)(THIS);
100 STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil);
101 STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix);
102 STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix);
103 STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*);
104 STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport);
105 STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport);
106 STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial);
107 STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial);
108 STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*);
109 STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*);
110 STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable);
111 STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable);
112 STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane);
113 STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane);
114 STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value);
115 STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue);
116 STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB);
117 STDMETHOD(BeginStateBlock)(THIS);
118 STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB);
119 STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus);
120 STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus);
121 STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture);
122 STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture);
123 STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue);
124 STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value);
125 STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue);
126 STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value);
127 STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses);
128 STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries);
129 STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries);
130 STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber);
131 STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber);
132 STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect);
133 STDMETHOD(GetScissorRect)(THIS_ RECT* pRect);
134 STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware);
135 STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS);
136 STDMETHOD(SetNPatchMode)(THIS_ float nSegments);
137 STDMETHOD_(float, GetNPatchMode)(THIS);
138 STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount);
139 STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
140 STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
141 STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
142 STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags);
143 STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl);
144 STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl);
145 STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl);
146 STDMETHOD(SetFVF)(THIS_ DWORD FVF);
147 STDMETHOD(GetFVF)(THIS_ DWORD* pFVF);
148 STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader);
149 STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader);
150 STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader);
151 STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount);
152 STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount);
153 STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount);
154 STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount);
155 STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount);
156 STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
157 STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride);
158 STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride);
159 STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting);
160 STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting);
161 STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData);
162 STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData);
163 STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader);
164 STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader);
165 STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader);
166 STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount);
167 STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount);
168 STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount);
169 STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount);
170 STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount);
171 STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
172 STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo);
173 STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo);
174 STDMETHOD(DeletePatch)(THIS_ UINT Handle);
175 STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery);
176 STDMETHOD(SetConvolutionMonoKernel)(THIS_ UINT width,UINT height,float* rows,float* columns);
177 STDMETHOD(ComposeRects)(THIS_ IDirect3DSurface9* pSrc,IDirect3DSurface9* pDst,IDirect3DVertexBuffer9* pSrcRectDescs,UINT NumRects,IDirect3DVertexBuffer9* pDstRectDescs,D3DCOMPOSERECTSOP Operation,int Xoffset,int Yoffset);
178 STDMETHOD(PresentEx)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags);
179 STDMETHOD(GetGPUThreadPriority)(THIS_ INT* pPriority);
180 STDMETHOD(SetGPUThreadPriority)(THIS_ INT Priority);
181 STDMETHOD(WaitForVBlank)(THIS_ UINT iSwapChain);
182 STDMETHOD(CheckResourceResidency)(THIS_ IDirect3DResource9** pResourceArray,UINT32 NumResources);
183 STDMETHOD(SetMaximumFrameLatency)(THIS_ UINT MaxLatency);
184 STDMETHOD(GetMaximumFrameLatency)(THIS_ UINT* pMaxLatency);
185 STDMETHOD(CheckDeviceState)(THIS_ HWND hDestinationWindow);
186 STDMETHOD(CreateRenderTargetEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage);
187 STDMETHOD(CreateOffscreenPlainSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage);
188 STDMETHOD(CreateDepthStencilSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage);
189 STDMETHOD(ResetEx)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX *pFullscreenDisplayMode);
190 STDMETHOD(GetDisplayModeEx)(THIS_ UINT iSwapChain,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation);
191
192 /* IGaDirect3DDevice9Ex methods. */
193 STDMETHOD(EscapeCb)(const void *pvData, uint32_t cbData, bool fHardwareAccess);
194 STDMETHOD(GaSurfaceId)(THIS_ IUnknown *pSurface, uint32_t *pu32Sid);
195 STDMETHOD(GaWDDMContextHandle)(HANDLE *phContext);
196 STDMETHOD(GaFlush)();
197
198 private:
199 void cleanup();
200
201 volatile ULONG mcRefs;
202
203 HANDLE mhAdapter;
204 HANDLE mhDevice;
205 D3DDDI_DEVICECALLBACKS mDeviceCallbacks;
206
207 IGaDirect3D9Ex *mpD3D9Ex;
208 IGalliumStack *mpStack;
209 ID3DPresentGroup *mpPresentationGroup;
210 IDirect3DDevice9Ex *mpDevice;
211};
212
213#endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_VBoxGaD3DDevice9Ex_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use