nvEncRegisterResource parameter (void * resourceToRegister)

Hi all, I have a question that I can’t find any documentation on.

What exactly is the resource type expected to be? I know in the Direct X examples it is usually a D3D surface,
what happens if I try to register a D3D Texture instead? I’m asking this because I’m trying to encode a Unity Engine render texture which gives a IDirect3DTexture9 ptr. If i could pass this directly in and not have to actually get a D3D9Surface that would safe me some time. If not I probably need to write a native plugin to get at the D3D surface.


Hi vincentnagi,

If you want to register a D3D texture, even nvEncRegisterResource() succeeds, the following nvEncMapInputResource() will fail. So D3D9 texture can’t be used as the input resource type.

In your use case, please call IDirect3DTexture9::GetSurfaceLevel to get a surface pointer from the texture.


Thanks for the response Gary, would you have any inkling what this would be for D3D11, a ID3DView or ID3D11Resource? Where does one go about finding these details? I skimmed the nvEnc guide and references and they don’t have these details.


Edit: Upon more googling it would seem that NvEncoder does not support interop with D3D11 directly, and I could either a) bridge the D3D9/D3D11 gap by doing a manual buffer copy, or b) use IFR do return the encoded texture.