dx12 打开 4x msaa 失败

dx12 open 4x msaa failed

刚刚在学习"introduction to 3D game programming with DirectX 12".运行初始化d3d(第4章)中的示例代码,当我想使用4xmsaa时,出现了错误,如下图,请帮助我. wrong figure

为了与 DirectX 12 的“无魔法 运行时间行为”设计理念保持一致,您不得创建 MSAA 后备缓冲区。这是因为视频输出硬件实际上无法呈现 MSAA 后备缓冲区,因此必须在管道中的某个点将它们分别解析为单个像素。在 DirectX 11 中,这是在您创建 MSAA 后备缓冲区时 'behind the scenes' 完成的。在 DirectX 12 中,您负责自己创建 MSAA 渲染目标纹理,然后执行对后台缓冲区的解析 - 或 - 运行 执行解析的其他一些后处理。设置完全相同,只是更加冗长和明确,并且在应用程序控制下而不是 'magic'.

参见 SimpleMSAA12 示例。

With DirectX 12 you also aren't allowed to create sRGB format backbuffers. You can create sRGB render target views that will perform the gamma while writing to the backbuffer. There were some bugs in the older debug layers and Windows 10 runtime when doing direct resolves of sRGB MSAA render targets to non-sRGB backbuffers. These are also noted in the sample above.

Note that UWP apps have exactly the same behavior as DirectX 12 for Win32 desktop apps. This is because both UWP apps and DirectX 12 are required to use the DXGI_SWAP_EFFECT_FLIP_* swap effects instead of the legacy DXGI_SWAP_EFFECT_* swap modes.

顺便说一句,如果您启用了 DXGI 调试,当您尝试创建 4x MSAA 后备缓冲区时,您会得到一些特定的调试诊断输出:

DXGI ERROR: IDXGIFactory::CreateSwapChain: Flip model swapchains (
DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
and DXGI_SWAP_EFFECT_FLIP_DISCARD) do not support multisampling.
[ MISCELLANEOUS ERROR #102: ]

看看this blog post for details on enabling DXGI debugging in your project, or take a look at the implementation of DeviceResources