Expose some DirectX 12's flags.

Recently I managed to connect Unreal Engine 4 and CUDA via DirectX 11 without custom engine build. “Connect” here means using some result on GPU memory by CUDA as a resource of Unreal Engine 4 directly, without passing CPU memory.

Now I’d like to do the same thing via DirectX 12, instead of DirectX 11.

In order to do so, ID3D12Resource such as vertex buffers or index buffers seem to have to be initialized with


and the fence, ID3D12Fence with


according to NVIDIA’s official sample code.…es/simpleD3D12

However, RHI on DirectX 12 always uses either




and the D3D12_FENCE_FLAGS is always


We cannot change or add the flags without custom engine build (if I’m correct).

So it would be great if we can choose the flags freely like we can choose D3D12_RESOURCE_FLAGS (and D3D11_RESOURCE_FLAGS) through the argument

uint32 InUsage

(EBufferUsageFlags such as BUF_Static, BUF_UnorderedAccess) whenever we call RHICreateVertexBuffer.

Maybe we have to change all the RHICreateVertexBuffer, RHIAsyncCreateVertexBuffer, RHICreateAndLockVertexBuffer, or some other CreateBuffer-related functions by adding an extra argument such as InFlags, and change the default fence flag to D3D12_FENCE_FLAG_SHARED, but this kind of improved freedom will make it possible to connect CUDA and Unreal Engine 4 via DirectX 12.

It would be appreciated if I get some comments on this.
Thank you.