0
此前,swapchain
設置爲RGB32
格式,它工作正常。如何創建交換鏈格式DXGI_FORMAT_420_OPAQUE?
我想接收yv12數據並進行渲染。
因此我將swapChain
格式更改爲DXGI_FORMAT_420_OPAQUE
。
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
swapChainDesc.Width = 0;
swapChainDesc.Height = 0;
swapChainDesc.Format = DXGI_FORMAT_420_OPAQUE;// DXGI_FORMAT_B8G8R8A8_UNORM
swapChainDesc.Stereo = false;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
swapChainDesc.Flags = 0;
dxgiFactory->CreateSwapChainForHwnd(_direct3DDevice, _hwnd, &swapChainDesc, nullptr, nullptr, &_DXGISwapChain);
IDXGISurface *dxgiBackBuffer;
_DXGISwapChain->GetBuffer(0, IID_PPV_ARGS(&dxgiBackBuffer));
然後在dxgiBackBuffer
我得到一個NullReferenceException
。
我認爲你不能根據yv12 format
創建後臺緩衝區。
你知道我錯了嗎?