source: GTP/trunk/App/Demos/Illum/RayTraceEffects/Common/DXUTenum.h @ 755

Revision 755, 7.5 KB checked in by szirmay, 19 years ago (diff)

Added a folder remotely

Line 
1//--------------------------------------------------------------------------------------
2// File: DXUTEnum.h
3//
4// Enumerates D3D adapters, devices, modes, etc.
5//
6// Copyright (c) Microsoft Corporation. All rights reserved.
7//--------------------------------------------------------------------------------------
8#pragma once
9#ifndef DXUT_ENUM_H
10#define DXUT_ENUM_H
11
12//--------------------------------------------------------------------------------------
13// Forward declarations
14//--------------------------------------------------------------------------------------
15class CD3DEnumAdapterInfo;
16class CD3DEnumDeviceInfo;
17struct CD3DEnumDeviceSettingsCombo;
18struct CD3DEnumDSMSConflict;
19
20
21//--------------------------------------------------------------------------------------
22// Enumerates available Direct3D adapters, devices, modes, etc.
23// Use DXUTGetEnumeration() to access global instance
24//--------------------------------------------------------------------------------------
25class CD3DEnumeration
26{
27public:
28    // These should be called before Enumerate().
29    //
30    // Use these calls and the IsDeviceAcceptable to control the contents of
31    // the enumeration object, which affects the device selection and the device settings dialog.
32    void SetRequirePostPixelShaderBlending( bool bRequire ) { m_bRequirePostPixelShaderBlending = bRequire; }
33    void SetResolutionMinMax( UINT nMinWidth, UINT nMinHeight, UINT nMaxWidth, UINT nMaxHeight ); 
34    void SetRefreshMinMax( UINT nMin, UINT nMax );
35    void SetMultisampleQualityMax( UINT nMax );   
36    void GetPossibleVertexProcessingList( bool* pbSoftwareVP, bool* pbHardwareVP, bool* pbPureHarewareVP, bool* pbMixedVP );
37    void SetPossibleVertexProcessingList( bool bSoftwareVP, bool bHardwareVP, bool bPureHarewareVP, bool bMixedVP );
38    CGrowableArray<D3DFORMAT>* GetPossibleDepthStencilFormatList();   
39    CGrowableArray<D3DMULTISAMPLE_TYPE>* GetPossibleMultisampleTypeList();   
40    CGrowableArray<UINT>* GetPossiblePresentIntervalList();
41    void ResetPossibleDepthStencilFormats();
42    void ResetPossibleMultisampleTypeList();
43    void ResetPossiblePresentIntervalList();
44
45    // Call Enumerate() to enumerate available D3D adapters, devices, modes, etc.
46    HRESULT Enumerate( IDirect3D9* pD3D = NULL,
47                       LPDXUTCALLBACKISDEVICEACCEPTABLE IsDeviceAcceptableFunc = NULL );
48
49    // These should be called after Enumerate() is called
50    CGrowableArray<CD3DEnumAdapterInfo*>*   GetAdapterInfoList(); 
51    CD3DEnumAdapterInfo*                    GetAdapterInfo( UINT AdapterOrdinal ); 
52    CD3DEnumDeviceInfo*                     GetDeviceInfo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType );   
53    CD3DEnumDeviceSettingsCombo*            GetDeviceSettingsCombo( DXUTDeviceSettings* pDeviceSettings ) { return GetDeviceSettingsCombo( pDeviceSettings->AdapterOrdinal, pDeviceSettings->DeviceType, pDeviceSettings->AdapterFormat, pDeviceSettings->pp.BackBufferFormat, pDeviceSettings->pp.Windowed ); }
54    CD3DEnumDeviceSettingsCombo*            GetDeviceSettingsCombo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL Windowed ); 
55
56    ~CD3DEnumeration();
57
58private:
59    friend CD3DEnumeration* DXUTGetEnumeration();
60
61    // Use DXUTGetEnumeration() to access global instance
62    CD3DEnumeration();
63
64    IDirect3D9* m_pD3D;                                   
65    LPDXUTCALLBACKISDEVICEACCEPTABLE m_IsDeviceAcceptableFunc;
66    bool m_bRequirePostPixelShaderBlending;
67    CGrowableArray<D3DFORMAT> m_DepthStecilPossibleList;
68    CGrowableArray<D3DMULTISAMPLE_TYPE> m_MultiSampleTypeList;
69    CGrowableArray<UINT> m_PresentIntervalList;
70
71    bool m_bSoftwareVP;
72    bool m_bHardwareVP;
73    bool m_bPureHarewareVP;
74    bool m_bMixedVP;
75
76    UINT m_nMinWidth;
77    UINT m_nMaxWidth;
78    UINT m_nMinHeight;
79    UINT m_nMaxHeight;
80    UINT m_nRefreshMin;
81    UINT m_nRefreshMax;
82    UINT m_nMultisampleQualityMax;
83
84    // Array of CD3DEnumAdapterInfo* with unique AdapterOrdinals
85    CGrowableArray<CD3DEnumAdapterInfo*> m_AdapterInfoList; 
86
87    HRESULT EnumerateDevices( CD3DEnumAdapterInfo* pAdapterInfo, CGrowableArray<D3DFORMAT>* pAdapterFormatList );
88    HRESULT EnumerateDeviceCombos( CD3DEnumAdapterInfo* pAdapterInfo, CD3DEnumDeviceInfo* pDeviceInfo, CGrowableArray<D3DFORMAT>* pAdapterFormatList );
89    void BuildDepthStencilFormatList( CD3DEnumDeviceSettingsCombo* pDeviceCombo );
90    void BuildMultiSampleTypeList( CD3DEnumDeviceSettingsCombo* pDeviceCombo );
91    void BuildDSMSConflictList( CD3DEnumDeviceSettingsCombo* pDeviceCombo );
92    void BuildPresentIntervalList( CD3DEnumDeviceInfo* pDeviceInfo, CD3DEnumDeviceSettingsCombo* pDeviceCombo );
93    void ClearAdapterInfoList();
94};
95
96CD3DEnumeration* DXUTGetEnumeration();
97
98
99//--------------------------------------------------------------------------------------
100// A class describing an adapter which contains a unique adapter ordinal
101// that is installed on the system
102//--------------------------------------------------------------------------------------
103class CD3DEnumAdapterInfo
104{
105public:
106    ~CD3DEnumAdapterInfo();
107
108    UINT AdapterOrdinal;
109    D3DADAPTER_IDENTIFIER9 AdapterIdentifier;
110    WCHAR szUniqueDescription[256];
111
112    CGrowableArray<D3DDISPLAYMODE> displayModeList; // Array of supported D3DDISPLAYMODEs
113    CGrowableArray<CD3DEnumDeviceInfo*> deviceInfoList; // Array of CD3DEnumDeviceInfo* with unique supported DeviceTypes
114};
115
116
117//--------------------------------------------------------------------------------------
118// A class describing a Direct3D device that contains a
119//       unique supported device type
120//--------------------------------------------------------------------------------------
121class CD3DEnumDeviceInfo
122{
123public:
124    ~CD3DEnumDeviceInfo();
125
126    UINT AdapterOrdinal;
127    D3DDEVTYPE DeviceType;
128    D3DCAPS9 Caps;
129
130    // List of CD3DEnumDeviceSettingsCombo* with a unique set
131    // of AdapterFormat, BackBufferFormat, and Windowed
132    CGrowableArray<CD3DEnumDeviceSettingsCombo*> deviceSettingsComboList;
133};
134
135
136//--------------------------------------------------------------------------------------
137// A struct describing device settings that contains a unique combination of
138// adapter format, back buffer format, and windowed that is compatible with a
139// particular Direct3D device and the app.
140//--------------------------------------------------------------------------------------
141struct CD3DEnumDeviceSettingsCombo
142{
143    UINT AdapterOrdinal;
144    D3DDEVTYPE DeviceType;
145    D3DFORMAT AdapterFormat;
146    D3DFORMAT BackBufferFormat;
147    BOOL Windowed;
148
149    CGrowableArray<D3DFORMAT> depthStencilFormatList; // List of D3DFORMATs
150    CGrowableArray<D3DMULTISAMPLE_TYPE> multiSampleTypeList; // List of D3DMULTISAMPLE_TYPEs
151    CGrowableArray<DWORD> multiSampleQualityList; // List of number of quality levels for each multisample type
152    CGrowableArray<UINT> presentIntervalList; // List of D3DPRESENT flags
153    CGrowableArray<CD3DEnumDSMSConflict> DSMSConflictList; // List of CD3DEnumDSMSConflict
154
155    CD3DEnumAdapterInfo* pAdapterInfo;
156    CD3DEnumDeviceInfo* pDeviceInfo;
157};
158
159
160//--------------------------------------------------------------------------------------
161// A depth/stencil buffer format that is incompatible with a
162// multisample type.
163//--------------------------------------------------------------------------------------
164struct CD3DEnumDSMSConflict
165{
166    D3DFORMAT DSFormat;
167    D3DMULTISAMPLE_TYPE MSType;
168};
169
170
171#endif
Note: See TracBrowser for help on using the repository browser.