Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
VideoDX9Enum.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: VideoDX9Enum.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Direct3D and Direct3D Video classes for DirectX 7
13 */
14 
15 #ifndef VideoDX9Enum_h
16 #define VideoDX9Enum_h
17 
18 #include <d3d9.h>
19 
20 #include "Video.h"
21 #include "List.h"
22 #include <vector>
23 
24 // +--------------------------------------------------------------------+
25 
26 class VideoDX9Enum;
27 struct VideoDX9DisplayMode;
28 struct VideoDX9AdapterInfo;
29 struct VideoDX9DeviceInfo;
30 struct VideoDX9DSMSConflict;
31 struct VideoDX9DeviceCombo;
32 class VideoSettings;
33 
34 // +--------------------------------------------------------------------+
35 
37 {
38 public:
39  enum VP_TYPE {
44  };
45 
46  VideoDX9Enum(IDirect3D9* d3d9);
47  ~VideoDX9Enum();
48 
49  void SetDirect3D9(IDirect3D9* d3d9);
50 
51  HRESULT Enumerate();
54 
55  int NumAdapters() const { return adapter_info_list.size(); }
56  void SelectAdapter(int index);
58  VideoDX9DeviceInfo* GetDeviceInfo(DWORD devtype);
59 
60  bool IsModeSupported(int width, int height, int bpp) const;
61 
62  UINT min_width;
63  UINT min_height;
68 
73 
74 private:
75  HRESULT EnumerateDevices(VideoDX9AdapterInfo* adapter_info, std::vector<D3DFORMAT>& adapter_format_list);
76  HRESULT EnumerateDeviceCombos(VideoDX9DeviceInfo* device_info, std::vector<D3DFORMAT>& adapter_format_list);
77 
78  void BuildDepthStencilFormatList(VideoDX9DeviceCombo* device_combo);
79  void BuildMultiSampleTypeList(VideoDX9DeviceCombo* device_combo);
80  void BuildDSMSConflictList(VideoDX9DeviceCombo* device_combo);
81  void BuildVertexProcessingTypeList(VideoDX9DeviceInfo* device_info, VideoDX9DeviceCombo* device_combo);
82  void BuildPresentIntervalList(VideoDX9DeviceInfo* device_info, VideoDX9DeviceCombo* device_combo);
83 
84  IDirect3D9* d3d;
85  std::vector<D3DFORMAT> allowed_adapter_format_list;
86 
87  List<VideoDX9AdapterInfo> adapter_info_list;
88  int adapter_index;
89 };
90 
91 
92 // +--------------------------------------------------------------------+
93 
95 {
96  static const char* TYPENAME() { return "VideoDX9AdapterInfo"; }
97 
100 
101  const char* GetDescription() const;
102 
104  D3DADAPTER_IDENTIFIER9 adapter_identifier;
107 };
108 
109 
110 // +--------------------------------------------------------------------+
111 
113 {
114  static const char* TYPENAME() { return "VideoDX9DisplayMode"; }
115 
118  VideoDX9DisplayMode(const D3DDISPLAYMODE& m);
119 
120  int operator<(const VideoDX9DisplayMode& m) const;
121  int operator<=(const VideoDX9DisplayMode& m) const;
122 
123  const char* GetDescription() const;
124  static const char* D3DFormatToString(D3DFORMAT format);
125 
126  UINT width;
127  UINT height;
128  UINT refresh;
129  D3DFORMAT format;
130 };
131 
132 
133 // +--------------------------------------------------------------------+
134 
136 {
137  static const char* TYPENAME() { return "VideoDX9DeviceInfo"; }
138 
141 
143  D3DDEVTYPE device_type;
144  D3DCAPS9 caps;
146 };
147 
148 
149 // +--------------------------------------------------------------------+
150 
152 {
153  static const char* TYPENAME() { return "VideoDX9FormatConflict"; }
154 
155  D3DFORMAT ds_format;
156  D3DMULTISAMPLE_TYPE multisample_type;
157 };
158 
159 
160 // +--------------------------------------------------------------------+
161 
163 {
166 
168  D3DDEVTYPE device_type;
169  D3DFORMAT adapter_format;
172 
173  std::vector<int> vertex_processing_list;
174  std::vector<D3DFORMAT> depth_stencil_fmt_list;
175  std::vector<D3DMULTISAMPLE_TYPE> multisample_type_list;
176  std::vector<DWORD> multisample_qual_list;
177  std::vector<DWORD> present_interval_list;
178 
180 };
181 
182 // +--------------------------------------------------------------------+
183 
184 #endif VideoDX9Enum_h
185