Download

Copy RenderTargetTexture to ID3DTexture2D in Rendering Thread (modifying Unreal Engine source code)

Hello everyone!
I try to copy RenderTargetTexture into similar Texture created by me to modify its data. I work with source code: UnrealEngine/Engine/Plugins/Runtime/Steam/SteamVR/Source/SteamVR/Private/SteamVRRenderer.cpp method: FSteamVRHMD::D3D11Bridge::FinishRendering()

There is available ID3D11Texture2D* RenderTargetTexture which comes from FViewport every frame. I want to copy that texture to my own texture and pass it to openVR::Submit method for the next rendering stage.

I’m not familiar with internal Unreal Engine structure and capabilities of manipulating of d3d11 textures. I’ve tried to use native d3d11 method ID3D11Context::CopyResource (and CopySubresourceRegion too) but in vain…image on screen becomes black…

I’m ready for discuss this task and to provide additional information about it if necessary!

Thanks in advance for help!

I’ve found the problem. It was incompatible DXGI formats between Unreal Engine 's render texture and my texture. It’s pity that d3d doesn’t warn about it when you call CopyResource method.