1 | /* $Id: VBoxD3DAdapter9.c 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Windows Guest Mesa3D - Gallium driver interface.
|
---|
4 | *
|
---|
5 | * ID3DAdapter9 C wrappers.
|
---|
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 | #if 0
|
---|
31 | /*
|
---|
32 | * Can't use Windows SDK headers because WINAPI is defined as empty in Mesa.
|
---|
33 | *
|
---|
34 | * Include mesa D3D9 headers in that order. This will prevent inclusion of d3d9.h
|
---|
35 | * from d3dadapter9.h, because _D3D9_H_ and other guard defines will be already
|
---|
36 | * defined by D3D9/d3d9.h, etc.
|
---|
37 | */
|
---|
38 | #include <D3D9/d3d9types.h>
|
---|
39 | #include <D3D9/d3d9caps.h>
|
---|
40 | #include <D3D9/d3d9.h>
|
---|
41 | #ifndef _D3D9_H_
|
---|
42 | #error Gallium header did not define_D3D9_H_
|
---|
43 | #endif
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #include <iprt/win/windows.h>
|
---|
47 | #include <d3d9types.h>
|
---|
48 | #include <d3d9caps.h>
|
---|
49 | #include <iprt/win/d3d9.h>
|
---|
50 | #include <d3dadapter/d3dadapter9.h>
|
---|
51 |
|
---|
52 | /* ID3DAdapter9 interface has a C++ declaration. However Gallium uses C.
|
---|
53 | * The wrappers makes sure that we are using "native" Gallium interface from WDDM C++ code.
|
---|
54 | */
|
---|
55 |
|
---|
56 | HRESULT D3DAdapter9_QueryInterface(ID3DAdapter9 *This, REFIID riid, void **ppvObject)
|
---|
57 | {
|
---|
58 | return ID3DAdapter9_QueryInterface(This, riid, ppvObject);
|
---|
59 | }
|
---|
60 |
|
---|
61 | ULONG D3DAdapter9_AddRef(ID3DAdapter9 *This)
|
---|
62 | {
|
---|
63 | return ID3DAdapter9_AddRef(This);
|
---|
64 | }
|
---|
65 |
|
---|
66 | ULONG D3DAdapter9_Release(ID3DAdapter9 *This)
|
---|
67 | {
|
---|
68 | return ID3DAdapter9_Release(This);
|
---|
69 | }
|
---|
70 |
|
---|
71 | HRESULT D3DAdapter9_GetAdapterIdentifier(ID3DAdapter9 *This, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier)
|
---|
72 | {
|
---|
73 | return ID3DAdapter9_GetAdapterIdentifier(This, Flags, pIdentifier);
|
---|
74 | }
|
---|
75 |
|
---|
76 | HRESULT D3DAdapter9_CheckDeviceType(ID3DAdapter9 *This, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed)
|
---|
77 | {
|
---|
78 | return ID3DAdapter9_CheckDeviceType(This, DevType, AdapterFormat, BackBufferFormat, bWindowed);
|
---|
79 | }
|
---|
80 |
|
---|
81 | HRESULT D3DAdapter9_CheckDeviceFormat(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat)
|
---|
82 | {
|
---|
83 | return ID3DAdapter9_CheckDeviceFormat(This, DeviceType, AdapterFormat, Usage, RType, CheckFormat);
|
---|
84 | }
|
---|
85 |
|
---|
86 | HRESULT D3DAdapter9_CheckDeviceMultiSampleType(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels)
|
---|
87 | {
|
---|
88 | return ID3DAdapter9_CheckDeviceMultiSampleType(This, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels);
|
---|
89 | }
|
---|
90 |
|
---|
91 | HRESULT D3DAdapter9_CheckDepthStencilMatch(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat)
|
---|
92 | {
|
---|
93 | return ID3DAdapter9_CheckDepthStencilMatch(This, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
|
---|
94 | }
|
---|
95 |
|
---|
96 | HRESULT D3DAdapter9_CheckDeviceFormatConversion(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat)
|
---|
97 | {
|
---|
98 | return ID3DAdapter9_CheckDeviceFormatConversion(This, DeviceType, SourceFormat, TargetFormat);
|
---|
99 | }
|
---|
100 |
|
---|
101 | HRESULT D3DAdapter9_GetDeviceCaps(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps)
|
---|
102 | {
|
---|
103 | return ID3DAdapter9_GetDeviceCaps(This, DeviceType, pCaps);
|
---|
104 | }
|
---|
105 |
|
---|
106 | HRESULT D3DAdapter9_CreateDevice(ID3DAdapter9 *This, UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9 **ppReturnedDeviceInterface)
|
---|
107 | {
|
---|
108 | return ID3DAdapter9_CreateDevice(This, RealAdapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pD3D9, pPresentationFactory, ppReturnedDeviceInterface);
|
---|
109 | }
|
---|
110 |
|
---|
111 | HRESULT D3DAdapter9_CreateDeviceEx(ID3DAdapter9 *This, UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3D9Ex *pD3D9Ex, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9Ex **ppReturnedDeviceInterface)
|
---|
112 | {
|
---|
113 | return ID3DAdapter9_CreateDeviceEx(This, RealAdapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, pD3D9Ex, pPresentationFactory, ppReturnedDeviceInterface);
|
---|
114 | }
|
---|