libobs-d3d12: Add D3D12 graphics backend support#12907
libobs-d3d12: Add D3D12 graphics backend support#12907wanhongqing123 wants to merge 16 commits intoobsproject:masterfrom
Conversation
9953466 to
53faa4f
Compare
|
Hi, please dont give up, this feature sounds awesome for modern GPUs! cannot wait to see it in release version |
|
Was also too interested for my own good in trying this out and spent a frustrating amount of time getting set up only to get stuck with a NVENC exceeding height/width error that I don't get with my 5060 on the latest OBS Studio's NVENC encoder. Guess I will just have to hope that Wan shows up to continue at a later point. |
|
Currently, there is a memory leak issue in the main process of NVIDIA's encoding module, and I am working on fixing it. |
👍Glad to see you're still interested then. Was just a but of a mood killer to hit the streaming button only to stuck with the error. For as much as there are additions that I am looking forward to adding to my ease-of-streaming repertoire from the upcoming build of OBS Studio, this has my interest enough that I am fully prepared to stick with it for however long until merged (depending on the stability.) |
56a37ec to
1a8ae76
Compare
|
This PR can now be used to experience D3D12 features. |
2a27218 to
87fc2d5
Compare
Haven't tried the latest pr action with the code cleaning, but 2nd to latest I was able to record with the NVENC HEVC D3D12 Encoder quite well for the better part of an hour test. Only thing is now the H.264 D3D12 doesn't show up — unless I am missing that it is currently not included — and it still errors out when I try with the default H.264. From my log. Still don't have this issue with latest release of OBS Studio or Release Candidate in portable mode. Also can't tell if it is because the newest release I tested fixed it or if recording before helps workaround the problem, but initially when I would try and test stream, after the error out it would also act like it was attempting to record as well but hang and then OBS Studio itself would hang when I would try and exit, forcing me to close it out with Task Manager. |
I'm fixing this issue, which is caused by your current rendering device being D3D12, but your encoding device is using D3D11. |
D3D12 is a new api in windows10 and windows11, Direct3D 12 lets apps get closer to hardware than ever before. By being closer to hardware, Direct3D 12 is faster and more efficient. - Implement all interfaces in graphics. - If a device support D3D11On12, then use D3D11On12 Device instead. - Image、duplicator、video、GDI+ source have been tested.
51197f3 to
ebad3c2
Compare
|
The development of the D3D12 rendering module has been completed. All modules have been tested on my machine and are now ready for code review. |
No one else has commented on their own testing but I just finished using the last pr action build the same way as I did before and it will be my go to until officially merged or otherwise. Decided to try out the Multi RTMP plugin with it as well and it was smooth sailing. |
|
From a quick look-test-see, still builds and runs on Linux at least. :] |
|
What the chances to see it in Q2 in prod? |
Zero. |
Seems like something that will take a byte more review than possible to be done for that to happen perhaps. Nothing stopping from building from source and applying the changes as a patch though! |


Description
D3D12 is a new api in windows10 and windows11, Direct3D 12 lets apps get closer to hardware than ever before. By being closer to hardware, Direct3D 12 is faster and more efficient.
Motivation and Context
As Windows updates and iterates, D3D11 may become obsolete, therefore D3D12 will be supported here.
@Fenrirthviti disagrees with reusing D3D11. The current OBS architecture's rendering pipeline is single-threaded, and multi-threading cannot be implemented at the underlying level. Therefore, D3D12 and D3D11 share some code. I will later place the common methods of D3D11 and D3D12 in appropriate locations.
Furthermore, in the current D3D11 rendering architecture, if the output frame rate is set to 60fps or 120fps, the frame rate will drop when the mouse moves to the middle of the rendered object. With technological advancements, 120fps and 60fps will become necessary. Currently, D3D12 Render and D3D12 NVENC hardware encoding can effectively utilize the advantages of modern GPUs.
Furthermore, NVIDIA graphics cards now support D3D12 encoding mode, so obs-nvenc also needs some modifications.
How Has This Been Tested?
you can use D3D12 by:
Types of changes
Checklist: