Multisampling doesn't work in exclusive mode

自闭症网瘾萝莉.ら 提交于 2020-01-03 13:58:32

问题


I would like to enable multisampling when drawing triangles like on the following picture:

I found a way to do with SlimDX in another question but it doesn't work in exclusive mode.

Here is my code:

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);
}

The last line alway crashs with a D3DERR_INVALIDCALL error even if the CheckDeviceMultisampleType return always true with no error and 8 for multisampleQuality.

It works if I use the windowed mode or if I remove the multisample option.

Can someone tell me what's wrong?


回答1:


Try with

 presentParams.SwapEffect = SwapEffect.Discard;


来源:https://stackoverflow.com/questions/12899885/multisampling-doesnt-work-in-exclusive-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!