summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/VBoxD3DAdapter9.c
blob: 3413d143167142eba159a33b9bfeb5e38eaad37a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* $Id$ */
/** @file
 * VirtualBox Windows Guest Mesa3D - Gallium driver interface.
 *
 * ID3DAdapter9 C wrappers.
 */

/*
 * Copyright (C) 2016-2022 Oracle and/or its affiliates.
 *
 * This file is part of VirtualBox base platform packages, as
 * available from https://www.virtualbox.org.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, in version 3 of the
 * License.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <https://www.gnu.org/licenses>.
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#if 0
/*
 * Can't use Windows SDK headers because WINAPI is defined as empty in Mesa.
 *
 * Include mesa D3D9 headers in that order. This will prevent inclusion of d3d9.h
 * from d3dadapter9.h, because _D3D9_H_ and other guard defines will be already
 * defined by D3D9/d3d9.h, etc.
 */
#include <D3D9/d3d9types.h>
#include <D3D9/d3d9caps.h>
#include <D3D9/d3d9.h>
#ifndef _D3D9_H_
#error Gallium header did not define_D3D9_H_
#endif
#endif

#include <iprt/win/windows.h>
#include <d3d9types.h>
#include <d3d9caps.h>
#include <iprt/win/d3d9.h>
#include <d3dadapter/d3dadapter9.h>

/* ID3DAdapter9 interface has a C++ declaration. However Gallium uses C.
 * The wrappers makes sure that we are using "native" Gallium interface from WDDM C++ code.
 */

HRESULT D3DAdapter9_QueryInterface(ID3DAdapter9 *This, REFIID riid, void **ppvObject)
{
    return ID3DAdapter9_QueryInterface(This, riid, ppvObject);
}

ULONG D3DAdapter9_AddRef(ID3DAdapter9 *This)
{
    return ID3DAdapter9_AddRef(This);
}

ULONG D3DAdapter9_Release(ID3DAdapter9 *This)
{
    return ID3DAdapter9_Release(This);
}

HRESULT D3DAdapter9_GetAdapterIdentifier(ID3DAdapter9 *This, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier)
{
    return ID3DAdapter9_GetAdapterIdentifier(This, Flags, pIdentifier);
}

HRESULT D3DAdapter9_CheckDeviceType(ID3DAdapter9 *This, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed)
{
    return ID3DAdapter9_CheckDeviceType(This, DevType, AdapterFormat, BackBufferFormat, bWindowed);
}

HRESULT D3DAdapter9_CheckDeviceFormat(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat)
{
    return ID3DAdapter9_CheckDeviceFormat(This, DeviceType, AdapterFormat, Usage, RType, CheckFormat);
}

HRESULT D3DAdapter9_CheckDeviceMultiSampleType(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels)
{
    return ID3DAdapter9_CheckDeviceMultiSampleType(This, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels);
}

HRESULT D3DAdapter9_CheckDepthStencilMatch(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat)
{
    return ID3DAdapter9_CheckDepthStencilMatch(This, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
}

HRESULT D3DAdapter9_CheckDeviceFormatConversion(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat)
{
    return ID3DAdapter9_CheckDeviceFormatConversion(This, DeviceType, SourceFormat, TargetFormat);
}

HRESULT D3DAdapter9_GetDeviceCaps(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps)
{
    return ID3DAdapter9_GetDeviceCaps(This, DeviceType, pCaps);
}

HRESULT D3DAdapter9_CreateDevice(ID3DAdapter9 *This, UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9 **ppReturnedDeviceInterface)
{
    return ID3DAdapter9_CreateDevice(This, RealAdapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pD3D9, pPresentationFactory, ppReturnedDeviceInterface);
}

HRESULT D3DAdapter9_CreateDeviceEx(ID3DAdapter9 *This, UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3D9Ex *pD3D9Ex, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9Ex **ppReturnedDeviceInterface)
{
    return ID3DAdapter9_CreateDeviceEx(This, RealAdapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, pD3D9Ex, pPresentationFactory, ppReturnedDeviceInterface);
}