1 //--------------------------------------------------------------------------------------
\r
2 // File: DXUTSettingsDlg.cpp
\r
4 // Dialog for selection of device settings
\r
6 // Copyright (c) Microsoft Corporation. All rights reserved
\r
7 //--------------------------------------------------------------------------------------
\r
10 #include "DXUTsettingsDlg.h"
\r
11 #undef min // use __min instead
\r
12 #undef max // use __max instead
\r
15 //--------------------------------------------------------------------------------------
\r
16 // Internal functions forward declarations
\r
17 //--------------------------------------------------------------------------------------
\r
18 WCHAR* DXUTAPIVersionToString( DXUTDeviceVersion version );
\r
19 WCHAR* DXUTPresentIntervalToString( UINT pi );
\r
20 WCHAR* DXUTMultisampleTypeToString( D3DMULTISAMPLE_TYPE MultiSampleType );
\r
21 WCHAR* DXUTD3DDeviceTypeToString( D3DDEVTYPE devType );
\r
22 WCHAR* DXUTD3DX11DeviceTypeToString( D3D_DRIVER_TYPE devType );
\r
23 WCHAR* DXUTVertexProcessingTypeToString( DWORD vpt );
\r
26 HRESULT DXUTSnapDeviceSettingsToEnumDevice( DXUTDeviceSettings* pDeviceSettings, bool forceEnum, D3D_FEATURE_LEVEL forceFL = D3D_FEATURE_LEVEL(0) );
\r
28 //--------------------------------------------------------------------------------------
\r
30 //--------------------------------------------------------------------------------------
\r
31 DXUTDeviceSettings g_DeviceSettings;
\r
33 CD3DSettingsDlg* WINAPI DXUTGetD3DSettingsDialog()
\r
35 // Using an accessor function gives control of the construction order
\r
36 static CD3DSettingsDlg dlg;
\r
41 //--------------------------------------------------------------------------------------
\r
42 CD3DSettingsDlg::CD3DSettingsDlg()
\r
44 m_pStateBlock = NULL;
\r
46 m_pActiveDialog = NULL;
\r
48 m_Levels[0] = D3D_FEATURE_LEVEL_9_1;
\r
49 m_Levels[1] = D3D_FEATURE_LEVEL_9_2;
\r
50 m_Levels[2] = D3D_FEATURE_LEVEL_9_3;
\r
51 m_Levels[3] = D3D_FEATURE_LEVEL_10_0;
\r
52 m_Levels[4] = D3D_FEATURE_LEVEL_10_1;
\r
53 m_Levels[5] = D3D_FEATURE_LEVEL_11_0;
\r
58 //--------------------------------------------------------------------------------------
\r
59 CD3DSettingsDlg::~CD3DSettingsDlg()
\r
61 // Release the memory used to hold the D3D11 refresh data in the combo box
\r
62 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_REFRESH_RATE );
\r
64 for( UINT i = 0; i < pComboBox->GetNumItems(); ++i )
\r
66 DXGI_RATIONAL* pRate = reinterpret_cast<DXGI_RATIONAL*>( pComboBox->GetItemData( i ) );
\r
72 //--------------------------------------------------------------------------------------
\r
73 void CD3DSettingsDlg::Init( CDXUTDialogResourceManager* pManager )
\r
76 m_Dialog.Init( pManager, false ); // Don't register this dialog.
\r
77 m_RevertModeDialog.Init( pManager, false ); // Don't register this dialog.
\r
78 m_pActiveDialog = &m_Dialog;
\r
82 //--------------------------------------------------------------------------------------
\r
83 void CD3DSettingsDlg::Init( CDXUTDialogResourceManager* pManager, LPCWSTR szControlTextureFileName )
\r
86 m_Dialog.Init( pManager, false, szControlTextureFileName ); // Don't register this dialog.
\r
87 m_RevertModeDialog.Init( pManager, false, szControlTextureFileName ); // Don't register this dialog.
\r
88 m_pActiveDialog = &m_Dialog;
\r
93 //--------------------------------------------------------------------------------------
\r
94 void CD3DSettingsDlg::Init( CDXUTDialogResourceManager* pManager, LPCWSTR pszControlTextureResourcename,
\r
98 m_Dialog.Init( pManager, false, pszControlTextureResourcename, hModule ); // Don't register this dialog.
\r
99 m_RevertModeDialog.Init( pManager, false, pszControlTextureResourcename, hModule ); // Don't register this dialog
\r
100 m_pActiveDialog = &m_Dialog;
\r
105 //--------------------------------------------------------------------------------------
\r
106 void CD3DSettingsDlg::CreateControls()
\r
108 // Set up main settings dialog
\r
109 m_Dialog.EnableKeyboardInput( true );
\r
110 m_Dialog.SetFont( 0, L"Arial", 15, FW_NORMAL );
\r
111 m_Dialog.SetFont( 1, L"Arial", 28, FW_BOLD );
\r
113 // Right-justify static controls
\r
114 CDXUTElement* pElement = m_Dialog.GetDefaultElement( DXUT_CONTROL_STATIC, 0 );
\r
117 pElement->dwTextFormat = DT_VCENTER | DT_RIGHT;
\r
120 CDXUTStatic* pStatic = NULL;
\r
121 m_Dialog.AddStatic( DXUTSETTINGSDLG_STATIC, L"Direct3D Settings", 10, 5, 400, 50, false, &pStatic );
\r
122 pElement = pStatic->GetElement( 0 );
\r
123 pElement->iFont = 1;
\r
124 pElement->dwTextFormat = DT_TOP | DT_LEFT;
\r
127 // DXUTSETTINGSDLG_API_VERSION
\r
128 m_Dialog.AddStatic( DXUTSETTINGSDLG_STATIC, L"API Version", 10, 35, 180, 23 );
\r
129 m_Dialog.AddComboBox( DXUTSETTINGSDLG_API_VERSION, 200, 35, 300, 23 );
\r
132 //DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL
\r
133 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL_LABEL, L"Feature Level", 10, 60, 180, 23 );
\r
134 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL, 200, 60, 300, 23 );
\r
135 m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL )->SetDropHeight( 106 );
\r
138 // DXUTSETTINGSDLG_ADAPTER
\r
139 m_Dialog.AddStatic( DXUTSETTINGSDLG_STATIC, L"Display Adapter", 10, 85, 180, 23 );
\r
140 m_Dialog.AddComboBox( DXUTSETTINGSDLG_ADAPTER, 200, 85, 300, 23 );
\r
142 // DXUTSETTINGSDLG_DEVICE_TYPE
\r
143 m_Dialog.AddStatic( DXUTSETTINGSDLG_STATIC, L"Render Device", 10, 110, 180, 23 );
\r
144 m_Dialog.AddComboBox( DXUTSETTINGSDLG_DEVICE_TYPE, 200, 110, 300, 23 );
\r
146 // DXUTSETTINGSDLG_WINDOWED, DXUTSETTINGSDLG_FULLSCREEN
\r
147 m_Dialog.AddCheckBox( DXUTSETTINGSDLG_DEVICECLIP, L"Clip to device when window spans across multiple monitors",
\r
148 250, 136, 500, 16 );
\r
149 m_Dialog.AddRadioButton( DXUTSETTINGSDLG_WINDOWED, DXUTSETTINGSDLG_WINDOWED_GROUP, L"Windowed",
\r
150 360, 157, 100, 16 );
\r
151 m_Dialog.AddRadioButton( DXUTSETTINGSDLG_FULLSCREEN, DXUTSETTINGSDLG_WINDOWED_GROUP, L"Full Screen",
\r
152 220, 157, 100, 16 );
\r
154 // DXUTSETTINGSDLG_ADAPTER_FORMAT
\r
155 m_Dialog.AddStatic( DXUTSETTINGSDLG_ADAPTER_FORMAT_LABEL, L"Adapter Format", 10, 175, 180, 23 );
\r
156 m_Dialog.AddComboBox( DXUTSETTINGSDLG_ADAPTER_FORMAT, 200, 175, 300, 23 );
\r
158 // DXUTSETTINGSDLG_RESOLUTION
\r
159 m_Dialog.AddStatic( DXUTSETTINGSDLG_RESOLUTION_LABEL, L"Resolution", 10, 200, 180, 23 );
\r
160 m_Dialog.AddComboBox( DXUTSETTINGSDLG_RESOLUTION, 200, 200, 200, 23 );
\r
161 m_Dialog.GetComboBox( DXUTSETTINGSDLG_RESOLUTION )->SetDropHeight( 106 );
\r
163 // DXUTSETTINGSDLG_RES_SHOW_ALL
\r
164 m_Dialog.AddCheckBox( DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL, L"Show All Aspect Ratios", 420, 200, 200, 23, false );
\r
166 // DXUTSETTINGSDLG_REFRESH_RATE
\r
167 m_Dialog.AddStatic( DXUTSETTINGSDLG_REFRESH_RATE_LABEL, L"Refresh Rate", 10, 225, 180, 23 );
\r
168 m_Dialog.AddComboBox( DXUTSETTINGSDLG_REFRESH_RATE, 200, 225, 300, 23 );
\r
170 // DXUTSETTINGSDLG_BACK_BUFFER_FORMAT
\r
171 m_Dialog.AddStatic( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT_LABEL, L"Back Buffer Format", 10, 260, 180, 23 );
\r
172 m_Dialog.AddComboBox( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT, 200, 260, 300, 23 );
\r
174 // DXUTSETTINGSDLG_DEPTH_STENCIL
\r
175 m_Dialog.AddStatic( DXUTSETTINGSDLG_DEPTH_STENCIL_LABEL, L"Depth/Stencil Format", 10, 285, 180, 23 );
\r
176 m_Dialog.AddComboBox( DXUTSETTINGSDLG_DEPTH_STENCIL, 200, 285, 300, 23 );
\r
178 // DXUTSETTINGSDLG_MULTISAMPLE_TYPE
\r
179 m_Dialog.AddStatic( DXUTSETTINGSDLG_MULTISAMPLE_TYPE_LABEL, L"Multisample Type", 10, 310, 180, 23 );
\r
180 m_Dialog.AddComboBox( DXUTSETTINGSDLG_MULTISAMPLE_TYPE, 200, 310, 300, 23 );
\r
182 // DXUTSETTINGSDLG_MULTISAMPLE_QUALITY
\r
183 m_Dialog.AddStatic( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY_LABEL, L"Multisample Quality", 10, 335, 180, 23 );
\r
184 m_Dialog.AddComboBox( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY, 200, 335, 300, 23 );
\r
186 // DXUTSETTINGSDLG_VERTEX_PROCESSING
\r
187 m_Dialog.AddStatic( DXUTSETTINGSDLG_VERTEX_PROCESSING_LABEL, L"Vertex Processing", 10, 360, 180, 23 );
\r
188 m_Dialog.AddComboBox( DXUTSETTINGSDLG_VERTEX_PROCESSING, 200, 360, 300, 23 );
\r
190 // DXUTSETTINGSDLG_PRESENT_INTERVAL
\r
191 m_Dialog.AddStatic( DXUTSETTINGSDLG_PRESENT_INTERVAL_LABEL, L"Vertical Sync", 10, 385, 180, 23 );
\r
192 m_Dialog.AddComboBox( DXUTSETTINGSDLG_PRESENT_INTERVAL, 200, 385, 300, 23 );
\r
194 // DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT
\r
195 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT_LABEL, L"Adapter Output", 10, 175, 180, 23 );
\r
196 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT, 200, 175, 300, 23 );
\r
198 // DXUTSETTINGSDLG_D3D11_RESOLUTION
\r
199 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_RESOLUTION_LABEL, L"Resolution", 10, 200, 180, 23 );
\r
200 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_RESOLUTION, 200, 200, 200, 23 );
\r
201 m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_RESOLUTION )->SetDropHeight( 106 );
\r
203 // DXUTSETTINGSDLG_D3D11_REFRESH_RATE
\r
204 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_REFRESH_RATE_LABEL, L"Refresh Rate", 10, 225, 180, 23 );
\r
205 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_REFRESH_RATE, 200, 225, 300, 23 );
\r
207 // DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT
\r
208 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT_LABEL, L"Back Buffer Format", 10, 260, 180, 23 );
\r
209 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT, 200, 260, 300, 23 );
\r
211 // DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT
\r
212 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT_LABEL, L"Multisample Count", 10, 285, 180, 23 );
\r
213 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT, 200, 285, 300, 23 );
\r
215 // DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY
\r
216 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY_LABEL, L"Multisample Quality", 10, 310, 180, 23 );
\r
217 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY, 200, 310, 300, 23 );
\r
219 // DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL
\r
220 m_Dialog.AddStatic( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL_LABEL, L"Vertical Sync", 10, 335, 180, 23 );
\r
221 m_Dialog.AddComboBox( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL, 200, 335, 300, 23 );
\r
223 // DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE
\r
224 m_Dialog.AddCheckBox( DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE, L"Create Debug Device", 200, 365, 180, 23 );
\r
226 // DXUTSETTINGSDLG_OK, DXUTSETTINGSDLG_CANCEL
\r
227 m_Dialog.AddButton( DXUTSETTINGSDLG_OK, L"OK", 230, 440, 73, 31 );
\r
228 m_Dialog.AddButton( DXUTSETTINGSDLG_CANCEL, L"Cancel", 315, 440, 73, 31, 0, true );
\r
230 // Set up mode change dialog
\r
231 m_RevertModeDialog.EnableKeyboardInput( true );
\r
232 m_RevertModeDialog.EnableNonUserEvents( true );
\r
233 m_RevertModeDialog.SetFont( 0, L"Arial", 15, FW_NORMAL );
\r
234 m_RevertModeDialog.SetFont( 1, L"Arial", 28, FW_BOLD );
\r
236 pElement = m_RevertModeDialog.GetDefaultElement( DXUT_CONTROL_STATIC, 0 );
\r
239 pElement->dwTextFormat = DT_VCENTER | DT_RIGHT;
\r
242 CDXUTStatic* pStatic = NULL;
\r
243 m_RevertModeDialog.AddStatic( DXUTSETTINGSDLG_STATIC, L"Do you want to keep these display settings?", 10, 5,
\r
244 640, 50, false, &pStatic );
\r
245 pElement = pStatic->GetElement( 0 );
\r
246 pElement->iFont = 1;
\r
247 pElement->dwTextFormat = DT_TOP | DT_LEFT;
\r
249 // Timeout static text control
\r
250 m_RevertModeDialog.AddStatic( DXUTSETTINGSDLG_STATIC_MODE_CHANGE_TIMEOUT, L"", 10, 90, 640, 30,
\r
252 pElement = pStatic->GetElement( 0 );
\r
253 pElement->iFont = 0;
\r
254 pElement->dwTextFormat = DT_TOP | DT_LEFT;
\r
257 // DXUTSETTINGSDLG_MODE_CHANGE_ACCEPT, DXUTSETTINGSDLG_MODE_CHANGE_REVERT
\r
258 m_RevertModeDialog.AddButton( DXUTSETTINGSDLG_MODE_CHANGE_ACCEPT, L"Yes", 230, 50, 73, 31 );
\r
259 m_RevertModeDialog.AddButton( DXUTSETTINGSDLG_MODE_CHANGE_REVERT, L"No", 315, 50, 73, 31, 0, true );
\r
263 //--------------------------------------------------------------------------------------
\r
264 HRESULT CD3DSettingsDlg::OnD3D9CreateDevice( IDirect3DDevice9* pd3dDevice )
\r
266 if( pd3dDevice == NULL )
\r
267 return DXUT_ERR_MSGBOX( L"CD3DSettingsDlg::OnCreatedDevice", E_INVALIDARG );
\r
269 // Create the fonts/textures
\r
270 m_Dialog.SetCallback( StaticOnEvent, ( void* )this );
\r
271 m_RevertModeDialog.SetCallback( StaticOnEvent, ( void* )this );
\r
277 //--------------------------------------------------------------------------------------
\r
278 // Changes the UI defaults to the current device settings
\r
279 //--------------------------------------------------------------------------------------
\r
280 HRESULT CD3DSettingsDlg::Refresh()
\r
284 g_DeviceSettings = DXUTGetDeviceSettings();
\r
286 CDXUTComboBox* pAPIComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_API_VERSION );
\r
287 pAPIComboBox->RemoveAllItems();
\r
288 if( DXUTDoesAppSupportD3D9() )
\r
290 // Ensure that at least one adapter got enumerated.
\r
291 CD3D9Enumeration* pD3DEnum = DXUTGetD3D9Enumeration();
\r
292 if( pD3DEnum->GetAdapterInfoList()->GetSize() > 0 )
\r
293 AddAPIVersion( DXUT_D3D9_DEVICE );
\r
295 if( DXUTDoesAppSupportD3D11() && DXUTIsD3D11Available() )
\r
297 // Ensure that at least one adapter got enumerated.
\r
298 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
299 if( pD3DEnum->GetAdapterInfoList()->GetSize() > 0 )
\r
300 AddAPIVersion( DXUT_D3D11_DEVICE );
\r
303 // If no API has been added, something has gone wrong. Exit the dialog.
\r
304 if( pAPIComboBox->GetNumItems() == 0 )
\r
306 SetActive( false );
\r
310 pAPIComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.ver ) );
\r
312 switch( g_DeviceSettings.ver )
\r
314 case DXUT_D3D9_DEVICE:
\r
316 // Show all D3D9-specific controls and hide controls for all other D3D versions.
\r
317 ShowControlSet( DXUT_D3D9_DEVICE );
\r
319 CD3D9Enumeration* pD3DEnum = DXUTGetD3D9Enumeration();
\r
321 // Fill the UI with the current settings
\r
322 AddDeviceType( g_DeviceSettings.d3d9.DeviceType );
\r
323 SetWindowed( FALSE != g_DeviceSettings.d3d9.pp.Windowed );
\r
324 SetDeviceClip( 0 != ( g_DeviceSettings.d3d9.pp.Flags & D3DPRESENTFLAG_DEVICECLIP ) );
\r
325 AddAdapterFormat( g_DeviceSettings.d3d9.AdapterFormat );
\r
326 AddResolution( g_DeviceSettings.d3d9.pp.BackBufferWidth, g_DeviceSettings.d3d9.pp.BackBufferHeight );
\r
327 AddRefreshRate( g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz );
\r
328 AddBackBufferFormat( g_DeviceSettings.d3d9.pp.BackBufferFormat );
\r
329 AddDepthStencilBufferFormat( g_DeviceSettings.d3d9.pp.AutoDepthStencilFormat );
\r
330 AddMultisampleType( g_DeviceSettings.d3d9.pp.MultiSampleType );
\r
331 AddMultisampleQuality( g_DeviceSettings.d3d9.pp.MultiSampleQuality );
\r
333 if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_PUREDEVICE )
\r
334 AddVertexProcessingType( D3DCREATE_PUREDEVICE );
\r
335 else if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING )
\r
336 AddVertexProcessingType( D3DCREATE_HARDWARE_VERTEXPROCESSING );
\r
337 else if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING )
\r
338 AddVertexProcessingType( D3DCREATE_SOFTWARE_VERTEXPROCESSING );
\r
339 else if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_MIXED_VERTEXPROCESSING )
\r
340 AddVertexProcessingType( D3DCREATE_MIXED_VERTEXPROCESSING );
\r
342 CD3D9EnumDeviceSettingsCombo* pBestDeviceSettingsCombo = pD3DEnum->GetDeviceSettingsCombo(
\r
343 g_DeviceSettings.d3d9.AdapterOrdinal, g_DeviceSettings.d3d9.DeviceType,
\r
344 g_DeviceSettings.d3d9.AdapterFormat, g_DeviceSettings.d3d9.pp.BackBufferFormat,
\r
345 ( g_DeviceSettings.d3d9.pp.Windowed != 0 ) );
\r
346 if( NULL == pBestDeviceSettingsCombo )
\r
347 return DXUT_ERR_MSGBOX( L"GetDeviceSettingsCombo", E_INVALIDARG );
\r
349 // Get the adapters list from CD3D9Enumeration object
\r
350 CGrowableArray <CD3D9EnumAdapterInfo*>* pAdapterInfoList = pD3DEnum->GetAdapterInfoList();
\r
352 if( pAdapterInfoList->GetSize() == 0 )
\r
353 return DXUT_ERR_MSGBOX( L"CD3DSettingsDlg::OnCreatedDevice", DXUTERR_NOCOMPATIBLEDEVICES );
\r
355 CDXUTComboBox* pAdapterCombo = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER );
\r
356 pAdapterCombo->RemoveAllItems();
\r
359 for( int iAdapter = 0; iAdapter < pAdapterInfoList->GetSize(); iAdapter++ )
\r
361 CD3D9EnumAdapterInfo* pAdapterInfo = pAdapterInfoList->GetAt( iAdapter );
\r
362 AddAdapter( pAdapterInfo->szUniqueDescription, pAdapterInfo->AdapterOrdinal );
\r
365 pAdapterCombo->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d9.AdapterOrdinal ) );
\r
367 hr = OnAPIVersionChanged( true );
\r
371 //m_Dialog.Refresh();
\r
372 CDXUTDialog::SetRefreshTime( ( float )DXUTGetTime() );
\r
375 case DXUT_D3D11_DEVICE:
\r
377 // Show all D3D11-specific controls and hide controls for all other D3D versions.
\r
378 ShowControlSet( DXUT_D3D11_DEVICE );
\r
380 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
382 // Fill the UI with the current settings
\r
383 AddD3D11DeviceType( g_DeviceSettings.d3d11.DriverType );
\r
384 SetWindowed( FALSE != g_DeviceSettings.d3d11.sd.Windowed );
\r
385 CD3D11EnumOutputInfo* pOutputInfo = GetCurrentD3D11OutputInfo();
\r
386 AddD3D11AdapterOutput( pOutputInfo->Desc.DeviceName, g_DeviceSettings.d3d11.Output );
\r
390 AddD3D11Resolution( g_DeviceSettings.d3d11.sd.BufferDesc.Width,
\r
391 g_DeviceSettings.d3d11.sd.BufferDesc.Height );
\r
392 AddD3D11RefreshRate( g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate );
\r
393 AddD3D11BackBufferFormat( g_DeviceSettings.d3d11.sd.BufferDesc.Format );
\r
394 AddD3D11MultisampleCount( g_DeviceSettings.d3d11.sd.SampleDesc.Count );
\r
395 AddD3D11MultisampleQuality( g_DeviceSettings.d3d11.sd.SampleDesc.Quality );
\r
397 CD3D11EnumDeviceSettingsCombo* pBestDeviceSettingsCombo = pD3DEnum->GetDeviceSettingsCombo(
\r
398 g_DeviceSettings.d3d11.AdapterOrdinal, g_DeviceSettings.d3d11.DriverType,
\r
399 g_DeviceSettings.d3d11.Output, g_DeviceSettings.d3d11.sd.BufferDesc.Format,
\r
400 ( g_DeviceSettings.d3d11.sd.Windowed != 0 ) );
\r
402 if( NULL == pBestDeviceSettingsCombo )
\r
403 return DXUT_ERR_MSGBOX( L"GetDeviceSettingsCombo", E_INVALIDARG );
\r
405 CDXUTComboBox *pFeatureLevelBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL );
\r
406 pFeatureLevelBox->RemoveAllItems();
\r
407 for (int fli = 0; fli < TOTAL_FEATURE_LEVLES; fli++) {
\r
408 if (m_Levels[fli] >= g_DeviceSettings.MinimumFeatureLevel
\r
409 && m_Levels[fli] <=pBestDeviceSettingsCombo->pDeviceInfo->MaxLevel) {
\r
410 AddD3D11FeatureLevel( m_Levels[fli] );
\r
413 pFeatureLevelBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.DeviceFeatureLevel ) );
\r
416 // Get the adapters list from CD3D11Enumeration object
\r
417 CGrowableArray <CD3D11EnumAdapterInfo*>* pAdapterInfoList = pD3DEnum->GetAdapterInfoList();
\r
419 if( pAdapterInfoList->GetSize() == 0 )
\r
420 return DXUT_ERR_MSGBOX( L"CD3DSettingsDlg::OnCreatedDevice", DXUTERR_NOCOMPATIBLEDEVICES );
\r
422 CDXUTComboBox* pAdapterCombo = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER );
\r
423 pAdapterCombo->RemoveAllItems();
\r
426 for( int iAdapter = 0; iAdapter < pAdapterInfoList->GetSize(); iAdapter++ )
\r
428 CD3D11EnumAdapterInfo* pAdapterInfo = pAdapterInfoList->GetAt( iAdapter );
\r
429 AddAdapter( pAdapterInfo->szUniqueDescription, pAdapterInfo->AdapterOrdinal );
\r
432 pAdapterCombo->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.AdapterOrdinal ) );
\r
434 hr = OnAPIVersionChanged( true );
\r
438 //m_Dialog.Refresh();
\r
439 CDXUTDialog::SetRefreshTime( ( float )DXUTGetTime() );
\r
448 //--------------------------------------------------------------------------------------
\r
449 HRESULT CD3DSettingsDlg::OnD3D9ResetDevice()
\r
451 const D3DSURFACE_DESC* pDesc = DXUTGetD3D9BackBufferSurfaceDesc();
\r
452 m_Dialog.SetLocation( 0, 0 );
\r
453 m_Dialog.SetSize( pDesc->Width, pDesc->Height );
\r
454 m_Dialog.SetBackgroundColors( D3DCOLOR_ARGB( 255, 98, 138, 206 ),
\r
455 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
456 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
457 D3DCOLOR_ARGB( 255, 10, 73, 179 ) );
\r
459 m_RevertModeDialog.SetLocation( 0, 0 );
\r
460 m_RevertModeDialog.SetSize( pDesc->Width, pDesc->Height );
\r
461 m_RevertModeDialog.SetBackgroundColors( D3DCOLOR_ARGB( 255, 98, 138, 206 ),
\r
462 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
463 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
464 D3DCOLOR_ARGB( 255, 10, 73, 179 ) );
\r
466 IDirect3DDevice9* pd3dDevice = DXUTGetD3D9Device();
\r
467 pd3dDevice->BeginStateBlock();
\r
468 pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
\r
469 pd3dDevice->EndStateBlock( &m_pStateBlock );
\r
474 //--------------------------------------------------------------------------------------
\r
475 void CD3DSettingsDlg::SetSelectedD3D11RefreshRate( DXGI_RATIONAL RefreshRate )
\r
477 CDXUTComboBox* pRefreshRateComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_REFRESH_RATE );
\r
479 for( UINT i = 0; i < pRefreshRateComboBox->GetNumItems(); ++i )
\r
481 DXGI_RATIONAL* pRate = ( DXGI_RATIONAL* )pRefreshRateComboBox->GetItemData( i );
\r
483 if( pRate && pRate->Numerator == RefreshRate.Numerator && pRate->Denominator == RefreshRate.Denominator )
\r
485 pRefreshRateComboBox->SetSelectedByIndex( i );
\r
491 //--------------------------------------------------------------------------------------
\r
492 void CD3DSettingsDlg::OnRender( float fElapsedTime )
\r
494 if( DXUTGetD3D11Device() )
\r
495 OnRender11( fElapsedTime );
\r
497 OnRender9( fElapsedTime );
\r
501 //--------------------------------------------------------------------------------------
\r
502 void CD3DSettingsDlg::OnRender9( float fElapsedTime )
\r
504 IDirect3DDevice9* pd3dDevice = DXUTGetD3D9Device();
\r
506 // Clear the render target and the zbuffer
\r
507 pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, 0x00003F3F, 1.0f, 0 );
\r
509 // Render the scene
\r
510 if( SUCCEEDED( pd3dDevice->BeginScene() ) )
\r
512 m_pStateBlock->Capture();
\r
513 pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
\r
514 m_pActiveDialog->OnRender( fElapsedTime );
\r
515 m_pStateBlock->Apply();
\r
516 pd3dDevice->EndScene();
\r
522 //--------------------------------------------------------------------------------------
\r
523 void CD3DSettingsDlg::OnRender11( float fElapsedTime )
\r
525 // Render the scene
\r
526 m_pActiveDialog->OnRender( fElapsedTime );
\r
530 //--------------------------------------------------------------------------------------
\r
531 LRESULT CD3DSettingsDlg::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
\r
533 m_pActiveDialog->MsgProc( hWnd, uMsg, wParam, lParam );
\r
534 if( uMsg == WM_KEYDOWN && wParam == VK_F2 )
\r
535 SetActive( false );
\r
540 //--------------------------------------------------------------------------------------
\r
541 void CD3DSettingsDlg::OnD3D9LostDevice()
\r
543 SAFE_RELEASE( m_pStateBlock );
\r
547 //--------------------------------------------------------------------------------------
\r
548 void CD3DSettingsDlg::OnD3D9DestroyDevice()
\r
554 //--------------------------------------------------------------------------------------
\r
555 HRESULT CD3DSettingsDlg::OnD3D11CreateDevice( ID3D11Device* pd3dDevice )
\r
559 if( pd3dDevice == NULL )
\r
560 return DXUT_ERR_MSGBOX( L"CD3DSettingsDlg::OnCreatedDevice", E_INVALIDARG );
\r
562 // Create the fonts/textures
\r
563 m_Dialog.SetCallback( StaticOnEvent, ( void* )this );
\r
564 m_RevertModeDialog.SetCallback( StaticOnEvent, ( void* )this );
\r
570 //--------------------------------------------------------------------------------------
\r
571 HRESULT CD3DSettingsDlg::OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice,
\r
572 const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc )
\r
574 m_Dialog.SetLocation( 0, 0 );
\r
575 m_Dialog.SetSize( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );
\r
576 m_Dialog.SetBackgroundColors( D3DCOLOR_ARGB( 255, 98, 138, 206 ),
\r
577 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
578 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
579 D3DCOLOR_ARGB( 255, 10, 73, 179 ) );
\r
581 m_RevertModeDialog.SetLocation( 0, 0 );
\r
582 m_RevertModeDialog.SetSize( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );
\r
583 m_RevertModeDialog.SetBackgroundColors( D3DCOLOR_ARGB( 255, 98, 138, 206 ),
\r
584 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
585 D3DCOLOR_ARGB( 255, 54, 105, 192 ),
\r
586 D3DCOLOR_ARGB( 255, 10, 73, 179 ) );
\r
592 //--------------------------------------------------------------------------------------
\r
593 void CD3DSettingsDlg::OnD3D11DestroyDevice()
\r
599 //--------------------------------------------------------------------------------------
\r
600 void CD3DSettingsDlg::ShowControlSet( DXUTDeviceVersion ver )
\r
604 case DXUT_D3D9_DEVICE:
\r
606 m_Dialog.GetControl( DXUTSETTINGSDLG_ADAPTER_FORMAT )->SetVisible( true );
\r
607 m_Dialog.GetControl( DXUTSETTINGSDLG_ADAPTER_FORMAT_LABEL )->SetVisible( true );
\r
608 m_Dialog.GetControl( DXUTSETTINGSDLG_RESOLUTION )->SetVisible( true );
\r
609 m_Dialog.GetControl( DXUTSETTINGSDLG_RESOLUTION_LABEL )->SetVisible( true );
\r
610 m_Dialog.GetControl( DXUTSETTINGSDLG_REFRESH_RATE )->SetVisible( true );
\r
611 m_Dialog.GetControl( DXUTSETTINGSDLG_REFRESH_RATE_LABEL )->SetVisible( true );
\r
612 m_Dialog.GetControl( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT )->SetVisible( true );
\r
613 m_Dialog.GetControl( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT_LABEL )->SetVisible( true );
\r
614 m_Dialog.GetControl( DXUTSETTINGSDLG_DEPTH_STENCIL )->SetVisible( true );
\r
615 m_Dialog.GetControl( DXUTSETTINGSDLG_DEPTH_STENCIL_LABEL )->SetVisible( true );
\r
616 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_TYPE )->SetVisible( true );
\r
617 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_TYPE_LABEL )->SetVisible( true );
\r
618 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY )->SetVisible( true );
\r
619 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY_LABEL )->SetVisible( true );
\r
620 m_Dialog.GetControl( DXUTSETTINGSDLG_VERTEX_PROCESSING )->SetVisible( true );
\r
621 m_Dialog.GetControl( DXUTSETTINGSDLG_VERTEX_PROCESSING_LABEL )->SetVisible( true );
\r
622 m_Dialog.GetControl( DXUTSETTINGSDLG_PRESENT_INTERVAL )->SetVisible( true );
\r
623 m_Dialog.GetControl( DXUTSETTINGSDLG_PRESENT_INTERVAL_LABEL )->SetVisible( true );
\r
624 m_Dialog.GetControl( DXUTSETTINGSDLG_DEVICECLIP )->SetVisible( true );
\r
626 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL )->SetVisible( false );
\r
627 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL_LABEL )->SetVisible( false );
\r
628 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT )->SetVisible( false );
\r
629 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT_LABEL )->SetVisible( false );
\r
630 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_RESOLUTION )->SetVisible( false );
\r
631 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_RESOLUTION_LABEL )->SetVisible( false );
\r
632 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_REFRESH_RATE )->SetVisible( false );
\r
633 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_REFRESH_RATE_LABEL )->SetVisible( false );
\r
634 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT )->SetVisible( false );
\r
635 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT_LABEL )->SetVisible( false );
\r
636 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT )->SetVisible( false );
\r
637 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT_LABEL )->SetVisible( false );
\r
638 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY )->SetVisible( false );
\r
639 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY_LABEL )->SetVisible( false );
\r
640 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL )->SetVisible( false );
\r
641 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL_LABEL )->SetVisible( false );
\r
642 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE )->SetVisible( false );
\r
646 case DXUT_D3D11_DEVICE:
\r
647 m_Dialog.GetControl( DXUTSETTINGSDLG_ADAPTER_FORMAT )->SetVisible( false );
\r
648 m_Dialog.GetControl( DXUTSETTINGSDLG_ADAPTER_FORMAT_LABEL )->SetVisible( false );
\r
649 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL )->SetVisible( true );
\r
650 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL_LABEL )->SetVisible( true );
\r
651 m_Dialog.GetControl( DXUTSETTINGSDLG_RESOLUTION )->SetVisible( false );
\r
652 m_Dialog.GetControl( DXUTSETTINGSDLG_RESOLUTION_LABEL )->SetVisible( false );
\r
653 m_Dialog.GetControl( DXUTSETTINGSDLG_REFRESH_RATE )->SetVisible( false );
\r
654 m_Dialog.GetControl( DXUTSETTINGSDLG_REFRESH_RATE_LABEL )->SetVisible( false );
\r
655 m_Dialog.GetControl( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT )->SetVisible( false );
\r
656 m_Dialog.GetControl( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT_LABEL )->SetVisible( false );
\r
657 m_Dialog.GetControl( DXUTSETTINGSDLG_DEPTH_STENCIL )->SetVisible( false );
\r
658 m_Dialog.GetControl( DXUTSETTINGSDLG_DEPTH_STENCIL_LABEL )->SetVisible( false );
\r
659 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_TYPE )->SetVisible( false );
\r
660 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_TYPE_LABEL )->SetVisible( false );
\r
661 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY )->SetVisible( false );
\r
662 m_Dialog.GetControl( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY_LABEL )->SetVisible( false );
\r
663 m_Dialog.GetControl( DXUTSETTINGSDLG_VERTEX_PROCESSING )->SetVisible( false );
\r
664 m_Dialog.GetControl( DXUTSETTINGSDLG_VERTEX_PROCESSING_LABEL )->SetVisible( false );
\r
665 m_Dialog.GetControl( DXUTSETTINGSDLG_PRESENT_INTERVAL )->SetVisible( false );
\r
666 m_Dialog.GetControl( DXUTSETTINGSDLG_PRESENT_INTERVAL_LABEL )->SetVisible( false );
\r
667 m_Dialog.GetControl( DXUTSETTINGSDLG_DEVICECLIP )->SetVisible( false );
\r
669 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT )->SetVisible( true );
\r
670 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT_LABEL )->SetVisible( true );
\r
671 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_RESOLUTION )->SetVisible( true );
\r
672 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_RESOLUTION_LABEL )->SetVisible( true );
\r
673 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_REFRESH_RATE )->SetVisible( true );
\r
674 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_REFRESH_RATE_LABEL )->SetVisible( true );
\r
675 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT )->SetVisible( true );
\r
676 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT_LABEL )->SetVisible( true );
\r
677 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT )->SetVisible( true );
\r
678 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT_LABEL )->SetVisible( true );
\r
679 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY )->SetVisible( true );
\r
680 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY_LABEL )->SetVisible( true );
\r
681 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL )->SetVisible( true );
\r
682 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL_LABEL )->SetVisible( true );
\r
683 m_Dialog.GetControl( DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE )->SetVisible( true );
\r
689 //--------------------------------------------------------------------------------------
\r
690 void WINAPI CD3DSettingsDlg::StaticOnEvent( UINT nEvent, int nControlID,
\r
691 CDXUTControl* pControl, void* pUserData )
\r
693 CD3DSettingsDlg* pD3DSettings = ( CD3DSettingsDlg* )pUserData;
\r
695 pD3DSettings->OnEvent( nEvent, nControlID, pControl );
\r
698 //--------------------------------------------------------------------------------------
\r
699 // Name: CD3DSettingsDlg::StaticOnModeChangeTimer()
\r
700 // Desc: Timer callback registered by a call to DXUTSetTimer. It is called each second
\r
701 // until mode change timeout limit.
\r
702 //--------------------------------------------------------------------------------------
\r
703 void WINAPI CD3DSettingsDlg::StaticOnModeChangeTimer( UINT nIDEvent, void* pUserContext )
\r
705 CD3DSettingsDlg* pD3DSettings = ( CD3DSettingsDlg* )pUserContext;
\r
706 assert( pD3DSettings );
\r
707 assert( pD3DSettings->m_pActiveDialog == &pD3DSettings->m_RevertModeDialog );
\r
708 assert( pD3DSettings->m_nIDEvent == nIDEvent );
\r
710 if( 0 == --pD3DSettings->m_nRevertModeTimeout )
\r
712 CDXUTControl* pControl = pD3DSettings->m_RevertModeDialog.GetControl( DXUTSETTINGSDLG_MODE_CHANGE_REVERT );
\r
713 assert( pControl );
\r
714 pD3DSettings->m_RevertModeDialog.SendEvent( EVENT_BUTTON_CLICKED, false, pControl );
\r
716 pD3DSettings->UpdateModeChangeTimeoutText( pD3DSettings->m_nRevertModeTimeout );
\r
719 //--------------------------------------------------------------------------------------
\r
720 void CD3DSettingsDlg::OnEvent( UINT nEvent, int nControlID,
\r
721 CDXUTControl* pControl )
\r
723 switch( nControlID )
\r
725 case DXUTSETTINGSDLG_ADAPTER:
\r
726 OnAdapterChanged(); break;
\r
727 case DXUTSETTINGSDLG_DEVICE_TYPE:
\r
728 OnDeviceTypeChanged(); break;
\r
729 case DXUTSETTINGSDLG_WINDOWED:
\r
730 OnWindowedFullScreenChanged(); break;
\r
731 case DXUTSETTINGSDLG_FULLSCREEN:
\r
732 OnWindowedFullScreenChanged(); break;
\r
733 case DXUTSETTINGSDLG_ADAPTER_FORMAT:
\r
734 OnAdapterFormatChanged(); break;
\r
735 case DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL:
\r
737 if( g_DeviceSettings.ver == DXUT_D3D9_DEVICE )
\r
739 OnAdapterFormatChanged();
\r
743 OnBackBufferFormatChanged();
\r
747 case DXUTSETTINGSDLG_D3D11_RESOLUTION:
\r
748 OnD3D11ResolutionChanged(); break;
\r
749 case DXUTSETTINGSDLG_RESOLUTION:
\r
750 OnResolutionChanged(); break;
\r
751 case DXUTSETTINGSDLG_REFRESH_RATE:
\r
752 OnRefreshRateChanged(); break;
\r
753 case DXUTSETTINGSDLG_BACK_BUFFER_FORMAT:
\r
754 OnBackBufferFormatChanged(); break;
\r
755 case DXUTSETTINGSDLG_DEPTH_STENCIL:
\r
756 OnDepthStencilBufferFormatChanged(); break;
\r
757 case DXUTSETTINGSDLG_MULTISAMPLE_TYPE:
\r
758 OnMultisampleTypeChanged(); break;
\r
759 case DXUTSETTINGSDLG_MULTISAMPLE_QUALITY:
\r
760 OnMultisampleQualityChanged(); break;
\r
761 case DXUTSETTINGSDLG_VERTEX_PROCESSING:
\r
762 OnVertexProcessingChanged(); break;
\r
763 case DXUTSETTINGSDLG_PRESENT_INTERVAL:
\r
764 OnPresentIntervalChanged(); break;
\r
765 case DXUTSETTINGSDLG_DEVICECLIP:
\r
766 OnDeviceClipChanged(); break;
\r
767 case DXUTSETTINGSDLG_API_VERSION:
\r
768 OnAPIVersionChanged(); break;
\r
769 case DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL:
\r
770 OnFeatureLevelChanged(); break;
\r
771 case DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT:
\r
772 OnAdapterOutputChanged(); break;
\r
773 case DXUTSETTINGSDLG_D3D11_REFRESH_RATE:
\r
774 OnRefreshRateChanged(); break;
\r
775 case DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT:
\r
776 OnBackBufferFormatChanged(); break;
\r
777 case DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT:
\r
778 OnMultisampleTypeChanged(); break;
\r
779 case DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY:
\r
780 OnMultisampleQualityChanged(); break;
\r
781 case DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL:
\r
782 OnPresentIntervalChanged(); break;
\r
783 case DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE:
\r
784 OnDebugDeviceChanged(); break;
\r
786 case DXUTSETTINGSDLG_OK:
\r
788 bool bFullScreenModeChange = false;
\r
789 DXUTDeviceSettings currentSettings = DXUTGetDeviceSettings();
\r
790 g_DeviceSettings.MinimumFeatureLevel = currentSettings.MinimumFeatureLevel;
\r
791 if( g_DeviceSettings.ver == DXUT_D3D9_DEVICE )
\r
793 if( g_DeviceSettings.d3d9.pp.Windowed )
\r
795 g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz = 0;
\r
798 if( DXUTIsWindowed() )
\r
799 GetClientRect( DXUTGetHWND(), &rcClient );
\r
801 rcClient = DXUTGetWindowClientRectAtModeChange();
\r
802 DWORD dwWindowWidth = rcClient.right - rcClient.left;
\r
803 DWORD dwWindowHeight = rcClient.bottom - rcClient.top;
\r
805 g_DeviceSettings.d3d9.pp.BackBufferWidth = dwWindowWidth;
\r
806 g_DeviceSettings.d3d9.pp.BackBufferHeight = dwWindowHeight;
\r
810 // Check for fullscreen mode change
\r
811 bFullScreenModeChange = g_DeviceSettings.d3d9.pp.BackBufferWidth !=
\r
812 currentSettings.d3d9.pp.BackBufferWidth ||
\r
813 g_DeviceSettings.d3d9.pp.BackBufferHeight != currentSettings.d3d9.pp.BackBufferHeight ||
\r
814 g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz !=
\r
815 currentSettings.d3d9.pp.FullScreen_RefreshRateInHz;
\r
818 if( g_DeviceSettings.d3d9.pp.MultiSampleType != D3DMULTISAMPLE_NONE )
\r
820 g_DeviceSettings.d3d9.pp.Flags &= ~D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
\r
825 if( g_DeviceSettings.d3d11.sd.Windowed )
\r
827 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate.Denominator =
\r
828 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate.Numerator = 0;
\r
831 if( DXUTIsWindowed() )
\r
832 GetClientRect( DXUTGetHWND(), &rcClient );
\r
834 rcClient = DXUTGetWindowClientRectAtModeChange();
\r
835 DWORD dwWindowWidth = rcClient.right - rcClient.left;
\r
836 DWORD dwWindowHeight = rcClient.bottom - rcClient.top;
\r
838 g_DeviceSettings.d3d11.sd.BufferDesc.Width = dwWindowWidth;
\r
839 g_DeviceSettings.d3d11.sd.BufferDesc.Height = dwWindowHeight;
\r
843 // Check for fullscreen mode change
\r
844 bFullScreenModeChange = g_DeviceSettings.d3d11.sd.BufferDesc.Width !=
\r
845 currentSettings.d3d11.sd.BufferDesc.Width ||
\r
846 g_DeviceSettings.d3d11.sd.BufferDesc.Height != currentSettings.d3d11.sd.BufferDesc.Height ||
\r
847 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate.Denominator !=
\r
848 currentSettings.d3d11.sd.BufferDesc.RefreshRate.Denominator ||
\r
849 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate.Numerator !=
\r
850 currentSettings.d3d11.sd.BufferDesc.RefreshRate.Numerator;
\r
854 if( bFullScreenModeChange )
\r
856 // set appropriate global device settings to that of the current device
\r
857 // settings. These will get set to the user-defined settings once the
\r
858 // user accepts the mode change
\r
859 DXUTDeviceSettings tSettings = g_DeviceSettings;
\r
860 if( g_DeviceSettings.ver == DXUT_D3D9_DEVICE )
\r
862 g_DeviceSettings.d3d9.pp.BackBufferWidth =
\r
863 currentSettings.d3d9.pp.BackBufferWidth;
\r
864 g_DeviceSettings.d3d9.pp.BackBufferHeight =
\r
865 currentSettings.d3d9.pp.BackBufferHeight;
\r
866 g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz =
\r
867 currentSettings.d3d9.pp.FullScreen_RefreshRateInHz;
\r
868 g_DeviceSettings.d3d9.pp.Windowed =
\r
869 currentSettings.d3d9.pp.Windowed;
\r
874 g_DeviceSettings.d3d11.sd.BufferDesc.Width =
\r
875 currentSettings.d3d11.sd.BufferDesc.Width;
\r
876 g_DeviceSettings.d3d11.sd.BufferDesc.Height =
\r
877 currentSettings.d3d11.sd.BufferDesc.Height;
\r
878 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate.Denominator =
\r
879 currentSettings.d3d11.sd.BufferDesc.RefreshRate.Denominator;
\r
880 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate.Numerator =
\r
881 currentSettings.d3d11.sd.BufferDesc.RefreshRate.Numerator;
\r
882 g_DeviceSettings.d3d11.sd.Windowed = currentSettings.d3d11.sd.Windowed;
\r
886 // apply the user-defined settings
\r
887 DXUTCreateDeviceFromSettings( &tSettings );
\r
888 // create the mode change timeout dialog
\r
889 m_pActiveDialog = &m_RevertModeDialog;
\r
890 m_nRevertModeTimeout = 15;
\r
891 UpdateModeChangeTimeoutText( m_nRevertModeTimeout );
\r
892 // activate a timer for 1-second updates
\r
893 DXUTSetTimer( StaticOnModeChangeTimer, 1.0f, &m_nIDEvent, ( void* )this );
\r
897 DXUTCreateDeviceFromSettings( &g_DeviceSettings );
\r
898 SetActive( false );
\r
903 case DXUTSETTINGSDLG_CANCEL:
\r
905 SetActive( false );
\r
909 case DXUTSETTINGSDLG_MODE_CHANGE_ACCEPT:
\r
911 DXUTKillTimer( m_nIDEvent );
\r
912 g_DeviceSettings = DXUTGetDeviceSettings();
\r
913 m_pActiveDialog = &m_Dialog;
\r
914 SetActive( false );
\r
918 case DXUTSETTINGSDLG_MODE_CHANGE_REVERT:
\r
920 DXUTKillTimer( m_nIDEvent );
\r
921 m_pActiveDialog = &m_Dialog;
\r
923 m_nRevertModeTimeout = 0;
\r
924 DXUTCreateDeviceFromSettings( &g_DeviceSettings );
\r
932 //-------------------------------------------------------------------------------------
\r
933 HRESULT CD3DSettingsDlg::SetDeviceSettingsFromUI()
\r
935 CDXUTComboBox* pComboBox;
\r
936 CDXUTRadioButton* pRadioButton;
\r
938 // DXUTSETTINGSDLG_DEVICE_TYPE
\r
939 pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEVICE_TYPE );
\r
940 g_DeviceSettings.d3d9.DeviceType = ( D3DDEVTYPE )PtrToUlong( pComboBox->GetSelectedData() );
\r
942 // DXUTSETTINGSDLG_WINDOWED
\r
943 pRadioButton = m_Dialog.GetRadioButton( DXUTSETTINGSDLG_WINDOWED );
\r
944 g_DeviceSettings.d3d9.pp.Windowed = pRadioButton->GetChecked();
\r
946 // DXUTSETTINGSDLG_ADAPTER_FORMAT
\r
947 pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER_FORMAT );
\r
948 g_DeviceSettings.d3d9.AdapterFormat = ( D3DFORMAT )PtrToUlong( pComboBox->GetSelectedData() );
\r
950 if( g_DeviceSettings.d3d9.pp.Windowed )
\r
952 g_DeviceSettings.d3d9.pp.BackBufferFormat = D3DFMT_UNKNOWN;
\r
953 g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz = 0;
\r
957 // DXUTSETTINGSDLG_BACK_BUFFER_FORMAT
\r
958 pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT );
\r
959 g_DeviceSettings.d3d9.pp.BackBufferFormat = ( D3DFORMAT )PtrToUlong( pComboBox->GetSelectedData() );
\r
961 // DXUTSETTINGSDLG_RESOLUTION
\r
962 pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_RESOLUTION );
\r
963 DWORD dwResolution = PtrToUlong( pComboBox->GetSelectedData() );
\r
964 g_DeviceSettings.d3d9.pp.BackBufferWidth = HIWORD( dwResolution );
\r
965 g_DeviceSettings.d3d9.pp.BackBufferHeight = LOWORD( dwResolution );
\r
967 // DXUTSETTINGSDLG_REFRESH_RATE
\r
968 pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_REFRESH_RATE );
\r
969 g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz = PtrToUlong( pComboBox->GetSelectedData() );
\r
972 // DXUTSETTINGSDLG_DEPTH_STENCIL
\r
973 pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEPTH_STENCIL );
\r
974 g_DeviceSettings.d3d9.pp.AutoDepthStencilFormat = ( D3DFORMAT )PtrToUlong( pComboBox->GetSelectedData() );
\r
980 //-------------------------------------------------------------------------------------
\r
981 CD3D9EnumAdapterInfo* CD3DSettingsDlg::GetCurrentAdapterInfo()
\r
983 CD3D9Enumeration* pD3DEnum = DXUTGetD3D9Enumeration();
\r
984 return pD3DEnum->GetAdapterInfo( g_DeviceSettings.d3d9.AdapterOrdinal );
\r
988 //-------------------------------------------------------------------------------------
\r
989 CD3D9EnumDeviceInfo* CD3DSettingsDlg::GetCurrentDeviceInfo()
\r
991 CD3D9Enumeration* pD3DEnum = DXUTGetD3D9Enumeration();
\r
992 return pD3DEnum->GetDeviceInfo( g_DeviceSettings.d3d9.AdapterOrdinal,
\r
993 g_DeviceSettings.d3d9.DeviceType );
\r
996 //-------------------------------------------------------------------------------------
\r
997 CD3D11EnumAdapterInfo* CD3DSettingsDlg::GetCurrentD3D11AdapterInfo()
\r
999 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
1000 return pD3DEnum->GetAdapterInfo( g_DeviceSettings.d3d11.AdapterOrdinal );
\r
1004 //-------------------------------------------------------------------------------------
\r
1005 CD3D11EnumDeviceInfo* CD3DSettingsDlg::GetCurrentD3D11DeviceInfo()
\r
1007 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
1008 return pD3DEnum->GetDeviceInfo( g_DeviceSettings.d3d11.AdapterOrdinal,
\r
1009 g_DeviceSettings.d3d11.DriverType );
\r
1013 //-------------------------------------------------------------------------------------
\r
1014 CD3D11EnumOutputInfo* CD3DSettingsDlg::GetCurrentD3D11OutputInfo()
\r
1016 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
1017 return pD3DEnum->GetOutputInfo( g_DeviceSettings.d3d11.AdapterOrdinal,
\r
1018 g_DeviceSettings.d3d11.Output );
\r
1022 //-------------------------------------------------------------------------------------
\r
1023 CD3D9EnumDeviceSettingsCombo* CD3DSettingsDlg::GetCurrentDeviceSettingsCombo()
\r
1025 CD3D9Enumeration* pD3DEnum = DXUTGetD3D9Enumeration();
\r
1026 return pD3DEnum->GetDeviceSettingsCombo( g_DeviceSettings.d3d9.AdapterOrdinal,
\r
1027 g_DeviceSettings.d3d9.DeviceType,
\r
1028 g_DeviceSettings.d3d9.AdapterFormat,
\r
1029 g_DeviceSettings.d3d9.pp.BackBufferFormat,
\r
1030 ( g_DeviceSettings.d3d9.pp.Windowed == TRUE ) );
\r
1033 //-------------------------------------------------------------------------------------
\r
1034 CD3D11EnumDeviceSettingsCombo* CD3DSettingsDlg::GetCurrentD3D11DeviceSettingsCombo()
\r
1036 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
1037 return pD3DEnum->GetDeviceSettingsCombo( g_DeviceSettings.d3d11.AdapterOrdinal,
\r
1038 g_DeviceSettings.d3d11.DriverType,
\r
1039 g_DeviceSettings.d3d11.Output,
\r
1040 g_DeviceSettings.d3d11.sd.BufferDesc.Format,
\r
1041 ( g_DeviceSettings.d3d11.sd.Windowed == TRUE ) );
\r
1044 HRESULT CD3DSettingsDlg::OnD3D11ResolutionChanged () {
\r
1045 DWORD dwWidth, dwHeight;
\r
1046 GetSelectedD3D11Resolution( &dwWidth, &dwHeight );
\r
1047 g_DeviceSettings.d3d11.sd.BufferDesc.Width= dwWidth;
\r
1048 g_DeviceSettings.d3d11.sd.BufferDesc.Height = dwHeight;
\r
1053 HRESULT CD3DSettingsDlg::OnFeatureLevelChanged () {
\r
1054 HRESULT hr = E_FAIL;
\r
1055 if (g_DeviceSettings.ver == DXUT_D3D11_DEVICE) {
\r
1056 if (g_DeviceSettings.d3d11.DeviceFeatureLevel == GetSelectedFeatureLevel()) return S_OK;
\r
1059 // Obtain a set of valid D3D10 device settings.
\r
1060 UINT CreateFlags = g_DeviceSettings.d3d11.CreateFlags;
\r
1061 ZeroMemory( &g_DeviceSettings, sizeof( g_DeviceSettings ) );
\r
1063 DXUTApplyDefaultDeviceSettings(&g_DeviceSettings);
\r
1064 g_DeviceSettings.d3d11.CreateFlags = CreateFlags;
\r
1065 g_DeviceSettings.ver = DXUT_D3D11_DEVICE;
\r
1066 //g_DeviceSettings.d3d11.fl = GetSelectedFeatureLevel();
\r
1067 hr = DXUTSnapDeviceSettingsToEnumDevice(&g_DeviceSettings, true, GetSelectedFeatureLevel());
\r
1071 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
1072 CGrowableArray <CD3D11EnumAdapterInfo*>* pAdapterInfoList = pD3DEnum->GetAdapterInfoList();
\r
1074 CDXUTComboBox* pAdapterComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER );
\r
1075 pAdapterComboBox->RemoveAllItems();
\r
1077 for( int iAdapter = 0; iAdapter < pAdapterInfoList->GetSize(); ++iAdapter )
\r
1079 CD3D11EnumAdapterInfo* pAdapterInfo = pAdapterInfoList->GetAt( iAdapter );
\r
1080 AddAdapter( pAdapterInfo->szUniqueDescription, pAdapterInfo->AdapterOrdinal );
\r
1083 pAdapterComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.AdapterOrdinal ) );
\r
1085 CDXUTCheckBox* pCheckBox = m_Dialog.GetCheckBox( DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE );
\r
1086 pCheckBox->SetChecked( 0 != ( g_DeviceSettings.d3d11.CreateFlags & D3D11_CREATE_DEVICE_DEBUG ) );
\r
1088 hr = OnAdapterChanged();
\r
1089 if( FAILED( hr ) )
\r
1096 //-------------------------------------------------------------------------------------
\r
1097 HRESULT CD3DSettingsDlg::OnAPIVersionChanged( bool bRefresh )
\r
1101 // Store the API version
\r
1102 g_DeviceSettings.ver = GetSelectedAPIVersion();
\r
1104 // Show/hide appropriate dialog controls based on version.
\r
1105 ShowControlSet( g_DeviceSettings.ver );
\r
1107 switch( g_DeviceSettings.ver )
\r
1109 case DXUT_D3D9_DEVICE:
\r
1113 // Obtain a set of valid D3D9 device settings.
\r
1114 UINT CreateFlags = g_DeviceSettings.d3d11.CreateFlags;
\r
1115 ZeroMemory( &g_DeviceSettings, sizeof( g_DeviceSettings ) );
\r
1116 // We want a specific API version, so set up match option to preserve it.
\r
1117 DXUTApplyDefaultDeviceSettings(&g_DeviceSettings);
\r
1118 g_DeviceSettings.d3d11.CreateFlags = CreateFlags;
\r
1119 g_DeviceSettings.ver = DXUT_D3D9_DEVICE;
\r
1120 DXUTSnapDeviceSettingsToEnumDevice ( &g_DeviceSettings, true);
\r
1123 CD3D9Enumeration* pD3DEnum = DXUTGetD3D9Enumeration();
\r
1124 CGrowableArray <CD3D9EnumAdapterInfo*>* pAdapterInfoList = pD3DEnum->GetAdapterInfoList();
\r
1126 CDXUTComboBox* pAdapterComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER );
\r
1127 pAdapterComboBox->RemoveAllItems();
\r
1129 for( int iAdapter = 0; iAdapter < pAdapterInfoList->GetSize(); ++iAdapter )
\r
1131 CD3D9EnumAdapterInfo* pAdapterInfo = pAdapterInfoList->GetAt( iAdapter );
\r
1132 AddAdapter( pAdapterInfo->szUniqueDescription, pAdapterInfo->AdapterOrdinal );
\r
1135 pAdapterComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d9.AdapterOrdinal ) );
\r
1137 hr = OnAdapterChanged();
\r
1138 if( FAILED( hr ) )
\r
1144 case DXUT_D3D11_DEVICE:
\r
1148 // Obtain a set of valid D3D10 device settings.
\r
1149 UINT CreateFlags = g_DeviceSettings.d3d11.CreateFlags;
\r
1150 ZeroMemory( &g_DeviceSettings, sizeof( g_DeviceSettings ) );
\r
1151 // We want a specific API version, so set up match option to preserve it.
\r
1152 DXUTApplyDefaultDeviceSettings(&g_DeviceSettings);
\r
1153 g_DeviceSettings.d3d11.CreateFlags = CreateFlags;
\r
1154 g_DeviceSettings.ver = DXUT_D3D11_DEVICE;
\r
1155 DXUTSnapDeviceSettingsToEnumDevice(&g_DeviceSettings, true);
\r
1159 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
1160 CGrowableArray <CD3D11EnumAdapterInfo*>* pAdapterInfoList = pD3DEnum->GetAdapterInfoList();
\r
1162 CDXUTComboBox* pAdapterComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER );
\r
1163 pAdapterComboBox->RemoveAllItems();
\r
1165 for( int iAdapter = 0; iAdapter < pAdapterInfoList->GetSize(); ++iAdapter )
\r
1167 CD3D11EnumAdapterInfo* pAdapterInfo = pAdapterInfoList->GetAt( iAdapter );
\r
1168 AddAdapter( pAdapterInfo->szUniqueDescription, pAdapterInfo->AdapterOrdinal );
\r
1171 pAdapterComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.AdapterOrdinal ) );
\r
1173 CDXUTCheckBox* pCheckBox = m_Dialog.GetCheckBox( DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE );
\r
1174 pCheckBox->SetChecked( 0 != ( g_DeviceSettings.d3d11.CreateFlags & D3D11_CREATE_DEVICE_DEBUG ) );
\r
1176 hr = OnAdapterChanged();
\r
1177 if( FAILED( hr ) )
\r
1188 //-------------------------------------------------------------------------------------
\r
1189 HRESULT CD3DSettingsDlg::OnAdapterChanged()
\r
1191 HRESULT hr = S_OK;
\r
1193 switch( g_DeviceSettings.ver )
\r
1195 case DXUT_D3D9_DEVICE:
\r
1197 // Store the adapter index
\r
1198 g_DeviceSettings.d3d9.AdapterOrdinal = GetSelectedAdapter();
\r
1200 // DXUTSETTINGSDLG_DEVICE_TYPE
\r
1201 CDXUTComboBox* pDeviceTypeComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEVICE_TYPE );
\r
1202 pDeviceTypeComboBox->RemoveAllItems();
\r
1204 CD3D9EnumAdapterInfo* pAdapterInfo = GetCurrentAdapterInfo();
\r
1205 if( pAdapterInfo == NULL )
\r
1208 for( int iDeviceInfo = 0; iDeviceInfo < pAdapterInfo->deviceInfoList.GetSize(); iDeviceInfo++ )
\r
1210 CD3D9EnumDeviceInfo* pDeviceInfo = pAdapterInfo->deviceInfoList.GetAt( iDeviceInfo );
\r
1211 AddDeviceType( pDeviceInfo->DeviceType );
\r
1214 pDeviceTypeComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d9.DeviceType ) );
\r
1216 hr = OnDeviceTypeChanged();
\r
1217 if( FAILED( hr ) )
\r
1223 case DXUT_D3D11_DEVICE:
\r
1225 // Store the adapter index
\r
1226 g_DeviceSettings.d3d11.AdapterOrdinal = GetSelectedAdapter();
\r
1228 // DXUTSETTINGSDLG_DEVICE_TYPE
\r
1229 CDXUTComboBox* pDeviceTypeComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEVICE_TYPE );
\r
1230 pDeviceTypeComboBox->RemoveAllItems();
\r
1232 CD3D11EnumAdapterInfo* pAdapterInfo = GetCurrentD3D11AdapterInfo();
\r
1233 if( pAdapterInfo == NULL )
\r
1236 for( int iDeviceInfo = 0; iDeviceInfo < pAdapterInfo->deviceInfoList.GetSize(); iDeviceInfo++ )
\r
1238 CD3D11EnumDeviceInfo* pDeviceInfo = pAdapterInfo->deviceInfoList.GetAt( iDeviceInfo );
\r
1239 AddD3D11DeviceType( pDeviceInfo->DeviceType );
\r
1242 pDeviceTypeComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.DriverType ) );
\r
1244 hr = OnDeviceTypeChanged();
\r
1245 if( FAILED( hr ) )
\r
1257 //-------------------------------------------------------------------------------------
\r
1258 HRESULT CD3DSettingsDlg::OnDeviceTypeChanged()
\r
1260 HRESULT hr = S_OK;
\r
1262 switch( g_DeviceSettings.ver )
\r
1264 case DXUT_D3D9_DEVICE:
\r
1266 g_DeviceSettings.d3d9.DeviceType = GetSelectedDeviceType();
\r
1268 // Update windowed/full screen radio buttons
\r
1269 bool bHasWindowedDeviceCombo = false;
\r
1270 bool bHasFullScreenDeviceCombo = false;
\r
1272 CD3D9EnumDeviceInfo* pDeviceInfo = GetCurrentDeviceInfo();
\r
1273 if( pDeviceInfo == NULL )
\r
1276 for( int idc = 0; idc < pDeviceInfo->deviceSettingsComboList.GetSize(); idc++ )
\r
1278 CD3D9EnumDeviceSettingsCombo* pDeviceSettingsCombo = pDeviceInfo->deviceSettingsComboList.GetAt( idc );
\r
1280 if( pDeviceSettingsCombo->Windowed )
\r
1281 bHasWindowedDeviceCombo = true;
\r
1283 bHasFullScreenDeviceCombo = true;
\r
1286 // DXUTSETTINGSDLG_WINDOWED, DXUTSETTINGSDLG_FULLSCREEN
\r
1287 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_WINDOWED, bHasWindowedDeviceCombo );
\r
1288 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_FULLSCREEN, bHasFullScreenDeviceCombo );
\r
1290 SetWindowed( g_DeviceSettings.d3d9.pp.Windowed && bHasWindowedDeviceCombo );
\r
1292 hr = OnWindowedFullScreenChanged();
\r
1293 if( FAILED( hr ) )
\r
1298 case DXUT_D3D11_DEVICE:
\r
1300 g_DeviceSettings.d3d11.DriverType = GetSelectedD3D11DeviceType();
\r
1302 // DXUTSETTINGSDLG_WINDOWED, DXUTSETTINGSDLG_FULLSCREEN
\r
1303 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_WINDOWED, true );
\r
1304 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_FULLSCREEN, true );
\r
1306 SetWindowed( g_DeviceSettings.d3d11.sd.Windowed != 0 );
\r
1308 hr = OnWindowedFullScreenChanged();
\r
1309 if( FAILED( hr ) )
\r
1321 //-------------------------------------------------------------------------------------
\r
1322 HRESULT CD3DSettingsDlg::OnWindowedFullScreenChanged()
\r
1324 HRESULT hr = S_OK;
\r
1325 bool bWindowed = IsWindowed();
\r
1327 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_ADAPTER_FORMAT_LABEL, !bWindowed );
\r
1328 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_RESOLUTION_LABEL, !bWindowed );
\r
1329 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_REFRESH_RATE_LABEL, !bWindowed );
\r
1330 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT_LABEL, !bWindowed );
\r
1331 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_D3D11_RESOLUTION_LABEL, !bWindowed );
\r
1332 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_D3D11_REFRESH_RATE_LABEL, !bWindowed );
\r
1334 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_ADAPTER_FORMAT, !bWindowed );
\r
1335 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_RESOLUTION, !bWindowed );
\r
1336 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL, !bWindowed );
\r
1337 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_REFRESH_RATE, !bWindowed );
\r
1338 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_DEVICECLIP, bWindowed );
\r
1339 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT, !bWindowed );
\r
1340 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_D3D11_RESOLUTION, !bWindowed );
\r
1341 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_D3D11_REFRESH_RATE, !bWindowed );
\r
1343 switch( g_DeviceSettings.ver )
\r
1345 case DXUT_D3D9_DEVICE:
\r
1347 g_DeviceSettings.d3d9.pp.Windowed = bWindowed;
\r
1348 bool bDeviceClip = ( 0x0 != ( g_DeviceSettings.d3d9.pp.Flags & D3DPRESENTFLAG_DEVICECLIP ) );
\r
1350 // If windowed, get the appropriate adapter format from Direct3D
\r
1351 if( g_DeviceSettings.d3d9.pp.Windowed )
\r
1353 IDirect3D9* pD3D = DXUTGetD3D9Object();
\r
1354 if( pD3D == NULL )
\r
1355 return DXTRACE_ERR( L"DXUTGetD3DObject", E_FAIL );
\r
1357 D3DDISPLAYMODE mode;
\r
1358 hr = pD3D->GetAdapterDisplayMode( g_DeviceSettings.d3d9.AdapterOrdinal, &mode );
\r
1359 if( FAILED( hr ) )
\r
1360 return DXTRACE_ERR( L"GetAdapterDisplayMode", hr );
\r
1362 // Default resolution to the fullscreen res that was last used
\r
1363 RECT rc = DXUTGetFullsceenClientRectAtModeChange();
\r
1364 if( rc.right == 0 || rc.bottom == 0 )
\r
1366 // If nothing last used, then default to the adapter desktop res
\r
1367 g_DeviceSettings.d3d9.pp.BackBufferWidth = mode.Width;
\r
1368 g_DeviceSettings.d3d9.pp.BackBufferHeight = mode.Height;
\r
1372 g_DeviceSettings.d3d9.pp.BackBufferWidth = rc.right;
\r
1373 g_DeviceSettings.d3d9.pp.BackBufferHeight = rc.bottom;
\r
1376 g_DeviceSettings.d3d9.AdapterFormat = mode.Format;
\r
1377 g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz = mode.RefreshRate;
\r
1380 const D3DFORMAT adapterFormat = g_DeviceSettings.d3d9.AdapterFormat;
\r
1381 const DWORD dwWidth = g_DeviceSettings.d3d9.pp.BackBufferWidth;
\r
1382 const DWORD dwHeight = g_DeviceSettings.d3d9.pp.BackBufferHeight;
\r
1383 const DWORD dwRefreshRate = g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz;
\r
1385 // DXUTSETTINGSDLG_DEVICECLIP
\r
1386 SetDeviceClip( bDeviceClip );
\r
1388 // DXUTSETTINGSDLG_ADAPTER_FORMAT
\r
1389 CDXUTComboBox* pAdapterFormatComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER_FORMAT );
\r
1390 if( pAdapterFormatComboBox == NULL )
\r
1392 pAdapterFormatComboBox->RemoveAllItems();
\r
1394 CD3D9EnumDeviceInfo* pDeviceInfo = GetCurrentDeviceInfo();
\r
1395 if( pDeviceInfo == NULL )
\r
1400 AddAdapterFormat( adapterFormat );
\r
1404 for( int iSettingsCombo = 0; iSettingsCombo < pDeviceInfo->deviceSettingsComboList.GetSize();
\r
1405 iSettingsCombo++ )
\r
1407 CD3D9EnumDeviceSettingsCombo* pSettingsCombo = pDeviceInfo->deviceSettingsComboList.GetAt(
\r
1409 AddAdapterFormat( pSettingsCombo->AdapterFormat );
\r
1413 pAdapterFormatComboBox->SetSelectedByData( ULongToPtr( adapterFormat ) );
\r
1415 hr = OnAdapterFormatChanged();
\r
1416 if( FAILED( hr ) )
\r
1419 // DXUTSETTINGSDLG_RESOLUTION
\r
1420 CDXUTComboBox* pResolutionComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_RESOLUTION );
\r
1424 pResolutionComboBox->RemoveAllItems();
\r
1425 AddResolution( dwWidth, dwHeight );
\r
1428 pResolutionComboBox->SetSelectedByData( ULongToPtr( MAKELONG( dwWidth, dwHeight ) ) );
\r
1430 hr = OnResolutionChanged();
\r
1431 if( FAILED( hr ) )
\r
1434 // DXUTSETTINGSDLG_REFRESH_RATE
\r
1435 CDXUTComboBox* pRefreshRateComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_REFRESH_RATE );
\r
1439 pRefreshRateComboBox->RemoveAllItems();
\r
1440 AddRefreshRate( dwRefreshRate );
\r
1443 pRefreshRateComboBox->SetSelectedByData( ULongToPtr( dwRefreshRate ) );
\r
1445 hr = OnRefreshRateChanged();
\r
1446 if( FAILED( hr ) )
\r
1452 case DXUT_D3D11_DEVICE:
\r
1454 g_DeviceSettings.d3d11.sd.Windowed = bWindowed;
\r
1456 // Get available adapter output
\r
1457 CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration();
\r
1459 CDXUTComboBox* pOutputComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT );
\r
1460 pOutputComboBox->RemoveAllItems();
\r
1462 CD3D11EnumAdapterInfo* pAdapterInfo = pD3DEnum->GetAdapterInfo( g_DeviceSettings.d3d11.AdapterOrdinal );
\r
1463 for( int ioutput = 0; ioutput < pAdapterInfo->outputInfoList.GetSize(); ++ioutput )
\r
1465 CD3D11EnumOutputInfo* pOutputInfo = pAdapterInfo->outputInfoList.GetAt( ioutput );
\r
1466 AddD3D11AdapterOutput( pOutputInfo->Desc.DeviceName, pOutputInfo->Output );
\r
1469 pOutputComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.Output ) );
\r
1471 hr = OnAdapterOutputChanged();
\r
1472 if( FAILED( hr ) )
\r
1483 //-------------------------------------------------------------------------------------
\r
1484 HRESULT CD3DSettingsDlg::OnAdapterOutputChanged()
\r
1488 switch( g_DeviceSettings.ver )
\r
1490 case DXUT_D3D11_DEVICE:
\r
1492 bool bWindowed = IsWindowed();
\r
1493 g_DeviceSettings.d3d11.sd.Windowed = bWindowed;
\r
1495 // If windowed, get the appropriate adapter format from Direct3D
\r
1496 if( g_DeviceSettings.d3d11.sd.Windowed )
\r
1498 DXGI_MODE_DESC mode;
\r
1499 hr = DXUTGetD3D11AdapterDisplayMode( g_DeviceSettings.d3d11.AdapterOrdinal,
\r
1500 g_DeviceSettings.d3d11.Output, &mode );
\r
1501 if( FAILED( hr ) )
\r
1502 return DXTRACE_ERR( L"GetD3D11AdapterDisplayMode", hr );
\r
1504 // Default resolution to the fullscreen res that was last used
\r
1505 RECT rc = DXUTGetFullsceenClientRectAtModeChange();
\r
1506 if( rc.right == 0 || rc.bottom == 0 )
\r
1508 // If nothing last used, then default to the adapter desktop res
\r
1509 g_DeviceSettings.d3d11.sd.BufferDesc.Width = mode.Width;
\r
1510 g_DeviceSettings.d3d11.sd.BufferDesc.Height = mode.Height;
\r
1514 g_DeviceSettings.d3d11.sd.BufferDesc.Width = rc.right;
\r
1515 g_DeviceSettings.d3d11.sd.BufferDesc.Height = rc.bottom;
\r
1518 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate = mode.RefreshRate;
\r
1521 const DXGI_RATIONAL RefreshRate = g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate;
\r
1523 CD3D11EnumAdapterInfo* pAdapterInfo = GetCurrentD3D11AdapterInfo();
\r
1524 if( pAdapterInfo == NULL )
\r
1527 // DXUTSETTINGSDLG_D3D11_RESOLUTION
\r
1528 hr = UpdateD3D11Resolutions();
\r
1529 if( FAILED( hr ) )
\r
1532 // DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT
\r
1533 CDXUTComboBox* pBackBufferFormatComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT
\r
1535 pBackBufferFormatComboBox->RemoveAllItems();
\r
1537 for( int idc = 0; idc < pAdapterInfo->deviceSettingsComboList.GetSize(); idc++ )
\r
1539 CD3D11EnumDeviceSettingsCombo* pDeviceCombo = pAdapterInfo->deviceSettingsComboList.GetAt( idc );
\r
1540 if( ( pDeviceCombo->Windowed == TRUE ) == bWindowed )
\r
1542 AddD3D11BackBufferFormat( pDeviceCombo->BackBufferFormat );
\r
1546 pBackBufferFormatComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.sd.BufferDesc.Format ) );
\r
1548 hr = OnBackBufferFormatChanged();
\r
1549 if( FAILED( hr ) )
\r
1552 // DXUTSETTINGSDLG_D3D11_REFRESH_RATE
\r
1555 CDXUTComboBox* pRefreshRateComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_REFRESH_RATE );
\r
1556 for( UINT i = 0; i < pRefreshRateComboBox->GetNumItems(); ++i )
\r
1558 DXGI_RATIONAL* pRefreshRate = reinterpret_cast<DXGI_RATIONAL*>(
\r
1559 pRefreshRateComboBox->GetItemData( i ) );
\r
1560 delete pRefreshRate;
\r
1562 pRefreshRateComboBox->RemoveAllItems();
\r
1563 AddD3D11RefreshRate( RefreshRate );
\r
1566 SetSelectedD3D11RefreshRate( RefreshRate );
\r
1571 hr = OnRefreshRateChanged();
\r
1572 if( FAILED( hr ) )
\r
1579 //-------------------------------------------------------------------------------------
\r
1580 HRESULT CD3DSettingsDlg::OnAdapterFormatChanged()
\r
1582 HRESULT hr = S_OK;
\r
1584 switch( g_DeviceSettings.ver )
\r
1586 case DXUT_D3D9_DEVICE:
\r
1588 // DXUTSETTINGSDLG_ADAPTER_FORMAT
\r
1589 D3DFORMAT adapterFormat = GetSelectedAdapterFormat();
\r
1590 g_DeviceSettings.d3d9.AdapterFormat = adapterFormat;
\r
1592 // DXUTSETTINGSDLG_RESOLUTION
\r
1593 CDXUTComboBox* pResolutionComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_RESOLUTION );
\r
1594 pResolutionComboBox->RemoveAllItems();
\r
1596 CD3D9EnumAdapterInfo* pAdapterInfo = GetCurrentAdapterInfo();
\r
1597 if( pAdapterInfo == NULL )
\r
1600 bool bShowAll = m_Dialog.GetCheckBox( DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL )->GetChecked();
\r
1602 // Get the desktop aspect ratio
\r
1603 D3DDISPLAYMODE dmDesktop;
\r
1604 DXUTGetDesktopResolution( g_DeviceSettings.d3d9.AdapterOrdinal, &dmDesktop.Width, &dmDesktop.Height );
\r
1605 float fDesktopAspectRatio = dmDesktop.Width / ( float )dmDesktop.Height;
\r
1607 for( int idm = 0; idm < pAdapterInfo->displayModeList.GetSize(); idm++ )
\r
1609 D3DDISPLAYMODE DisplayMode = pAdapterInfo->displayModeList.GetAt( idm );
\r
1610 float fAspect = ( float )DisplayMode.Width / ( float )DisplayMode.Height;
\r
1612 if( DisplayMode.Format == g_DeviceSettings.d3d9.AdapterFormat )
\r
1614 // If "Show All" is not checked, then hide all resolutions
\r
1615 // that don't match the aspect ratio of the desktop resolution
\r
1616 if( bShowAll || ( !bShowAll && fabsf( fDesktopAspectRatio - fAspect ) < 0.05f ) )
\r
1618 AddResolution( DisplayMode.Width, DisplayMode.Height );
\r
1623 const DWORD dwCurResolution = MAKELONG( g_DeviceSettings.d3d9.pp.BackBufferWidth,
\r
1624 g_DeviceSettings.d3d9.pp.BackBufferHeight );
\r
1626 pResolutionComboBox->SetSelectedByData( ULongToPtr( dwCurResolution ) );
\r
1628 hr = OnResolutionChanged();
\r
1629 if( FAILED( hr ) )
\r
1632 // DXUTSETTINGSDLG_BACK_BUFFER_FORMAT
\r
1633 CDXUTComboBox* pBackBufferFormatComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT );
\r
1634 pBackBufferFormatComboBox->RemoveAllItems();
\r
1636 CD3D9EnumDeviceInfo* pDeviceInfo = GetCurrentDeviceInfo();
\r
1637 if( pDeviceInfo == NULL )
\r
1640 const BOOL bWindowed = IsWindowed();
\r
1641 bool bHasWindowedBackBuffer = false;
\r
1643 for( int idc = 0; idc < pDeviceInfo->deviceSettingsComboList.GetSize(); idc++ )
\r
1645 CD3D9EnumDeviceSettingsCombo* pDeviceCombo = pDeviceInfo->deviceSettingsComboList.GetAt( idc );
\r
1646 if( pDeviceCombo->Windowed == bWindowed &&
\r
1647 pDeviceCombo->AdapterFormat == g_DeviceSettings.d3d9.AdapterFormat )
\r
1649 AddBackBufferFormat( pDeviceCombo->BackBufferFormat );
\r
1650 bHasWindowedBackBuffer = true;
\r
1654 pBackBufferFormatComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d9.pp.BackBufferFormat ) );
\r
1656 hr = OnBackBufferFormatChanged();
\r
1657 if( FAILED( hr ) )
\r
1660 if( !bHasWindowedBackBuffer )
\r
1662 m_Dialog.SetControlEnabled( DXUTSETTINGSDLG_WINDOWED, false );
\r
1664 if( g_DeviceSettings.d3d9.pp.Windowed )
\r
1666 SetWindowed( false );
\r
1668 hr = OnWindowedFullScreenChanged();
\r
1669 if( FAILED( hr ) )
\r
1682 //-------------------------------------------------------------------------------------
\r
1683 HRESULT CD3DSettingsDlg::OnResolutionChanged()
\r
1685 HRESULT hr = S_OK;
\r
1687 CD3D9EnumAdapterInfo* pAdapterInfo = GetCurrentAdapterInfo();
\r
1688 if( pAdapterInfo == NULL )
\r
1692 DWORD dwWidth, dwHeight;
\r
1693 GetSelectedResolution( &dwWidth, &dwHeight );
\r
1694 g_DeviceSettings.d3d9.pp.BackBufferWidth = dwWidth;
\r
1695 g_DeviceSettings.d3d9.pp.BackBufferHeight = dwHeight;
\r
1697 DWORD dwRefreshRate = g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz;
\r
1699 // Update the refresh rate list
\r
1700 CDXUTComboBox* pRefreshRateComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_REFRESH_RATE );
\r
1701 pRefreshRateComboBox->RemoveAllItems();
\r
1703 D3DFORMAT adapterFormat = g_DeviceSettings.d3d9.AdapterFormat;
\r
1704 for( int idm = 0; idm < pAdapterInfo->displayModeList.GetSize(); idm++ )
\r
1706 D3DDISPLAYMODE displayMode = pAdapterInfo->displayModeList.GetAt( idm );
\r
1708 if( displayMode.Format == adapterFormat &&
\r
1709 displayMode.Width == dwWidth &&
\r
1710 displayMode.Height == dwHeight )
\r
1712 AddRefreshRate( displayMode.RefreshRate );
\r
1716 pRefreshRateComboBox->SetSelectedByData( ULongToPtr( dwRefreshRate ) );
\r
1718 hr = OnRefreshRateChanged();
\r
1719 if( FAILED( hr ) )
\r
1727 //-------------------------------------------------------------------------------------
\r
1728 HRESULT CD3DSettingsDlg::OnRefreshRateChanged()
\r
1730 // Set refresh rate
\r
1731 switch( g_DeviceSettings.ver )
\r
1733 case DXUT_D3D9_DEVICE:
\r
1734 g_DeviceSettings.d3d9.pp.FullScreen_RefreshRateInHz = GetSelectedRefreshRate();
\r
1737 case DXUT_D3D11_DEVICE:
\r
1738 g_DeviceSettings.d3d11.sd.BufferDesc.RefreshRate = GetSelectedD3D11RefreshRate();
\r
1746 //-------------------------------------------------------------------------------------
\r
1747 HRESULT CD3DSettingsDlg::OnBackBufferFormatChanged()
\r
1749 HRESULT hr = S_OK;
\r
1751 switch( g_DeviceSettings.ver )
\r
1753 case DXUT_D3D9_DEVICE:
\r
1755 g_DeviceSettings.d3d9.pp.BackBufferFormat = GetSelectedBackBufferFormat();
\r
1757 D3DFORMAT adapterFormat = g_DeviceSettings.d3d9.AdapterFormat;
\r
1758 D3DFORMAT backBufferFormat = g_DeviceSettings.d3d9.pp.BackBufferFormat;
\r
1760 CD3D9EnumDeviceInfo* pDeviceInfo = GetCurrentDeviceInfo();
\r
1761 if( pDeviceInfo == NULL )
\r
1764 bool bAllowSoftwareVP, bAllowHardwareVP, bAllowPureHardwareVP, bAllowMixedVP;
\r
1765 DXUTGetD3D9Enumeration()->GetPossibleVertexProcessingList( &bAllowSoftwareVP, &bAllowHardwareVP,
\r
1766 &bAllowPureHardwareVP, &bAllowMixedVP );
\r
1768 for( int idc = 0; idc < pDeviceInfo->deviceSettingsComboList.GetSize(); idc++ )
\r
1770 CD3D9EnumDeviceSettingsCombo* pDeviceCombo = pDeviceInfo->deviceSettingsComboList.GetAt( idc );
\r
1772 if( pDeviceCombo->Windowed == ( g_DeviceSettings.d3d9.pp.Windowed == TRUE ) &&
\r
1773 pDeviceCombo->AdapterFormat == adapterFormat &&
\r
1774 pDeviceCombo->BackBufferFormat == backBufferFormat )
\r
1776 CDXUTComboBox* pDepthStencilComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEPTH_STENCIL );
\r
1777 pDepthStencilComboBox->RemoveAllItems();
\r
1778 pDepthStencilComboBox->SetEnabled( ( g_DeviceSettings.d3d9.pp.EnableAutoDepthStencil == TRUE ) );
\r
1780 if( g_DeviceSettings.d3d9.pp.EnableAutoDepthStencil )
\r
1782 for( int ifmt = 0; ifmt < pDeviceCombo->depthStencilFormatList.GetSize(); ifmt++ )
\r
1784 D3DFORMAT fmt = pDeviceCombo->depthStencilFormatList.GetAt( ifmt );
\r
1786 AddDepthStencilBufferFormat( fmt );
\r
1789 pDepthStencilComboBox->SetSelectedByData( ULongToPtr(
\r
1790 g_DeviceSettings.d3d9.pp.AutoDepthStencilFormat ) );
\r
1794 if( !pDepthStencilComboBox->ContainsItem( L"(not used)" ) )
\r
1795 pDepthStencilComboBox->AddItem( L"(not used)", NULL );
\r
1798 hr = OnDepthStencilBufferFormatChanged();
\r
1799 if( FAILED( hr ) )
\r
1802 CDXUTComboBox* pVertexProcessingComboBox =
\r
1803 m_Dialog.GetComboBox( DXUTSETTINGSDLG_VERTEX_PROCESSING );
\r
1804 pVertexProcessingComboBox->RemoveAllItems();
\r
1806 // Add valid vertex processing types
\r
1807 if( bAllowSoftwareVP )
\r
1808 AddVertexProcessingType( D3DCREATE_SOFTWARE_VERTEXPROCESSING );
\r
1810 if( bAllowHardwareVP && pDeviceInfo->Caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
\r
1811 AddVertexProcessingType( D3DCREATE_HARDWARE_VERTEXPROCESSING );
\r
1813 if( bAllowPureHardwareVP && pDeviceInfo->Caps.DevCaps & D3DDEVCAPS_PUREDEVICE )
\r
1814 AddVertexProcessingType( D3DCREATE_PUREDEVICE );
\r
1816 if( bAllowMixedVP && pDeviceInfo->Caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
\r
1817 AddVertexProcessingType( D3DCREATE_MIXED_VERTEXPROCESSING );
\r
1819 if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_PUREDEVICE )
\r
1820 pVertexProcessingComboBox->SetSelectedByData( ULongToPtr( D3DCREATE_PUREDEVICE ) );
\r
1821 else if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING )
\r
1822 pVertexProcessingComboBox->SetSelectedByData( ULongToPtr(
\r
1823 D3DCREATE_SOFTWARE_VERTEXPROCESSING ) );
\r
1824 else if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING )
\r
1825 pVertexProcessingComboBox->SetSelectedByData( ULongToPtr(
\r
1826 D3DCREATE_HARDWARE_VERTEXPROCESSING ) );
\r
1827 else if( g_DeviceSettings.d3d9.BehaviorFlags & D3DCREATE_MIXED_VERTEXPROCESSING )
\r
1828 pVertexProcessingComboBox->SetSelectedByData( ULongToPtr( D3DCREATE_MIXED_VERTEXPROCESSING ) );
\r
1830 hr = OnVertexProcessingChanged();
\r
1831 if( FAILED( hr ) )
\r
1834 CDXUTComboBox* pPresentIntervalComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_PRESENT_INTERVAL );
\r
1835 pPresentIntervalComboBox->RemoveAllItems();
\r
1836 pPresentIntervalComboBox->AddItem( L"On", ULongToPtr( D3DPRESENT_INTERVAL_DEFAULT ) );
\r
1837 pPresentIntervalComboBox->AddItem( L"Off", ULongToPtr( D3DPRESENT_INTERVAL_IMMEDIATE ) );
\r
1839 pPresentIntervalComboBox->SetSelectedByData( ULongToPtr(
\r
1840 g_DeviceSettings.d3d9.pp.PresentationInterval ) );
\r
1842 hr = OnPresentIntervalChanged();
\r
1843 if( FAILED( hr ) )
\r
1851 case DXUT_D3D11_DEVICE:
\r
1853 g_DeviceSettings.d3d11.sd.BufferDesc.Format = GetSelectedD3D11BackBufferFormat();
\r
1855 DXGI_FORMAT backBufferFormat = g_DeviceSettings.d3d11.sd.BufferDesc.Format;
\r
1857 CD3D11EnumAdapterInfo* pAdapterInfo = GetCurrentD3D11AdapterInfo();
\r
1858 if( pAdapterInfo == NULL )
\r
1861 for( int idc = 0; idc < pAdapterInfo->deviceSettingsComboList.GetSize(); idc++ )
\r
1863 CD3D11EnumDeviceSettingsCombo* pDeviceCombo = pAdapterInfo->deviceSettingsComboList.GetAt( idc );
\r
1865 if( pDeviceCombo->Windowed == ( g_DeviceSettings.d3d11.sd.Windowed == TRUE ) &&
\r
1866 pDeviceCombo->BackBufferFormat == backBufferFormat &&
\r
1867 pDeviceCombo->DeviceType == g_DeviceSettings.d3d11.DriverType )
\r
1869 CDXUTComboBox* pMultisampleCountCombo = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT
\r
1871 pMultisampleCountCombo->RemoveAllItems();
\r
1872 for( int i = 0; i < pDeviceCombo->multiSampleCountList.GetSize(); ++i )
\r
1873 AddD3D11MultisampleCount( pDeviceCombo->multiSampleCountList.GetAt( i ) );
\r
1874 pMultisampleCountCombo->SetSelectedByData( ULongToPtr(
\r
1875 g_DeviceSettings.d3d11.sd.SampleDesc.Count ) );
\r
1877 hr = OnMultisampleTypeChanged();
\r
1878 if( FAILED( hr ) )
\r
1881 CDXUTComboBox* pPresentIntervalComboBox =
\r
1882 m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL );
\r
1883 pPresentIntervalComboBox->RemoveAllItems();
\r
1884 pPresentIntervalComboBox->AddItem( L"On", ULongToPtr( 1 ) );
\r
1885 pPresentIntervalComboBox->AddItem( L"Off", ULongToPtr( 0 ) );
\r
1887 pPresentIntervalComboBox->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.SyncInterval ) );
\r
1889 hr = OnPresentIntervalChanged();
\r
1890 if( FAILED( hr ) )
\r
1893 hr = UpdateD3D11Resolutions();
\r
1894 if( FAILED( hr ) )
\r
1907 //-------------------------------------------------------------------------------------
\r
1908 HRESULT CD3DSettingsDlg::OnDepthStencilBufferFormatChanged()
\r
1910 HRESULT hr = S_OK;
\r
1912 D3DFORMAT depthStencilBufferFormat = GetSelectedDepthStencilBufferFormat();
\r
1914 if( g_DeviceSettings.d3d9.pp.EnableAutoDepthStencil )
\r
1915 g_DeviceSettings.d3d9.pp.AutoDepthStencilFormat = depthStencilBufferFormat;
\r
1917 CD3D9EnumDeviceSettingsCombo* pDeviceSettingsCombo = GetCurrentDeviceSettingsCombo();
\r
1918 if( pDeviceSettingsCombo == NULL )
\r
1921 CDXUTComboBox* pMultisampleTypeCombo = m_Dialog.GetComboBox( DXUTSETTINGSDLG_MULTISAMPLE_TYPE );
\r
1922 pMultisampleTypeCombo->RemoveAllItems();
\r
1924 for( int ims = 0; ims < pDeviceSettingsCombo->multiSampleTypeList.GetSize(); ims++ )
\r
1926 D3DMULTISAMPLE_TYPE msType = pDeviceSettingsCombo->multiSampleTypeList.GetAt( ims );
\r
1928 bool bConflictFound = false;
\r
1929 for( int iConf = 0; iConf < pDeviceSettingsCombo->DSMSConflictList.GetSize(); iConf++ )
\r
1931 CD3D9EnumDSMSConflict DSMSConf = pDeviceSettingsCombo->DSMSConflictList.GetAt( iConf );
\r
1932 if( DSMSConf.DSFormat == depthStencilBufferFormat &&
\r
1933 DSMSConf.MSType == msType )
\r
1935 bConflictFound = true;
\r
1940 if( !bConflictFound )
\r
1941 AddMultisampleType( msType );
\r
1944 CDXUTComboBox* pMultisampleQualityCombo = m_Dialog.GetComboBox( DXUTSETTINGSDLG_MULTISAMPLE_TYPE );
\r
1945 pMultisampleQualityCombo->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d9.pp.MultiSampleType ) );
\r
1947 hr = OnMultisampleTypeChanged();
\r
1948 if( FAILED( hr ) )
\r
1955 //-------------------------------------------------------------------------------------
\r
1956 HRESULT CD3DSettingsDlg::OnMultisampleTypeChanged()
\r
1958 HRESULT hr = S_OK;
\r
1960 switch( g_DeviceSettings.ver )
\r
1962 case DXUT_D3D9_DEVICE:
\r
1964 D3DMULTISAMPLE_TYPE multisampleType = GetSelectedMultisampleType();
\r
1965 g_DeviceSettings.d3d9.pp.MultiSampleType = multisampleType;
\r
1967 CD3D9EnumDeviceSettingsCombo* pDeviceSettingsCombo = GetCurrentDeviceSettingsCombo();
\r
1968 if( pDeviceSettingsCombo == NULL )
\r
1971 DWORD dwMaxQuality = 0;
\r
1972 for( int iType = 0; iType < pDeviceSettingsCombo->multiSampleTypeList.GetSize(); iType++ )
\r
1974 D3DMULTISAMPLE_TYPE msType = pDeviceSettingsCombo->multiSampleTypeList.GetAt( iType );
\r
1975 if( msType == multisampleType )
\r
1977 dwMaxQuality = pDeviceSettingsCombo->multiSampleQualityList.GetAt( iType );
\r
1982 // DXUTSETTINGSDLG_MULTISAMPLE_QUALITY
\r
1983 CDXUTComboBox* pMultisampleQualityCombo = m_Dialog.GetComboBox( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY );
\r
1984 pMultisampleQualityCombo->RemoveAllItems();
\r
1986 for( UINT iQuality = 0; iQuality < dwMaxQuality; iQuality++ )
\r
1988 AddMultisampleQuality( iQuality );
\r
1991 pMultisampleQualityCombo->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d9.pp.MultiSampleQuality ) );
\r
1993 hr = OnMultisampleQualityChanged();
\r
1994 if( FAILED( hr ) )
\r
1999 case DXUT_D3D11_DEVICE:
\r
2001 UINT multisampleCount = GetSelectedD3D11MultisampleCount();
\r
2002 g_DeviceSettings.d3d11.sd.SampleDesc.Count = multisampleCount;
\r
2004 CD3D11EnumDeviceSettingsCombo* pDeviceSettingsCombo = GetCurrentD3D11DeviceSettingsCombo();
\r
2005 if( pDeviceSettingsCombo == NULL )
\r
2008 UINT MaxQuality = 0;
\r
2009 for( int iCount = 0; iCount < pDeviceSettingsCombo->multiSampleCountList.GetSize(); iCount++ )
\r
2011 UINT Count = pDeviceSettingsCombo->multiSampleCountList.GetAt( iCount );
\r
2012 if( Count == multisampleCount )
\r
2014 MaxQuality = pDeviceSettingsCombo->multiSampleQualityList.GetAt( iCount );
\r
2019 // DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY
\r
2020 CDXUTComboBox* pMultisampleQualityCombo = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY
\r
2022 pMultisampleQualityCombo->RemoveAllItems();
\r
2024 for( UINT iQuality = 0; iQuality < MaxQuality; iQuality++ )
\r
2026 AddD3D11MultisampleQuality( iQuality );
\r
2029 pMultisampleQualityCombo->SetSelectedByData( ULongToPtr( g_DeviceSettings.d3d11.sd.SampleDesc.Quality ) );
\r
2031 hr = OnMultisampleQualityChanged();
\r
2032 if( FAILED( hr ) )
\r
2043 //-------------------------------------------------------------------------------------
\r
2044 HRESULT CD3DSettingsDlg::OnMultisampleQualityChanged()
\r
2046 switch( g_DeviceSettings.ver )
\r
2048 case DXUT_D3D9_DEVICE:
\r
2049 g_DeviceSettings.d3d9.pp.MultiSampleQuality = GetSelectedMultisampleQuality();
\r
2052 case DXUT_D3D11_DEVICE:
\r
2053 g_DeviceSettings.d3d11.sd.SampleDesc.Quality = GetSelectedD3D11MultisampleQuality();
\r
2061 //-------------------------------------------------------------------------------------
\r
2062 HRESULT CD3DSettingsDlg::OnVertexProcessingChanged()
\r
2064 DWORD dwBehavior = g_DeviceSettings.d3d9.BehaviorFlags;
\r
2066 // Clear vertex processing flags
\r
2067 dwBehavior &= ~D3DCREATE_HARDWARE_VERTEXPROCESSING;
\r
2068 dwBehavior &= ~D3DCREATE_SOFTWARE_VERTEXPROCESSING;
\r
2069 dwBehavior &= ~D3DCREATE_MIXED_VERTEXPROCESSING;
\r
2070 dwBehavior &= ~D3DCREATE_PUREDEVICE;
\r
2072 // Determine new flags
\r
2073 DWORD dwNewFlags = GetSelectedVertexProcessingType();
\r
2074 if( dwNewFlags & D3DCREATE_PUREDEVICE )
\r
2075 dwNewFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
\r
2078 g_DeviceSettings.d3d9.BehaviorFlags = dwBehavior | dwNewFlags;
\r
2084 //-------------------------------------------------------------------------------------
\r
2085 HRESULT CD3DSettingsDlg::OnPresentIntervalChanged()
\r
2087 switch( g_DeviceSettings.ver )
\r
2089 case DXUT_D3D9_DEVICE:
\r
2090 g_DeviceSettings.d3d9.pp.PresentationInterval = GetSelectedPresentInterval();
\r
2093 case DXUT_D3D11_DEVICE:
\r
2094 g_DeviceSettings.d3d11.SyncInterval = GetSelectedD3D11PresentInterval();
\r
2102 //-------------------------------------------------------------------------------------
\r
2103 HRESULT CD3DSettingsDlg::OnDebugDeviceChanged()
\r
2105 bool bDebugDevice = GetSelectedDebugDeviceValue();
\r
2107 if( bDebugDevice )
\r
2108 g_DeviceSettings.d3d11.CreateFlags |= D3D11_CREATE_DEVICE_DEBUG;
\r
2110 g_DeviceSettings.d3d11.CreateFlags &= ~D3D11_CREATE_DEVICE_DEBUG;
\r
2115 //-------------------------------------------------------------------------------------
\r
2116 HRESULT CD3DSettingsDlg::OnDeviceClipChanged()
\r
2118 if( IsDeviceClip() )
\r
2119 g_DeviceSettings.d3d9.pp.Flags |= D3DPRESENTFLAG_DEVICECLIP;
\r
2121 g_DeviceSettings.d3d9.pp.Flags &= ~D3DPRESENTFLAG_DEVICECLIP;
\r
2127 //-------------------------------------------------------------------------------------
\r
2128 void CD3DSettingsDlg::AddAPIVersion( DXUTDeviceVersion version )
\r
2130 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_API_VERSION );
\r
2132 if( !pComboBox->ContainsItem( DXUTAPIVersionToString( version ) ) )
\r
2133 pComboBox->AddItem( DXUTAPIVersionToString( version ), ULongToPtr( version ) );
\r
2137 //-------------------------------------------------------------------------------------
\r
2138 DXUTDeviceVersion CD3DSettingsDlg::GetSelectedAPIVersion()
\r
2140 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_API_VERSION );
\r
2142 return ( DXUTDeviceVersion )PtrToUlong( pComboBox->GetSelectedData() );
\r
2146 //-------------------------------------------------------------------------------------
\r
2147 void CD3DSettingsDlg::AddAdapter( const WCHAR* strDescription, UINT iAdapter )
\r
2149 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER );
\r
2151 if( !pComboBox->ContainsItem( strDescription ) )
\r
2152 pComboBox->AddItem( strDescription, ULongToPtr( iAdapter ) );
\r
2156 //-------------------------------------------------------------------------------------
\r
2157 UINT CD3DSettingsDlg::GetSelectedAdapter()
\r
2159 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER );
\r
2161 return PtrToUlong( pComboBox->GetSelectedData() );
\r
2165 //-------------------------------------------------------------------------------------
\r
2166 void CD3DSettingsDlg::AddDeviceType( D3DDEVTYPE devType )
\r
2168 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEVICE_TYPE );
\r
2170 if( !pComboBox->ContainsItem( DXUTD3DDeviceTypeToString( devType ) ) )
\r
2171 pComboBox->AddItem( DXUTD3DDeviceTypeToString( devType ), ULongToPtr( devType ) );
\r
2175 //-------------------------------------------------------------------------------------
\r
2176 D3DDEVTYPE CD3DSettingsDlg::GetSelectedDeviceType()
\r
2178 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEVICE_TYPE );
\r
2180 return ( D3DDEVTYPE )PtrToUlong( pComboBox->GetSelectedData() );
\r
2184 //-------------------------------------------------------------------------------------
\r
2185 void CD3DSettingsDlg::SetWindowed( bool bWindowed )
\r
2187 CDXUTRadioButton* pRadioButton = m_Dialog.GetRadioButton( DXUTSETTINGSDLG_WINDOWED );
\r
2188 pRadioButton->SetChecked( bWindowed );
\r
2190 pRadioButton = m_Dialog.GetRadioButton( DXUTSETTINGSDLG_FULLSCREEN );
\r
2191 pRadioButton->SetChecked( !bWindowed );
\r
2195 //-------------------------------------------------------------------------------------
\r
2196 bool CD3DSettingsDlg::IsWindowed()
\r
2198 CDXUTRadioButton* pRadioButton = m_Dialog.GetRadioButton( DXUTSETTINGSDLG_WINDOWED );
\r
2199 return pRadioButton->GetChecked();
\r
2203 //-------------------------------------------------------------------------------------
\r
2204 void CD3DSettingsDlg::AddAdapterFormat( D3DFORMAT format )
\r
2206 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER_FORMAT );
\r
2208 if( !pComboBox->ContainsItem( DXUTD3DFormatToString( format, TRUE ) ) )
\r
2209 pComboBox->AddItem( DXUTD3DFormatToString( format, TRUE ), ULongToPtr( format ) );
\r
2213 //-------------------------------------------------------------------------------------
\r
2214 D3DFORMAT CD3DSettingsDlg::GetSelectedAdapterFormat()
\r
2216 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_ADAPTER_FORMAT );
\r
2218 return ( D3DFORMAT )PtrToUlong( pComboBox->GetSelectedData() );
\r
2222 //-------------------------------------------------------------------------------------
\r
2223 void CD3DSettingsDlg::AddD3D11AdapterOutput( const WCHAR* strName, UINT Output )
\r
2225 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT );
\r
2227 if( !pComboBox->ContainsItem( strName ) )
\r
2228 pComboBox->AddItem( strName, ULongToPtr( Output ) );
\r
2232 //-------------------------------------------------------------------------------------
\r
2233 UINT CD3DSettingsDlg::GetSelectedD3D11AdapterOutput()
\r
2235 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT );
\r
2237 return PtrToUlong( pComboBox->GetSelectedData() );
\r
2241 //-------------------------------------------------------------------------------------
\r
2242 void CD3DSettingsDlg::AddResolution( DWORD dwWidth, DWORD dwHeight )
\r
2244 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_RESOLUTION );
\r
2246 DWORD dwResolutionData;
\r
2247 WCHAR strResolution[50];
\r
2248 dwResolutionData = MAKELONG( dwWidth, dwHeight );
\r
2249 swprintf_s( strResolution, 50, L"%d by %d", dwWidth, dwHeight );
\r
2251 if( !pComboBox->ContainsItem( strResolution ) )
\r
2252 pComboBox->AddItem( strResolution, ULongToPtr( dwResolutionData ) );
\r
2256 //-------------------------------------------------------------------------------------
\r
2257 void CD3DSettingsDlg::GetSelectedResolution( DWORD* pdwWidth, DWORD* pdwHeight )
\r
2259 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_RESOLUTION );
\r
2261 DWORD dwResolution = PtrToUlong( pComboBox->GetSelectedData() );
\r
2263 *pdwWidth = LOWORD( dwResolution );
\r
2264 *pdwHeight = HIWORD( dwResolution );
\r
2268 //-------------------------------------------------------------------------------------
\r
2269 void CD3DSettingsDlg::AddD3D11Resolution( DWORD dwWidth, DWORD dwHeight )
\r
2271 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_RESOLUTION );
\r
2273 DWORD dwResolutionData;
\r
2274 WCHAR strResolution[50];
\r
2275 dwResolutionData = MAKELONG( dwWidth, dwHeight );
\r
2276 swprintf_s( strResolution, 50, L"%d by %d", dwWidth, dwHeight );
\r
2278 if( !pComboBox->ContainsItem( strResolution ) )
\r
2279 pComboBox->AddItem( strResolution, ULongToPtr( dwResolutionData ) );
\r
2283 //-------------------------------------------------------------------------------------
\r
2284 void CD3DSettingsDlg::GetSelectedD3D11Resolution( DWORD* pdwWidth, DWORD* pdwHeight )
\r
2286 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_RESOLUTION );
\r
2288 DWORD dwResolution = PtrToUlong( pComboBox->GetSelectedData() );
\r
2290 *pdwWidth = LOWORD( dwResolution );
\r
2291 *pdwHeight = HIWORD( dwResolution );
\r
2294 void CD3DSettingsDlg::AddD3D11FeatureLevel(D3D_FEATURE_LEVEL fl) {
\r
2295 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL );
\r
2298 case D3D_FEATURE_LEVEL_9_1:
\r
2300 if( !pComboBox->ContainsItem( L"D3D_FEATURE_LEVEL_9_1" ) )
\r
2301 pComboBox->AddItem( L"D3D_FEATURE_LEVEL_9_1", ULongToPtr( D3D_FEATURE_LEVEL_9_1 ) );
\r
2304 case D3D_FEATURE_LEVEL_9_2:
\r
2306 if( !pComboBox->ContainsItem( L"D3D_FEATURE_LEVEL_9_2" ) )
\r
2307 pComboBox->AddItem( L"D3D_FEATURE_LEVEL_9_2", ULongToPtr( D3D_FEATURE_LEVEL_9_2 ) );
\r
2310 case D3D_FEATURE_LEVEL_9_3:
\r
2312 if( !pComboBox->ContainsItem( L"D3D_FEATURE_LEVEL_9_3" ) )
\r
2313 pComboBox->AddItem( L"D3D_FEATURE_LEVEL_9_3", ULongToPtr( D3D_FEATURE_LEVEL_9_3 ) );
\r
2316 case D3D_FEATURE_LEVEL_10_0:
\r
2318 if( !pComboBox->ContainsItem( L"D3D_FEATURE_LEVEL_10_0" ) )
\r
2319 pComboBox->AddItem( L"D3D_FEATURE_LEVEL_10_0", ULongToPtr( D3D_FEATURE_LEVEL_10_0 ) );
\r
2322 case D3D_FEATURE_LEVEL_10_1:
\r
2324 if( !pComboBox->ContainsItem( L"D3D_FEATURE_LEVEL_10_1" ) )
\r
2325 pComboBox->AddItem( L"D3D_FEATURE_LEVEL_10_1", ULongToPtr( D3D_FEATURE_LEVEL_10_1 ) );
\r
2328 case D3D_FEATURE_LEVEL_11_0:
\r
2330 if( !pComboBox->ContainsItem( L"D3D_FEATURE_LEVEL_11_0" ) )
\r
2331 pComboBox->AddItem( L"D3D_FEATURE_LEVEL_11_0", ULongToPtr( D3D_FEATURE_LEVEL_11_0 ) );
\r
2338 D3D_FEATURE_LEVEL CD3DSettingsDlg::GetSelectedFeatureLevel() {
\r
2339 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL );
\r
2341 return (D3D_FEATURE_LEVEL)PtrToUlong( pComboBox->GetSelectedData() );
\r
2343 //-------------------------------------------------------------------------------------
\r
2344 void CD3DSettingsDlg::AddRefreshRate( DWORD dwRate )
\r
2346 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_REFRESH_RATE );
\r
2348 WCHAR strRefreshRate[50];
\r
2351 wcscpy_s( strRefreshRate, 50, L"Default Rate" );
\r
2353 swprintf_s( strRefreshRate, 50, L"%d Hz", dwRate );
\r
2355 if( !pComboBox->ContainsItem( strRefreshRate ) )
\r
2356 pComboBox->AddItem( strRefreshRate, ULongToPtr( dwRate ) );
\r
2360 //-------------------------------------------------------------------------------------
\r
2361 DWORD CD3DSettingsDlg::GetSelectedRefreshRate()
\r
2363 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_REFRESH_RATE );
\r
2365 return PtrToUlong( pComboBox->GetSelectedData() );
\r
2369 //-------------------------------------------------------------------------------------
\r
2370 void CD3DSettingsDlg::AddD3D11RefreshRate( DXGI_RATIONAL RefreshRate )
\r
2372 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_REFRESH_RATE );
\r
2374 WCHAR strRefreshRate[50];
\r
2376 if( RefreshRate.Numerator == 0 && RefreshRate.Denominator == 0 )
\r
2377 wcscpy_s( strRefreshRate, 50, L"Default Rate" );
\r
2379 swprintf_s( strRefreshRate, 50, L"%d Hz", RefreshRate.Numerator / RefreshRate.Denominator );
\r
2381 if( !pComboBox->ContainsItem( strRefreshRate ) )
\r
2383 DXGI_RATIONAL* pNewRate = new DXGI_RATIONAL;
\r
2386 *pNewRate = RefreshRate;
\r
2387 pComboBox->AddItem( strRefreshRate, pNewRate );
\r
2393 //-------------------------------------------------------------------------------------
\r
2394 DXGI_RATIONAL CD3DSettingsDlg::GetSelectedD3D11RefreshRate()
\r
2396 DXGI_RATIONAL dxgiR;
\r
2397 dxgiR.Numerator = 0;
\r
2398 dxgiR.Denominator = 1;
\r
2400 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_REFRESH_RATE );
\r
2402 return *reinterpret_cast<DXGI_RATIONAL*>( pComboBox->GetSelectedData() );
\r
2407 //-------------------------------------------------------------------------------------
\r
2408 void CD3DSettingsDlg::AddBackBufferFormat( D3DFORMAT format )
\r
2410 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT );
\r
2412 if( !pComboBox->ContainsItem( DXUTD3DFormatToString( format, TRUE ) ) )
\r
2413 pComboBox->AddItem( DXUTD3DFormatToString( format, TRUE ), ULongToPtr( format ) );
\r
2417 //-------------------------------------------------------------------------------------
\r
2418 D3DFORMAT CD3DSettingsDlg::GetSelectedBackBufferFormat()
\r
2420 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_BACK_BUFFER_FORMAT );
\r
2422 return ( D3DFORMAT )PtrToUlong( pComboBox->GetSelectedData() );
\r
2426 //-------------------------------------------------------------------------------------
\r
2427 void CD3DSettingsDlg::AddD3D11BackBufferFormat( DXGI_FORMAT format )
\r
2429 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT );
\r
2431 if( !pComboBox->ContainsItem( DXUTDXGIFormatToString( format, TRUE ) ) )
\r
2432 pComboBox->AddItem( DXUTDXGIFormatToString( format, TRUE ), ULongToPtr( format ) );
\r
2436 //-------------------------------------------------------------------------------------
\r
2437 DXGI_FORMAT CD3DSettingsDlg::GetSelectedD3D11BackBufferFormat()
\r
2439 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT );
\r
2441 return ( DXGI_FORMAT )PtrToUlong( pComboBox->GetSelectedData() );
\r
2445 //-------------------------------------------------------------------------------------
\r
2446 void CD3DSettingsDlg::AddDepthStencilBufferFormat( D3DFORMAT format )
\r
2448 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEPTH_STENCIL );
\r
2450 if( !pComboBox->ContainsItem( DXUTD3DFormatToString( format, TRUE ) ) )
\r
2451 pComboBox->AddItem( DXUTD3DFormatToString( format, TRUE ), ULongToPtr( format ) );
\r
2455 //-------------------------------------------------------------------------------------
\r
2456 D3DFORMAT CD3DSettingsDlg::GetSelectedDepthStencilBufferFormat()
\r
2458 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEPTH_STENCIL );
\r
2460 return ( D3DFORMAT )PtrToUlong( pComboBox->GetSelectedData() );
\r
2464 //-------------------------------------------------------------------------------------
\r
2465 void CD3DSettingsDlg::AddMultisampleType( D3DMULTISAMPLE_TYPE type )
\r
2467 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_MULTISAMPLE_TYPE );
\r
2469 if( !pComboBox->ContainsItem( DXUTMultisampleTypeToString( type ) ) )
\r
2470 pComboBox->AddItem( DXUTMultisampleTypeToString( type ), ULongToPtr( type ) );
\r
2474 //-------------------------------------------------------------------------------------
\r
2475 D3DMULTISAMPLE_TYPE CD3DSettingsDlg::GetSelectedMultisampleType()
\r
2477 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_MULTISAMPLE_TYPE );
\r
2479 return ( D3DMULTISAMPLE_TYPE )PtrToUlong( pComboBox->GetSelectedData() );
\r
2483 //-------------------------------------------------------------------------------------
\r
2484 void CD3DSettingsDlg::AddMultisampleQuality( DWORD dwQuality )
\r
2486 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY );
\r
2488 WCHAR strQuality[50];
\r
2489 swprintf_s( strQuality, 50, L"%d", dwQuality );
\r
2491 if( !pComboBox->ContainsItem( strQuality ) )
\r
2492 pComboBox->AddItem( strQuality, ULongToPtr( dwQuality ) );
\r
2496 //-------------------------------------------------------------------------------------
\r
2497 DWORD CD3DSettingsDlg::GetSelectedMultisampleQuality()
\r
2499 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_MULTISAMPLE_QUALITY );
\r
2501 return PtrToUlong( pComboBox->GetSelectedData() );
\r
2505 //-------------------------------------------------------------------------------------
\r
2506 void CD3DSettingsDlg::AddD3D11MultisampleCount( UINT Count )
\r
2508 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT );
\r
2511 swprintf_s( str, 50, L"%u", Count );
\r
2513 if( !pComboBox->ContainsItem( str ) )
\r
2514 pComboBox->AddItem( str, ULongToPtr( Count ) );
\r
2518 //-------------------------------------------------------------------------------------
\r
2519 UINT CD3DSettingsDlg::GetSelectedD3D11MultisampleCount()
\r
2521 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT );
\r
2523 return ( UINT )PtrToUlong( pComboBox->GetSelectedData() );
\r
2527 //-------------------------------------------------------------------------------------
\r
2528 void CD3DSettingsDlg::AddD3D11MultisampleQuality( UINT Quality )
\r
2530 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY );
\r
2532 WCHAR strQuality[50];
\r
2533 swprintf_s( strQuality, 50, L"%d", Quality );
\r
2535 if( !pComboBox->ContainsItem( strQuality ) )
\r
2536 pComboBox->AddItem( strQuality, ULongToPtr( Quality ) );
\r
2540 //-------------------------------------------------------------------------------------
\r
2541 UINT CD3DSettingsDlg::GetSelectedD3D11MultisampleQuality()
\r
2543 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY );
\r
2545 return ( UINT )PtrToUlong( pComboBox->GetSelectedData() );
\r
2549 //-------------------------------------------------------------------------------------
\r
2550 void CD3DSettingsDlg::AddVertexProcessingType( DWORD dwType )
\r
2552 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_VERTEX_PROCESSING );
\r
2554 if( !pComboBox->ContainsItem( DXUTVertexProcessingTypeToString( dwType ) ) )
\r
2555 pComboBox->AddItem( DXUTVertexProcessingTypeToString( dwType ), ULongToPtr( dwType ) );
\r
2559 //-------------------------------------------------------------------------------------
\r
2560 DWORD CD3DSettingsDlg::GetSelectedVertexProcessingType()
\r
2562 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_VERTEX_PROCESSING );
\r
2564 return PtrToUlong( pComboBox->GetSelectedData() );
\r
2568 //-------------------------------------------------------------------------------------
\r
2569 DWORD CD3DSettingsDlg::GetSelectedPresentInterval()
\r
2571 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_PRESENT_INTERVAL );
\r
2573 return PtrToUlong( pComboBox->GetSelectedData() );
\r
2577 //-------------------------------------------------------------------------------------
\r
2578 DWORD CD3DSettingsDlg::GetSelectedD3D11PresentInterval()
\r
2580 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL );
\r
2582 return PtrToUlong( pComboBox->GetSelectedData() );
\r
2585 //-------------------------------------------------------------------------------------
\r
2586 bool CD3DSettingsDlg::GetSelectedDebugDeviceValue()
\r
2588 CDXUTCheckBox* pCheckBox = m_Dialog.GetCheckBox( DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE );
\r
2590 return pCheckBox->GetChecked();
\r
2594 //-------------------------------------------------------------------------------------
\r
2595 void CD3DSettingsDlg::SetDeviceClip( bool bDeviceClip )
\r
2597 CDXUTCheckBox* pCheckBox = m_Dialog.GetCheckBox( DXUTSETTINGSDLG_DEVICECLIP );
\r
2598 pCheckBox->SetChecked( bDeviceClip );
\r
2602 //-------------------------------------------------------------------------------------
\r
2603 bool CD3DSettingsDlg::IsDeviceClip()
\r
2605 CDXUTCheckBox* pCheckBox = m_Dialog.GetCheckBox( DXUTSETTINGSDLG_DEVICECLIP );
\r
2606 return pCheckBox->GetChecked();
\r
2609 //--------------------------------------------------------------------------------------
\r
2610 // Updates the resolution list for D3D11
\r
2611 //--------------------------------------------------------------------------------------
\r
2612 HRESULT CD3DSettingsDlg::UpdateD3D11Resolutions()
\r
2615 const DWORD dwWidth = g_DeviceSettings.d3d11.sd.BufferDesc.Width;
\r
2616 const DWORD dwHeight = g_DeviceSettings.d3d11.sd.BufferDesc.Height;
\r
2618 // DXUTSETTINGSDLG_D3D11_RESOLUTION
\r
2619 CDXUTComboBox* pResolutionComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_D3D11_RESOLUTION );
\r
2620 pResolutionComboBox->RemoveAllItems();
\r
2622 CD3D11EnumOutputInfo* pOutputInfo = GetCurrentD3D11OutputInfo();
\r
2623 if( pOutputInfo == NULL )
\r
2626 bool bShowAll = m_Dialog.GetCheckBox( DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL )->GetChecked();
\r
2628 // Get the desktop aspect ratio
\r
2629 DXGI_MODE_DESC dmDesktop;
\r
2630 DXUTGetDesktopResolution( g_DeviceSettings.d3d11.AdapterOrdinal, &dmDesktop.Width, &dmDesktop.Height );
\r
2631 float fDesktopAspectRatio = dmDesktop.Width / ( float )dmDesktop.Height;
\r
2633 for( int idm = 0; idm < pOutputInfo->displayModeList.GetSize(); idm++ )
\r
2635 DXGI_MODE_DESC DisplayMode = pOutputInfo->displayModeList.GetAt( idm );
\r
2636 float fAspect = ( float )DisplayMode.Width / ( float )DisplayMode.Height;
\r
2638 if( DisplayMode.Format == g_DeviceSettings.d3d11.sd.BufferDesc.Format )
\r
2640 // If "Show All" is not checked, then hide all resolutions
\r
2641 // that don't match the aspect ratio of the desktop resolution
\r
2642 if( bShowAll || ( !bShowAll && fabsf( fDesktopAspectRatio - fAspect ) < 0.05f ) )
\r
2644 AddD3D11Resolution( DisplayMode.Width, DisplayMode.Height );
\r
2649 const DWORD dwCurResolution = MAKELONG( g_DeviceSettings.d3d11.sd.BufferDesc.Width,
\r
2650 g_DeviceSettings.d3d11.sd.BufferDesc.Height );
\r
2652 pResolutionComboBox->SetSelectedByData( ULongToPtr( dwCurResolution ) );
\r
2655 bool bWindowed = IsWindowed();
\r
2658 pResolutionComboBox->RemoveAllItems();
\r
2659 AddD3D11Resolution( dwWidth, dwHeight );
\r
2661 pResolutionComboBox->SetSelectedByData( ULongToPtr( MAKELONG( dwWidth, dwHeight ) ) );
\r
2671 //-------------------------------------------------------------------------------------
\r
2672 void CD3DSettingsDlg::AddD3D11DeviceType( D3D_DRIVER_TYPE devType )
\r
2674 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEVICE_TYPE );
\r
2676 if( !pComboBox->ContainsItem( DXUTD3DX11DeviceTypeToString( devType ) ) )
\r
2677 pComboBox->AddItem( DXUTD3DX11DeviceTypeToString( devType ), ULongToPtr( devType ) );
\r
2681 //-------------------------------------------------------------------------------------
\r
2682 D3D_DRIVER_TYPE CD3DSettingsDlg::GetSelectedD3D11DeviceType()
\r
2684 CDXUTComboBox* pComboBox = m_Dialog.GetComboBox( DXUTSETTINGSDLG_DEVICE_TYPE );
\r
2686 return ( D3D_DRIVER_TYPE )PtrToUlong( pComboBox->GetSelectedData() );
\r
2690 void CD3DSettingsDlg::UpdateModeChangeTimeoutText( int nSecRemaining )
\r
2692 const WCHAR StrTimeout[] = L"Reverting to previous display settings in %d seconds";
\r
2693 const DWORD CchBuf = sizeof( StrTimeout ) / sizeof( WCHAR ) + 16;
\r
2694 WCHAR buf[CchBuf];
\r
2696 swprintf_s( buf, CchBuf, StrTimeout, nSecRemaining );
\r
2698 CDXUTStatic* pStatic = m_RevertModeDialog.GetStatic( DXUTSETTINGSDLG_STATIC_MODE_CHANGE_TIMEOUT );
\r
2699 pStatic->SetText( buf );
\r
2702 //--------------------------------------------------------------------------------------
\r
2703 // Returns the string for the given DXUTDeviceVersion.
\r
2704 //--------------------------------------------------------------------------------------
\r
2705 WCHAR* DXUTAPIVersionToString( DXUTDeviceVersion version )
\r
2709 case DXUT_D3D9_DEVICE:
\r
2710 return L"Direct3D 9";
\r
2711 case DXUT_D3D11_DEVICE:
\r
2712 return L"Direct3D 11";
\r
2714 return L"Unknown version";
\r
2719 //--------------------------------------------------------------------------------------
\r
2720 // Returns the string for the given D3DDEVTYPE.
\r
2721 //--------------------------------------------------------------------------------------
\r
2722 WCHAR* DXUTD3DDeviceTypeToString( D3DDEVTYPE devType )
\r
2726 case D3DDEVTYPE_HAL:
\r
2727 return L"D3DDEVTYPE_HAL";
\r
2728 case D3DDEVTYPE_SW:
\r
2729 return L"D3DDEVTYPE_SW";
\r
2730 case D3DDEVTYPE_REF:
\r
2731 return L"D3DDEVTYPE_REF";
\r
2733 return L"Unknown devType";
\r
2740 //--------------------------------------------------------------------------------------
\r
2741 // Returns the string for the given D3D_DRIVER_TYPE.
\r
2742 //--------------------------------------------------------------------------------------
\r
2743 WCHAR* DXUTD3DX11DeviceTypeToString( D3D_DRIVER_TYPE devType )
\r
2747 case D3D_DRIVER_TYPE_HARDWARE:
\r
2748 return L"D3D_DRIVER_TYPE_HARDWARE";
\r
2749 case D3D_DRIVER_TYPE_REFERENCE:
\r
2750 return L"D3D_DRIVER_TYPE_REFERENCE";
\r
2751 case D3D_DRIVER_TYPE_NULL:
\r
2752 return L"D3D_DRIVER_TYPE_NULL";
\r
2753 case D3D_DRIVER_TYPE_WARP:
\r
2754 return L"D3D_DRIVER_TYPE_WARP";
\r
2756 return L"Unknown devType";
\r
2761 //--------------------------------------------------------------------------------------
\r
2762 // Returns the string for the given D3DMULTISAMPLE_TYPE.
\r
2763 //--------------------------------------------------------------------------------------
\r
2764 WCHAR* DXUTMultisampleTypeToString( D3DMULTISAMPLE_TYPE MultiSampleType )
\r
2766 switch( MultiSampleType )
\r
2768 case D3DMULTISAMPLE_NONE:
\r
2769 return L"D3DMULTISAMPLE_NONE";
\r
2770 case D3DMULTISAMPLE_NONMASKABLE:
\r
2771 return L"D3DMULTISAMPLE_NONMASKABLE";
\r
2772 case D3DMULTISAMPLE_2_SAMPLES:
\r
2773 return L"D3DMULTISAMPLE_2_SAMPLES";
\r
2774 case D3DMULTISAMPLE_3_SAMPLES:
\r
2775 return L"D3DMULTISAMPLE_3_SAMPLES";
\r
2776 case D3DMULTISAMPLE_4_SAMPLES:
\r
2777 return L"D3DMULTISAMPLE_4_SAMPLES";
\r
2778 case D3DMULTISAMPLE_5_SAMPLES:
\r
2779 return L"D3DMULTISAMPLE_5_SAMPLES";
\r
2780 case D3DMULTISAMPLE_6_SAMPLES:
\r
2781 return L"D3DMULTISAMPLE_6_SAMPLES";
\r
2782 case D3DMULTISAMPLE_7_SAMPLES:
\r
2783 return L"D3DMULTISAMPLE_7_SAMPLES";
\r
2784 case D3DMULTISAMPLE_8_SAMPLES:
\r
2785 return L"D3DMULTISAMPLE_8_SAMPLES";
\r
2786 case D3DMULTISAMPLE_9_SAMPLES:
\r
2787 return L"D3DMULTISAMPLE_9_SAMPLES";
\r
2788 case D3DMULTISAMPLE_10_SAMPLES:
\r
2789 return L"D3DMULTISAMPLE_10_SAMPLES";
\r
2790 case D3DMULTISAMPLE_11_SAMPLES:
\r
2791 return L"D3DMULTISAMPLE_11_SAMPLES";
\r
2792 case D3DMULTISAMPLE_12_SAMPLES:
\r
2793 return L"D3DMULTISAMPLE_12_SAMPLES";
\r
2794 case D3DMULTISAMPLE_13_SAMPLES:
\r
2795 return L"D3DMULTISAMPLE_13_SAMPLES";
\r
2796 case D3DMULTISAMPLE_14_SAMPLES:
\r
2797 return L"D3DMULTISAMPLE_14_SAMPLES";
\r
2798 case D3DMULTISAMPLE_15_SAMPLES:
\r
2799 return L"D3DMULTISAMPLE_15_SAMPLES";
\r
2800 case D3DMULTISAMPLE_16_SAMPLES:
\r
2801 return L"D3DMULTISAMPLE_16_SAMPLES";
\r
2803 return L"Unknown Multisample Type";
\r
2808 //--------------------------------------------------------------------------------------
\r
2809 // Returns the string for the given vertex processing type
\r
2810 //--------------------------------------------------------------------------------------
\r
2811 WCHAR* DXUTVertexProcessingTypeToString( DWORD vpt )
\r
2815 case D3DCREATE_SOFTWARE_VERTEXPROCESSING:
\r
2816 return L"Software vertex processing";
\r
2817 case D3DCREATE_MIXED_VERTEXPROCESSING:
\r
2818 return L"Mixed vertex processing";
\r
2819 case D3DCREATE_HARDWARE_VERTEXPROCESSING:
\r
2820 return L"Hardware vertex processing";
\r
2821 case D3DCREATE_PUREDEVICE:
\r
2822 return L"Pure hardware vertex processing";
\r
2824 return L"Unknown vertex processing type";
\r
2829 //--------------------------------------------------------------------------------------
\r
2830 // Returns the string for the given present interval.
\r
2831 //--------------------------------------------------------------------------------------
\r
2832 WCHAR* DXUTPresentIntervalToString( UINT pi )
\r
2836 case D3DPRESENT_INTERVAL_IMMEDIATE:
\r
2837 return L"D3DPRESENT_INTERVAL_IMMEDIATE";
\r
2838 case D3DPRESENT_INTERVAL_DEFAULT:
\r
2839 return L"D3DPRESENT_INTERVAL_DEFAULT";
\r
2840 case D3DPRESENT_INTERVAL_ONE:
\r
2841 return L"D3DPRESENT_INTERVAL_ONE";
\r
2842 case D3DPRESENT_INTERVAL_TWO:
\r
2843 return L"D3DPRESENT_INTERVAL_TWO";
\r
2844 case D3DPRESENT_INTERVAL_THREE:
\r
2845 return L"D3DPRESENT_INTERVAL_THREE";
\r
2846 case D3DPRESENT_INTERVAL_FOUR:
\r
2847 return L"D3DPRESENT_INTERVAL_FOUR";
\r
2849 return L"Unknown PresentInterval";
\r