多重采样在独占模式下不起作用

Mar*_*lle 5 c# directx multisampling slimdx

我想在绘制三角形时启用多重采样,如下图所示: 在此输入图像描述

我在另一个问题中找到了一种与SlimDX有关的方法,但它不能在独占模式下工作.

这是我的代码:

void Form1_Load(object sender, EventArgs e)
{
    Direct3D d3d = new Direct3D();

    PresentParameters presentParams;

    presentParams.Windowed = false;
    presentParams.BackBufferFormat = Format.X8R8G8B8;
    presentParams.BackBufferWidth = 800;
    presentParams.BackBufferHeight = 600;
    presentParams.FullScreenRefreshRateInHertz = 60;
    presentParams.SwapEffect = SwapEffect.Copy;
    presentParams.BackBufferCount = 1;
    presentParams.PresentationInterval = PresentInterval.One;

    int multisampleQuality;
    Result result;
    if (d3d.CheckDeviceMultisampleType(adaptor, DeviceType.Hardware, Format.X8R8G8B8, false, MultisampleType.FourSamples, out multisampleQuality, out result))
    {
        if(multisampleQuality > 4)
        {
            presentParams.Multisample = multisampleType;
            presentParams.MultisampleQuality = 4;
        }
    }

    // Device creation
    Device device = new Device(d3d, adaptor, DeviceType.Hardware, this.Handle, CreateFlags.HardwareVertexProcessing, presentParams);
}
Run Code Online (Sandbox Code Playgroud)

即使CheckDeviceMultisampleType总是返回true而没有错误,并且为multisampleQuality返回8,最后一行总是因D3DERR_INVALIDCALL错误而崩溃.

如果我使用窗口模式或删除多重采样选项,它可以工作.

有人能告诉我什么是错的吗?

cat*_*ier 1

尝试用

 presentParams.SwapEffect = SwapEffect.Discard;
Run Code Online (Sandbox Code Playgroud)