blob: bc514a3b89a6446f1f33609eb57765f17299d018 [file] [log] [blame]
Nicolas Capens17b29fd2016-09-15 09:32:16 -04001// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2//
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
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
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.
14
15#ifndef D3D8_Direct3D8_hpp
16#define D3D8_Direct3D8_hpp
17
18#include "Unknown.hpp"
19
20#include <stdio.h>
21#include <initguid.h>
22#include <d3d8.h>
23
24namespace D3D8
25{
26 class Direct3DDevice8;
27
28 class Direct3D8 : public IDirect3D8, protected Unknown
29 {
30 public:
31 Direct3D8(int version, const HINSTANCE instance);
32
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040033 ~Direct3D8() override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040034
35 // IUnknown methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040036 long __stdcall QueryInterface(const IID &iid, void **object) override;
37 unsigned long __stdcall AddRef() override;
38 unsigned long __stdcall Release() override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040039
40 // IDirect3D8 methods
Nicolas Capens3b9e1ea2017-06-12 12:43:48 -040041 long __stdcall CheckDepthStencilMatch(unsigned int adapter, D3DDEVTYPE deviceType, D3DFORMAT adapterFormat, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat) override;
42 long __stdcall CheckDeviceFormat(unsigned int adapter, D3DDEVTYPE deviceType, D3DFORMAT adapaterFormat, unsigned long usage, D3DRESOURCETYPE type, D3DFORMAT checkFormat) override;
43 long __stdcall CheckDeviceMultiSampleType(unsigned int adapter, D3DDEVTYPE deviceType, D3DFORMAT surfaceFormat, int windowed, D3DMULTISAMPLE_TYPE multiSampleType) override;
44 long __stdcall CheckDeviceType(unsigned int adapter, D3DDEVTYPE checkType, D3DFORMAT displayFormat, D3DFORMAT backBufferFormat, int windowed) override;
45 long __stdcall CreateDevice(unsigned int adapter, D3DDEVTYPE deviceType, HWND focusWindow, unsigned long behaviorFlags, D3DPRESENT_PARAMETERS *presentParameters, IDirect3DDevice8 **returnedDeviceInterface) override;
46 long __stdcall EnumAdapterModes(unsigned int adapter, unsigned int index, D3DDISPLAYMODE *mode) override;
47 unsigned int __stdcall GetAdapterCount() override;
48 long __stdcall GetAdapterDisplayMode(unsigned int adapter, D3DDISPLAYMODE *mode) override;
49 long __stdcall GetAdapterIdentifier(unsigned int adapter, unsigned long flags, D3DADAPTER_IDENTIFIER8 *identifier) override;
50 unsigned int __stdcall GetAdapterModeCount(unsigned int adapter) override;
51 HMONITOR __stdcall GetAdapterMonitor(unsigned int adapter) override;
52 long __stdcall GetDeviceCaps(unsigned int adapter, D3DDEVTYPE deviceType, D3DCAPS8 *caps) override;
53 long __stdcall RegisterSoftwareDevice(void *initializeFunction) override;
Nicolas Capens17b29fd2016-09-15 09:32:16 -040054
55 private:
56 void loadSystemD3D8();
57
58 // Creation parameters
59 const int version;
60 const HINSTANCE instance;
61
62 DEVMODE *displayMode;
63 int numDisplayModes;
64
65 // Real D3D8 library and IDirect3D8 object
66 HMODULE d3d8Lib;
67 IDirect3D8 *d3d8;
68 };
69}
70
71#endif // D3D8_Direct3D8_hpp