Re: NoesisGUI Unreal Engine 4 Plugin
Posted: 31 Oct 2014, 19:21
once you have the RT and RTV you should be able to cache these and use them each frame.
The RHI is designed to hide the implementation of the RHI from user code, this is so you could swap in ogl, dx etc and the user code should not know the difference. All you should have access to is the base FDynamicRHI class, which you call blindly, in the case of DX11 this then does the appropriate dx bits under the hood.
The exception to the above is getting the dx11 device for starting up noesis. In this case there is a patch to FDynamicRHI that adds FDynamicRHI::GetNativeInterface() that should return the dx11 device, not sure if its in the main release but it was submitted a while back by the coherent team. (https://github.com/CoherentUE4/UnrealEn ... a7e6edcc58)
This technically breaks isolation, but saves you from having to do everything with RHI code changes.
I probably didn't make things clear in my previous post, but RHISetRenderTargets and CommitRenderTargetsAndUAVs are members of the base class FDynamicRHI, which you should be able to get hold of a reference to using the GDynamicRHI global. You shouldn't need to cast this to ID3D11DynamicRHI, but I would assume doing so is possible (although if you can avoid doing so you make supporting opengl in noesis easier).
you probably need to call RHIDiscardRenderTargets after noesis has rendered to unbind things and clean up
Also not sure about threading in this scenario, you might need to use delegates to ensure that code executes on the render thread. might be worth looking up the ENQUEUE_UNIQUE_RENDER_COMMAND macro if you haven't done so already.
The RHI is designed to hide the implementation of the RHI from user code, this is so you could swap in ogl, dx etc and the user code should not know the difference. All you should have access to is the base FDynamicRHI class, which you call blindly, in the case of DX11 this then does the appropriate dx bits under the hood.
The exception to the above is getting the dx11 device for starting up noesis. In this case there is a patch to FDynamicRHI that adds FDynamicRHI::GetNativeInterface() that should return the dx11 device, not sure if its in the main release but it was submitted a while back by the coherent team. (https://github.com/CoherentUE4/UnrealEn ... a7e6edcc58)
This technically breaks isolation, but saves you from having to do everything with RHI code changes.
I probably didn't make things clear in my previous post, but RHISetRenderTargets and CommitRenderTargetsAndUAVs are members of the base class FDynamicRHI, which you should be able to get hold of a reference to using the GDynamicRHI global. You shouldn't need to cast this to ID3D11DynamicRHI, but I would assume doing so is possible (although if you can avoid doing so you make supporting opengl in noesis easier).
you probably need to call RHIDiscardRenderTargets after noesis has rendered to unbind things and clean up
Also not sure about threading in this scenario, you might need to use delegates to ensure that code executes on the render thread. might be worth looking up the ENQUEUE_UNIQUE_RENDER_COMMAND macro if you haven't done so already.