我想让用户在游戏中选择MSAA选项。我希望能够检查他们的机器可以提供哪些多重采样选项并仅显示这些选项。我正在使用的应用程序是用WinForms构建的;它实际上不是游戏本身,而是游戏的发射器。
我找到了SlimDX.Direct3D11.Device.CheckMultisampleQualityLevels(),但我不知道如何在WinForms中获得对Direct3D11设备的引用。 https://msdn.microsoft.com/en-us/library/windows/desktop/ff476499%28v=vs.85%29.aspx
答案 0 :(得分:1)
您需要遍历所有可能的采样点,并检查是否支持至少一个质量级别(您需要按格式执行):
SlimDX.Direct3D11.Device device; //your created device
SlimDX.DXGI.Format format = SlimDX.DXGI.Format.R8G8B8A8_Unorm; //Replace by the format you want to test, this one is very common still
for (int samplecount = 1; samplecount < SlimDX.Device.MultisampleCountMaximum ; samplecount *= 2)
{
int levels = device.CheckMultisampleQualityLevels(format, samplecount );
if (levels > 0)
{
//you can use a sampledescription of
new SampleDescription(samplecount, /* value between 0 and levels -1 */
}
else
{
// samplecount is not supported for this format
}
}