gpt4 book ai didi

c++ - 如何正确填充 SwapChain Struct 以使用 Mulitsampling?

转载 作者:太空宇宙 更新时间:2023-11-04 13:05:35 26 4
gpt4 key购买 nike

您好,我刚开始使用 CoreWindow^ + C++/CLI 下的 DirectX,在我想开始使用多重采样之前一切似乎都正常。这个例子是渲染简单的三角形

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

返回“空指针”,

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

我应该如何填充 SwapChain 结构?

最佳答案

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

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com