directx 11 create device and swap chain

Create Device with adapter

D3D11CreateDeviceAndSwapChain
第一个参数如果传NULL,则以默认Adapter创建
如果参数不为NULL,DriverType必须为D3D_DRIVER_TYPE_UNKNOWN

DXGI_SWAP_CHAIN_DESC SwapEffect

DXGI支持两种模式:

  • BitBlt: DXGI_SWAP_EFFECT_DISCARD,DXGI_SWAP_EFFECT_SEQUENTIAL
  • Flip: DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL,DXGI_SWAP_EFFECT_FLIP_DISCARD

Flip不支持MultiSampling

DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL:从Win8开始支持
DXGI_SWAP_EFFECT_FLIP_DISCARD:从Win10开始支持

Flip比BitBlt效率更高,但是对于需要GDI与DirectX混合显示的程序来说,BitBlt是唯一的选择

当SwapChain使用DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL创建,一次成功的Present将会把BackBuffer0从管线解绑,因此需要重新绑定RenderTarget

Reference

For flip presentation model swap chains that you create with the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL value set, a successful presentation results in an unbind of back buffer 0 from the graphics pipeline

DXGI Flip Mode

If you set the pAdapter parameter to a non-NULL value, you must also set the DriverType parameter to the D3D_DRIVER_TYPE_UNKNOWN value

unity _WorldSpaceLightDir in forwardBase lightMode c++模板检测类型是否为Class

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×