0

我想为游戏中的 MSAA 选项提供用户选择。我希望能够检查他们的机器可以提供哪些多重采样选项并仅显示这些选项。我正在使用的应用程序是内置在 WinForms 中的;它实际上不是游戏本身,而是该游戏的启动器。

我找到了 SlimDX.Direct3D11.Device.CheckMultisampleQualityLevels() 但我不确定如何在 WinForms 中获得对 Direct3D11 设备的引用。 https://msdn.microsoft.com/en-us/library/windows/desktop/ff476499%28v=vs.85%29.aspx

4

1 回答 1

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
     }
}
于 2015-04-09T18:31:43.590 回答