📄 dxutenum.cpp
字号:
case D3DFMT_A2B10G10R10:
return 10;
case D3DFMT_A8B8G8R8:
return 8;
case D3DFMT_A2R10G10B10:
return 10;
case D3DFMT_A16B16G16R16:
return 16;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Returns the number of alpha channel bits in the specified D3DFORMAT
//--------------------------------------------------------------------------------------
UINT DXUTAlphaChannelBits( D3DFORMAT fmt )
{
switch( fmt )
{
case D3DFMT_R8G8B8:
return 0;
case D3DFMT_A8R8G8B8:
return 8;
case D3DFMT_X8R8G8B8:
return 0;
case D3DFMT_R5G6B5:
return 0;
case D3DFMT_X1R5G5B5:
return 0;
case D3DFMT_A1R5G5B5:
return 1;
case D3DFMT_A4R4G4B4:
return 4;
case D3DFMT_R3G3B2:
return 0;
case D3DFMT_A8R3G3B2:
return 8;
case D3DFMT_X4R4G4B4:
return 0;
case D3DFMT_A2B10G10R10:
return 2;
case D3DFMT_A8B8G8R8:
return 8;
case D3DFMT_A2R10G10B10:
return 2;
case D3DFMT_A16B16G16R16:
return 16;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Returns the number of depth bits in the specified D3DFORMAT
//--------------------------------------------------------------------------------------
UINT DXUTDepthBits( D3DFORMAT fmt )
{
switch( fmt )
{
case D3DFMT_D32F_LOCKABLE:
case D3DFMT_D32:
return 32;
case D3DFMT_D24X8:
case D3DFMT_D24S8:
case D3DFMT_D24X4S4:
case D3DFMT_D24FS8:
return 24;
case D3DFMT_D16_LOCKABLE:
case D3DFMT_D16:
return 16;
case D3DFMT_D15S1:
return 15;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Returns the number of stencil bits in the specified D3DFORMAT
//--------------------------------------------------------------------------------------
UINT DXUTStencilBits( D3DFORMAT fmt )
{
switch( fmt )
{
case D3DFMT_D16_LOCKABLE:
case D3DFMT_D16:
case D3DFMT_D32F_LOCKABLE:
case D3DFMT_D32:
case D3DFMT_D24X8:
return 0;
case D3DFMT_D15S1:
return 1;
case D3DFMT_D24X4S4:
return 4;
case D3DFMT_D24S8:
case D3DFMT_D24FS8:
return 8;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Used to sort D3DDISPLAYMODEs
//--------------------------------------------------------------------------------------
static int __cdecl SortModesCallback( const void* arg1, const void* arg2 )
{
D3DDISPLAYMODE* pdm1 = (D3DDISPLAYMODE*)arg1;
D3DDISPLAYMODE* pdm2 = (D3DDISPLAYMODE*)arg2;
if (pdm1->Width > pdm2->Width)
return 1;
if (pdm1->Width < pdm2->Width)
return -1;
if (pdm1->Height > pdm2->Height)
return 1;
if (pdm1->Height < pdm2->Height)
return -1;
if (pdm1->Format > pdm2->Format)
return 1;
if (pdm1->Format < pdm2->Format)
return -1;
if (pdm1->RefreshRate > pdm2->RefreshRate)
return 1;
if (pdm1->RefreshRate < pdm2->RefreshRate)
return -1;
return 0;
}
//--------------------------------------------------------------------------------------
CD3DEnumAdapterInfo::~CD3DEnumAdapterInfo( void )
{
CD3DEnumDeviceInfo* pDeviceInfo;
for( int i=0; i<deviceInfoList.GetSize(); i++ )
{
pDeviceInfo = deviceInfoList.GetAt(i);
delete pDeviceInfo;
}
deviceInfoList.RemoveAll();
}
//--------------------------------------------------------------------------------------
CD3DEnumDeviceInfo::~CD3DEnumDeviceInfo( void )
{
CD3DEnumDeviceSettingsCombo* pDeviceCombo;
for( int i=0; i<deviceSettingsComboList.GetSize(); i++ )
{
pDeviceCombo = deviceSettingsComboList.GetAt(i);
delete pDeviceCombo;
}
deviceSettingsComboList.RemoveAll();
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::ResetPossibleDepthStencilFormats()
{
m_DepthStecilPossibleList.RemoveAll();
m_DepthStecilPossibleList.Add( D3DFMT_D16 );
m_DepthStecilPossibleList.Add( D3DFMT_D15S1 );
m_DepthStecilPossibleList.Add( D3DFMT_D24X8 );
m_DepthStecilPossibleList.Add( D3DFMT_D24S8 );
m_DepthStecilPossibleList.Add( D3DFMT_D24X4S4 );
m_DepthStecilPossibleList.Add( D3DFMT_D32 );
}
//--------------------------------------------------------------------------------------
CGrowableArray<D3DFORMAT>* CD3DEnumeration::GetPossibleDepthStencilFormatList()
{
return &m_DepthStecilPossibleList;
}
//--------------------------------------------------------------------------------------
CGrowableArray<D3DMULTISAMPLE_TYPE>* CD3DEnumeration::GetPossibleMultisampleTypeList()
{
return &m_MultiSampleTypeList;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::ResetPossibleMultisampleTypeList()
{
m_MultiSampleTypeList.RemoveAll();
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_NONE );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_NONMASKABLE );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_2_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_3_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_4_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_5_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_6_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_7_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_8_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_9_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_10_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_11_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_12_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_13_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_14_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_15_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_16_SAMPLES );
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::GetPossibleVertexProcessingList( bool* pbSoftwareVP, bool* pbHardwareVP, bool* pbPureHarewareVP, bool* pbMixedVP )
{
*pbSoftwareVP = m_bSoftwareVP;
*pbHardwareVP = m_bHardwareVP;
*pbPureHarewareVP = m_bPureHarewareVP;
*pbMixedVP = m_bMixedVP;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetPossibleVertexProcessingList( bool bSoftwareVP, bool bHardwareVP, bool bPureHarewareVP, bool bMixedVP )
{
m_bSoftwareVP = bSoftwareVP;
m_bHardwareVP = bHardwareVP;
m_bPureHarewareVP = bPureHarewareVP;
m_bMixedVP = bMixedVP;
}
//--------------------------------------------------------------------------------------
CGrowableArray<UINT>* CD3DEnumeration::GetPossiblePresentIntervalList()
{
return &m_PresentIntervalList;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::ResetPossiblePresentIntervalList()
{
m_PresentIntervalList.RemoveAll();
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_IMMEDIATE );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_DEFAULT );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_ONE );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_TWO );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_THREE );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_FOUR );
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetResolutionMinMax( UINT nMinWidth, UINT nMinHeight,
UINT nMaxWidth, UINT nMaxHeight )
{
m_nMinWidth = nMinWidth;
m_nMinHeight = nMinHeight;
m_nMaxWidth = nMaxWidth;
m_nMaxHeight = nMaxHeight;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetRefreshMinMax( UINT nMin, UINT nMax )
{
m_nRefreshMin = nMin;
m_nRefreshMax = nMax;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetMultisampleQualityMax( UINT nMax )
{
if( nMax > 0xFFFF )
nMax = 0xFFFF;
m_nMultisampleQualityMax = nMax;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -