Importing existing D3D11 textures in d3d11 elements as optimization
I'm using the D3D11 GStreamer elements successfully in a Unity application to copy data from a simple RGBA pixel buffer into GStreamer through an appsrc
, and uploading it through d3d11upload
to later profit from hardware-accelerated h.264 encoding using mfh264enc
(which also supports D3D11 textures).
Unity on Windows can use D3D11 for rendering itself, where I can get direct access to said texture (ID3D11Resource*
), and I was wondering if such a texture pointer can be directly passed to one of the D3D11 plugins as an optimization to avoid the copy.
In other words: I'm currently downloading the Unity GPU texture to system memory, to later upload it again for GStreamer.
I took a look at the source code, and the plugins use caps video/x-raw(memory:D3D11Memory)
for this, but it appears structures such as GstD3D11Memory
, which end up wrapping the ID3D11Resource
, are not publicly exposed for development, so it is not clear to me if it is currently possible (without mimicking said structures manually) to provide the right data to the existing elements from my appsrc
. I may be missing something here, though.