嗨,我只是从CoreWindow ^ + C ++ / CLI下的DirectX开始,直到我想开始使用Mulitsampling为止,一切似乎都还不错。
这个例子渲染了简单的三角形

Working example without AA

当我像这样填充SwapChain结构时:

UINT m4xMsaaQuality;


dev->CheckMultisampleQualityLevels(DXGI_FORMAT_B8G8R8A8_UNORM,4, &m4xMsaaQuality);


// set up the swap chain description
DXGI_SWAP_CHAIN_DESC1 scd = { 0 };

scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;    // how the swap chain should be used
scd.BufferCount =2;

scd.Format = DXGI_FORMAT_B8G8R8A8_UNORM;              // the most common swap chain format
scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;    // the recommended flip mode
scd.SampleDesc.Count = 4;                             // >1 enable anti-aliasing
scd.SampleDesc.Quality = m4xMsaaQuality-1;

CoreWindow^ Window = CoreWindow::GetForCurrentThread();    // get the window pointer

                                                           // create the swap chain
dxgiFactory->CreateSwapChainForCoreWindow(
    dev.Get(),                                  // address of the device
    reinterpret_cast<IUnknown*>(Window),        // address of the window
    &scd,                                       // address of the swap chain description
    nullptr,                                    // advanced
    &swapchain);                                // address of the new swap chain pointer



    // get a pointer directly to the back buffer
    ComPtr<ID3D11Texture2D> backbuffer;
    swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (&backbuffer));`




dxgiFactory->CreateSwapChainForCoreWindow(
dev.Get(),                                  // address of the device
reinterpret_cast<IUnknown*>(Window),        // address of the window
&scd,                                       // address of the swap chain description
nullptr,                                    // advanced
&swapchain);


返回“ nullptr”,

我检查了m4xMsaaQuality等于“ 17”,所以scd.SampleDesc.Quality = 16

我应该如何填写SwapChain结构?

最佳答案

翻转交换效果与多重采样表面不兼容。您需要创建一个非msaa交换链,并将您的msaa渲染显式解析为swapchain缓冲区。

关于c++ - 如何正确填充SwapChain结构以使用多采样?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42588789/

10-12 22:15