Nvenc Encoder using OpenGL input buffer

I have seen tutorials to copy bytes out of a cuda buffer into a OGL PBO, I have seen how you can assign the color attachement of a FBO to a cuda resource. I have also (started to) play with the NvCodec AppEncodeCuda example to fit my needed implementation.

It seems the

encoder.GetNextInputFrame()

must be called before each

enc.EncodeFrame(packets)

.

I am wondering if I 1) create a FBO and register it as a cuda resource then 2) call

encoder.GetNextInputFrame()

at the beginning of my program and then modified the returned inputPtr to be that of the cuda resource, will this work or will there be issues?

I am trying to reduce the number of copies being done here. With what I see in the example, it will require me to

cudaMemCpy

the output of my rendering process (the color attachement of the FBO) to the input buffer of the

encoder.GetNextInputFrame().inputPtr

location.

The ultimate option would be if I could use the FBO that has been registered as a cuda resource and then TELL the nvenc encoder to use that buffer instead of ASKING the nvenc encoder for what buffer it wants me to use.

Any info in this area is appreciated, its possible I have missed something that makes this copy a requirement (maybe how nvenc works internally on the data).

Thanks,
Ian

I have the same question, can someone please shed some light on this?