CUDA and NVENC

Hello all,

please let me ask if there is possibility to redirect data from gpu cores to nvenc peripheral? My case is following: I preprocess data on GPU shaders and I have output stored in GPU RAM (this is YUV 4k). To avoid sending it back to CPU RAM I would like to encode it with NVENC by redirecting data from GPU RAM. How can I achieve it? Is it possible? (As far I’ve worked with C programmed frontend for NVENC by NVidia and it loaded video from file, so it is not the answer. I’m curious if nvidia driver API allows me to do things like I described.)

Looking for you reply,
Best regards,
Maks