Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 1 | // Copyright 2016 The SwiftShader Authors. All Rights Reserved. |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 2 | // |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 6 | // |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 8 | // |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 14 | |
| 15 | #ifndef D3D9_Direct3D9Ex_hpp |
| 16 | #define D3D9_Direct3D9Ex_hpp |
| 17 | |
| 18 | #include "Direct3D9.hpp" |
| 19 | |
| 20 | //#include <stdio.h> |
| 21 | #include <d3d9.h> |
| 22 | |
| 23 | namespace D3D9 |
| 24 | { |
| 25 | class Direct3DDevice9; |
| 26 | |
| 27 | class Direct3D9Ex : public IDirect3D9Ex, public Direct3D9 |
| 28 | { |
| 29 | public: |
| 30 | Direct3D9Ex(int version, const HINSTANCE instance); |
| 31 | |
Nicolas Capens | 3b9e1ea | 2017-06-12 12:43:48 -0400 | [diff] [blame] | 32 | ~Direct3D9Ex() override; |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 33 | |
| 34 | // IUnknown methods |
Nicolas Capens | 3b9e1ea | 2017-06-12 12:43:48 -0400 | [diff] [blame] | 35 | long __stdcall QueryInterface(const IID &iid, void **object) override; |
| 36 | unsigned long __stdcall AddRef() override; |
| 37 | unsigned long __stdcall Release() override; |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 38 | |
| 39 | // IDirect3D9 methods |
Nicolas Capens | 3b9e1ea | 2017-06-12 12:43:48 -0400 | [diff] [blame] | 40 | long __stdcall RegisterSoftwareDevice(void *initializeFunction) override; |
| 41 | unsigned int __stdcall GetAdapterCount() override; |
| 42 | long __stdcall GetAdapterIdentifier(unsigned int adapter, unsigned long flags, D3DADAPTER_IDENTIFIER9 *identifier) override; |
| 43 | unsigned int __stdcall GetAdapterModeCount(unsigned int adapter, D3DFORMAT format) override; |
| 44 | long __stdcall EnumAdapterModes(unsigned int adapter, D3DFORMAT format, unsigned int index, D3DDISPLAYMODE *mode) override; |
| 45 | long __stdcall GetAdapterDisplayMode(unsigned int adapter, D3DDISPLAYMODE *mode) override; |
| 46 | long __stdcall CheckDeviceType(unsigned int adapter, D3DDEVTYPE checkType, D3DFORMAT displayFormat, D3DFORMAT backBufferFormat, int windowed) override; |
| 47 | long __stdcall CheckDeviceFormat(unsigned int adapter, D3DDEVTYPE deviceType, D3DFORMAT adapterFormat, unsigned long usage, D3DRESOURCETYPE type, D3DFORMAT checkFormat) override; |
| 48 | long __stdcall CheckDeviceMultiSampleType(unsigned int adapter, D3DDEVTYPE deviceType, D3DFORMAT surfaceFormat, int windowed, D3DMULTISAMPLE_TYPE multiSampleType, unsigned long *qualityLevels) override; |
| 49 | long __stdcall CheckDepthStencilMatch(unsigned int adapter, D3DDEVTYPE deviceType, D3DFORMAT adapterFormat, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat) override; |
| 50 | long __stdcall CheckDeviceFormatConversion(unsigned int adapter, D3DDEVTYPE deviceType, D3DFORMAT sourceFormat, D3DFORMAT targetFormat) override; |
| 51 | long __stdcall GetDeviceCaps(unsigned int adapter, D3DDEVTYPE deviceType, D3DCAPS9 *caps) override; |
| 52 | HMONITOR __stdcall GetAdapterMonitor(unsigned int adapter) override; |
| 53 | long __stdcall CreateDevice(unsigned int adapter, D3DDEVTYPE deviceType, HWND focusWindow, unsigned long behaviorFlags, D3DPRESENT_PARAMETERS *presentParameters, IDirect3DDevice9 **returnedDeviceInterface) override; |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 54 | |
| 55 | // IDirect3D9Ex methods |
Nicolas Capens | 3b9e1ea | 2017-06-12 12:43:48 -0400 | [diff] [blame] | 56 | unsigned int __stdcall GetAdapterModeCountEx(unsigned int adapter, const D3DDISPLAYMODEFILTER *filter) override; |
| 57 | long __stdcall EnumAdapterModesEx(unsigned int adapter, const D3DDISPLAYMODEFILTER *filter, unsigned int index, D3DDISPLAYMODEEX *mode) override; |
| 58 | long __stdcall GetAdapterDisplayModeEx(unsigned int adapter, D3DDISPLAYMODEEX *mode, D3DDISPLAYROTATION *rotation) override; |
| 59 | long __stdcall CreateDeviceEx(unsigned int adapter, D3DDEVTYPE deviceType, HWND focusWindow, DWORD behaviorFlags, D3DPRESENT_PARAMETERS *presentParameters, D3DDISPLAYMODEEX *fullscreenDisplayMode, IDirect3DDevice9Ex **returnedDeviceInterface) override; |
| 60 | long __stdcall GetAdapterLUID(unsigned int adapter, LUID *luid) override; |
Nicolas Capens | ee16f0d | 2015-07-16 17:40:10 -0400 | [diff] [blame] | 61 | |
| 62 | private: |
| 63 | void loadSystemD3D9ex(); |
| 64 | |
| 65 | // Real IDirect3D9Ex object |
| 66 | IDirect3D9Ex *d3d9ex; |
| 67 | }; |
| 68 | } |
| 69 | |
| 70 | #endif // D3D9_Direct3D9Ex_hpp |