2017-09-21 5 views
0

Auparavant, le paramètre swapchain était le format RGB32, ce qui a fonctionné correctement.comment créer un format swapchain DXGI_FORMAT_420_OPAQUE?

Je souhaite recevoir les données yv12 et le restituer. J'ai donc changé le format swapChain en 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)); 

Puis, en dxgiBackBuffer je reçois un NullReferenceException.

Je pense que vous ne pouvez pas créer de tampon arrière selon yv12 format.

Savez-vous si je me trompe?

Répondre

1

Les formats de swapchain pris en charge sont ceux figurant dans la liste des formats DXGI hardware feature levels. Aucun niveau de fonctionnalité matérielle Direct3D ne prend en charge un format YUV pour l'affichage. Vous devez effectuer une conversion d'espace colorimétrique YUV vers RVB dans un shader quelque part.