Importing DXGI_FORMAT_NV12 as CUDA external resource


According to this page,

Added support for importing DirectX11/12 textures with format DXGI_FORMAT_NV12 via the CUDA external resource interoperability APIs. For more details about external resource interoperability API functions, see CUDA Runtime API :: CUDA Toolkit Documentation.

It says that it supports importing DXGI_FORMAT_NV12.
However, I looked at the link and couldn’t find any information about it.

What I’m trying to do is copy the NvDec output(YUV420) directly into a DXGI_FORMAT_NV12 texture.
As you know, DXGI_FORMAT_NV12 is a special format that has two planes.
I would like to know how these should be handled in CUDA and the specific code how to do it.

Also, is DXGI_FORMAT_P010 not supported?

Thank you.

Hi there @masaaki240.m_nv2, nice to see you again on the forums.

I recommend you check out NVDEC Video Decoder API Programming Guide - NVIDIA Docs and look at the sample sin that SDK. Because NVDEC already uses and needa a CUDA context which will allow you to do CUDA post-processing on the decoded frames. No need to go through DirectX at that stage.

But if you mean to use things in DX, then the CUDA samples for different DX versions should be helpful to you. There is also one specifically looking at NV12 to BGR conversions within CUDA, which should showcase the format handling.

DXGI_FORMAT_P010 is not supported, but there is cudaVideoSurfaceFormat_P016 which refers to DXGI_FORMAT_P016.