Access GPU resource

I’m currently searching inside the engine code to find how to get access to the GPU resources. I need access to the DirectX device (DX11 only) to create a shared texture with another process of my own.

I know that once I will get access to the device, the rest will work. But I don’t find how/where to do that.

I already found that in MediaCapture (inside the runtime/MediaIOCore module) are two lines that are good candidate as entry point.

// Asynchronously copy target from GPU to GPU
RHICmdList.CopyToResolveTarget(SourceTexture, DestRenderTarget.TargetableTexture, FResolveParams());
    
// Asynchronously copy duplicate target from GPU to System 
MemoryRHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, InCapturingFrame->ReadbackTexture, FResolveParams());

I suspect that if I can get some of my code near that, I can gain the access to what I want.

If anyone has pointers, you’re welcome.

I found the answer by myself.

For those wandering how to do, you must use ENQUEUE_UNIQUE_RENDER_COMMAND_XXXPARAMETER() with XX beeing 1->6 in full letter.

This will allow your code to run on the rendering thread. Based on the rendering thread and the code found above the one mentioned in the question, it is quiet easy to get access to the texture which is currently the latest rendered.