# Knowing which RHI has been used in a project from the code?

**URL:** <https://forums.unrealengine.com/t/knowing-which-rhi-has-been-used-in-a-project-from-the-code/455808>\
**Category:** Rendering\
**Tags:** rhi, directx, unreal-engine, Rendering, CPP, question\
**Created:** [September 23, 2019, 12:59am UTC](https://forums.unrealengine.com/t/knowing-which-rhi-has-been-used-in-a-project-from-the-code/455808 "2019-09-23T00:59:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kakushi\_52](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kakushi\_52](https://forums.unrealengine.com/u/Kakushi_52)\
**Post date:** [September 23, 2019, 12:59am UTC](https://forums.unrealengine.com/t/knowing-which-rhi-has-been-used-in-a-project-from-the-code/455808/1 "2019-09-23T00:59:46Z")

</div>

Is there any way which RHI has been used in a project from the code?  
I’d like to handle DirectX directly so I’d like to know especially which of the DirectX (11 or 12) has been used in the project from the code.

I wonder if there are some macros like D3D11, or D3D12, and if I can write something like the following,

```
#ifdef D3D11
...
#elif D3D12
...
#else
...
#endif

```

I’d like to write some CUDA DirectX interoperability, and for that, I need to know the DirectX version being used, and I think I have to write both code for the packaged game.

Or is the default DirectX version used in 4.22 or 4.23 DirectX 11 unless we use Ray Tracing?

Thank you.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [September 23, 2019, 1:21am UTC](https://forums.unrealengine.com/t/knowing-which-rhi-has-been-used-in-a-project-from-the-code/455808/2 "2019-09-23T01:21:57Z")

</div>

There no way to do this in compilation time as RHI is fully dynamic and can be switched on runtime, so on compilation time there no way to figure which RHI gonna be used and not mention as enigne is already compiled in launcher build. You need to check this on runtime, if you can not build specific functions if RHI is not active, you could do sperate module which loaded manually when specific RHI is used. You can get RHI information from here in im not mistaken

[https://docs.unrealengine.com/en-US/API/Runtime/RHI/GetDynamicRHI/index.html](https://docs.unrealengine.com/en-US/API/Runtime/RHI/GetDynamicRHI/index.html)

Pretty much everything in UE4 is modular and dynamic, only thing that i know that is statically build is platform support (FPlatform), but since platform can have multiple rendering library rendering is not part of it. No to mention Reader Hardware Interface has Interface in name for the reason

---

<div class="post-metadata">

**Author:** ![Kakushi\_52](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kakushi\_52](https://forums.unrealengine.com/u/Kakushi_52)\
**Post date:** [September 23, 2019, 2:34pm UTC](https://forums.unrealengine.com/t/knowing-which-rhi-has-been-used-in-a-project-from-the-code/455808/3 "2019-09-23T14:34:23Z")

</div>

Thank you so much for your super quick reply!

I found the following question

> **[How could I know which RHI is performing on the currently running device](https://forums.unrealengine.com/questions/787820/how-could-i-know-which-rhi-is-performing-on-the-cu.html)**
>
> some of devices doesn’t support Vulkan. if then UE4 automatically selects RHI as OpenGL ES. and in that case, I couldn’t know my app running on OpenGL ES or Vulkan So, is there proper way or correct way of getting current RHI on the current...

and found that FHardwareInfo::GetHardwareInfo(NAME\_RHI) mentioned above returns RHI name on runtime.

As far as I’ve searched the code, I think the return value is one of the followings, “D3D11”, “D3D12”, “OpenGL”, or “”.

And according to my experience (at least on my PC), if the Default RHI in Project Settings is set to “Default”, Direct3D 11 seems to be selected.

---

<div class="post-metadata">

**Author:** ![nande](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nande/32/1057698_2.png) [@nande](https://forums.unrealengine.com/u/nande)\
**Post date:** [July 29, 2025, 12:04am UTC](https://forums.unrealengine.com/t/knowing-which-rhi-has-been-used-in-a-project-from-the-code/455808/4 "2025-07-29T00:04:38Z")

</div>

you can also use FApp::GetGraphicsRHI()  
it returns a string. like “Vulkan (SM6)”  
it’s the easier way i found.
