Can we use our own native textures directly from C++?

I’d like to create and maintain my own ID3D11Texture2D or OpenGL texture and have that used in a custom material without paying the overhead cost of copying the data to system memory for UE’s API to then let me load it back into the driver’s memory where it will then get copied to the GPU costing me 3 copies 2 on the CPU and one to the GPU which is fairly expensive. The data I need is already streaming in my own texture very efficiently and needs to be maintained separately.

Is there a way to do that as it stands using my own texture class for example or an existing lower level override? Can a method be added to support this use case?

I’ve made changes to the engine to support passing in a D3D texture and can be trivially made to extend this to OpenGL.

How can I try to contribute this change back to the engine so others can use it as well? I would really like to share this with everyone who needs it as well as reduce the need to maintain this separately. My changes are on a local 4.6 branch that is fully up-to-date. There are some small things that others can help with once I know who to contact both for getting in the engine as well as defining whatever coding standards are required.

I’ve created a pull request from my branch and welcome comments or improvements (eg: OpenGL support or fixing compiling on non-OpenGL/Direct3D platforms):

https://github.com/EpicGames/UnrealEngine/pull/650

This is grate stuff, hesham.

Do you use the Unreal D3D device like this:

ID3D11Device* D3DDevice = (ID3D11Device*)RHIGetNativeDevice();

to create your ID3D11Texture2D? I’m also struggling with how to synchronize the update with the rendering thread.

Thanks,

Great!

Where did you get to with the pull request? Looks like the page is down…

I think this could definitely help me with an issue I’m having.