NVENC EncodePicture returns UNSUPPORTED_PARAM when using ARGB input

I am using an ID3DTexture2D of format B8G8R8A8_Unorm as input. I register the resource successfully using nvEncRegisterResource then map it using nvEncMapInputResource. The call to nvEncEncodePicture fails when I set the NV_ENC_PIC_PARAMS::bufferFmt to ARGB (since that’s the format of the input texture). It works however if I set the BufferFmt to Nv12 (although the video output is a purple mess since this is not the actual format of the input). The video card I’m using (GTX 1080 Ti) supports ARGB input and YUV444 output.

I thought NvEnc supported RGB input buffers according to the documentation, what am I missing? Do I need to convert the RGB texture to NV12 with DirectX like in the sample? What if I want to output to YUV444, should I convert the source to YUV444 before encoding it with NvEnc?

Thanks!
Note: I am using NVEnc 8.2.15 and drivers 398.11

Ignore this issue; I found the source of the problem: I didn’t marshal some structure fields correctly in C# and ended up with an invalid NV_ENC_PIC_PARAMS structure.