?? dxmutenum.cs
字號:
BuildConflictList(deviceCombo);
BuildPresentIntervalList(deviceInfo, deviceCombo);
deviceCombo.adapterInformation = adapterInfo;
deviceCombo.deviceInformation = deviceInfo;
// Add the combo to the list of devices
deviceInfo.deviceSettingsList.Add(deviceCombo);
}
}
}
}
/// <summary>
/// Adds all depth/stencil formats that are compatible with the device
/// and application to the given device combo
/// </summary>
private static void BuildDepthStencilFormatList(EnumDeviceSettingsCombo deviceCombo)
{
foreach(DepthFormat depthStencil in depthStencilPossibleList)
{
if (Manager.CheckDeviceFormat((int)deviceCombo.AdapterOrdinal,
deviceCombo.DeviceType, deviceCombo.AdapterFormat,
Usage.DepthStencil, ResourceType.Surface, depthStencil))
{
// This can be used as a depth stencil, make sure it matches
if (Manager.CheckDepthStencilMatch((int)deviceCombo.AdapterOrdinal,
deviceCombo.DeviceType, deviceCombo.AdapterFormat,
deviceCombo.BackBufferFormat, depthStencil))
{
// Yup, add it
deviceCombo.depthStencilFormatList.Add(depthStencil);
}
}
}
}
/// <summary>
/// Adds all multisample types that are compatible with the device and app to
/// the given device combo
/// </summary>
private static void BuildMultiSampleTypeList(EnumDeviceSettingsCombo deviceCombo)
{
foreach(MultiSampleType msType in multiSampleTypeList)
{
int result, quality;
// Check this
if (Manager.CheckDeviceMultiSampleType((int)deviceCombo.AdapterOrdinal,
deviceCombo.DeviceType, deviceCombo.BackBufferFormat,
deviceCombo.IsWindowed, msType, out result, out quality))
{
deviceCombo.multiSampleTypeList.Add(msType);
if (quality > multisampleQualityMax + 1)
quality = (int)(multisampleQualityMax + 1);
deviceCombo.multiSampleQualityList.Add(quality);
}
}
}
/// <summary>
/// Find any conflicts between the available depth/stencil formats and
/// multisample types.
/// </summary>
private static void BuildConflictList(EnumDeviceSettingsCombo deviceCombo)
{
foreach(DepthFormat depthFormat in deviceCombo.depthStencilFormatList)
{
foreach(MultiSampleType msType in deviceCombo.multiSampleTypeList)
{
// Check this for conflict
if (!Manager.CheckDeviceMultiSampleType((int)deviceCombo.AdapterOrdinal,
deviceCombo.DeviceType, (Format)depthFormat,
deviceCombo.IsWindowed, msType))
{
// Add it to the list
EnumDepthStencilMultisampleConflict conflict = new EnumDepthStencilMultisampleConflict();
conflict.DepthStencilFormat = depthFormat;
conflict.MultisampleType = msType;
deviceCombo.depthStencilConflictList.Add(conflict);
}
}
}
}
/// <summary>
/// Adds all present intervals that are compatible with the device and app
/// to the given device combo
/// </summary>
private static void BuildPresentIntervalList(EnumDeviceInformation deviceInfo, EnumDeviceSettingsCombo deviceCombo)
{
for (int i = 0; i < presentIntervalList.Count; i++)
{
PresentInterval pi = (PresentInterval)presentIntervalList[i];
if (deviceCombo.IsWindowed)
{
if ( (pi == PresentInterval.Two) ||
(pi == PresentInterval.Three) ||
(pi == PresentInterval.Four) )
{
// These intervals are never supported in windowed mode
continue;
}
}
// Not that PresentInterval.Default is zero so you can't do a bitwise
// check for it, it's always available
if ( (pi == PresentInterval.Default) ||
((deviceInfo.Caps.PresentationIntervals & pi) != 0))
{
deviceCombo.presentIntervalList.Add(pi);
}
}
}
/// <summary>
/// Resets the list of possible depth stencil formats
/// </summary>
public static void ResetPossibleDepthStencilFormats()
{
depthStencilPossibleList.Clear();
depthStencilPossibleList.AddRange(new DepthFormat[] {
DepthFormat.D16,
DepthFormat.D15S1,
DepthFormat.D24X8,
DepthFormat.D24S8,
DepthFormat.D24X4S4,
DepthFormat.D32 });
}
/// <summary>
/// Resets the possible multisample type list
/// </summary>
public static void ResetPossibleMultisampleTypeList()
{
multiSampleTypeList.Clear();
multiSampleTypeList.AddRange(new MultiSampleType[] {
MultiSampleType.None,
MultiSampleType.NonMaskable,
MultiSampleType.TwoSamples,
MultiSampleType.ThreeSamples,
MultiSampleType.FourSamples,
MultiSampleType.FiveSamples,
MultiSampleType.SixSamples,
MultiSampleType.SevenSamples,
MultiSampleType.EightSamples,
MultiSampleType.NineSamples,
MultiSampleType.TenSamples,
MultiSampleType.ElevenSamples,
MultiSampleType.TwelveSamples,
MultiSampleType.ThirteenSamples,
MultiSampleType.FourteenSamples,
MultiSampleType.FifteenSamples,
MultiSampleType.SixteenSamples });
}
/// <summary>
/// Resets the possible present interval list
/// </summary>
public static void ResetPossiblePresentIntervalList()
{
presentIntervalList.Clear();
presentIntervalList.AddRange(new PresentInterval[] {
PresentInterval.Immediate,
PresentInterval.Default,
PresentInterval.One,
PresentInterval.Two,
PresentInterval.Three,
PresentInterval.Four });
}
/// <summary>
/// Set the minimum and maximum resolution items
/// </summary>
public static void SetResolutionMinMax(uint minWidth, uint minHeight, uint maxWidth, uint maxHeight)
{
minimumWidth = minWidth;
minimumHeight = minHeight;
maximumWidth = maxHeight;
maximumWidth = maxWidth;
}
/// <summary>
/// Sets the minimum and maximum refresh
/// </summary>
public static void SetRefreshMinMax(uint minRefresh, uint maxRefresh)
{
minimumRefresh = minRefresh;
maximumRefresh = maxRefresh;
}
/// <summary>
/// Property for MultisampleQualityMax
/// </summary>
public static uint MultisampleQualityMax
{
get { return multisampleQualityMax; }
set
{
if (value > 0xffff)
multisampleQualityMax = 0xffff;
else
multisampleQualityMax = value;
}
}
/// <summary>
/// Allows the user to set if post pixel shader blending is required
/// </summary>
public static bool IsPostPixelShaderBlendingRequred
{
get { return isPostPixelShaderBlendingRequired; }
set { isPostPixelShaderBlendingRequired = value; }
}
/// <summary>
/// Allows the user to set if software vertex processing is available
/// </summary>
public static bool IsSoftwareVertexProcessingPossible
{
get { return isSoftwareVertexProcessing; }
set { isSoftwareVertexProcessing = value; }
}
/// <summary>
/// Allows the user to set if hardware vertex processing is available
/// </summary>
public static bool IsHardwareVertexProcessingPossible
{
get { return isHardwareVertexProcessing; }
set { isHardwareVertexProcessing = value; }
}
/// <summary>
/// Allows the user to set if pure hardware vertex processing is available
/// </summary>
public static bool IsPureHardwareVertexProcessingPossible
{
get { return isPureHardwareVertexProcessing; }
set { isPureHardwareVertexProcessing = value; }
}
/// <summary>
/// Allows the user to set if mixed vertex processing is available
/// </summary>
public static bool IsMixedVertexProcessingPossible
{
get { return isMixedVertexProcessing; }
set { isMixedVertexProcessing = value; }
}
/// <summary>
/// Allows the user to get the possible depth stencil formats
/// </summary>
public static ArrayList PossibleDepthStencilFormatList
{
get { return depthStencilPossibleList; }
}
/// <summary>
/// Allows the user to get the possible multisample types
/// </summary>
public static ArrayList PossibleMultisampleTypeList
{
get { return multiSampleTypeList; }
}
/// <summary>
/// Allows the user to get the possible present intervals
/// </summary>
public static ArrayList PossiblePresentIntervalsList
{
get { return presentIntervalList; }
}
/// <summary>
/// Use this after Enumerate to get the list of adapter information
/// </summary>
public static ArrayList AdapterInformationList
{
get { return adapterInformationList; }
}
/// <summary>
/// Get the adapter information for a specific adapter
/// </summary>
public static EnumAdapterInformation GetAdapterInformation(uint ordinal)
{
foreach(EnumAdapterInformation eai in adapterInformationList)
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -