Skip to content

libobs-d3d12: Add D3D12 graphics backend support#12899

Closed
wanhongqing123 wants to merge 16 commits intoobsproject:masterfrom
wanhongqing123:master-d3d12-new-2
Closed

libobs-d3d12: Add D3D12 graphics backend support#12899
wanhongqing123 wants to merge 16 commits intoobsproject:masterfrom
wanhongqing123:master-d3d12-new-2

Conversation

@wanhongqing123
Copy link

@wanhongqing123 wanhongqing123 commented Dec 9, 2025

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.

  • Implement all interfaces in graphics.
  • If a device support D3D11On12, then use D3D11On12 Device instead.
  • Image、duplicator、video、GDI+ source have been tested.

Motivation and Context

As Windows updates and iterates, D3D11 may become obsolete, so D3D12 will be supported here.

How Has This Been Tested?

  • Video, Image, Color, Duplicator source is teseted.
  • Recording is tested.
  • Color Range and Space is tested
  • NVIDIA's encoder plugin should be reimplemented using D3D12, but that's not included in this PR for now. I will submit a PR for a D3D12 encoder later.
  • The WinRT Capture section reuses the renderer's device code; however, Microsoft's WinRT Capture may not currently support capture strategies for D3D12 devices. I also consulted some resources but couldn't find a WinRT D3D12 capture implementation. Therefore, this is implemented using a shared texture between D3D11 and D3D12.
  • Duplicator Capture not supported by D3D12 Device, this is implemented using a shared texture between D3D11 and D3D12.
    you can use D3D12 by:
image

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

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.
@wanhongqing123 wanhongqing123 force-pushed the master-d3d12-new-2 branch 2 times, most recently from e76225e to e7e2ba5 Compare December 9, 2025 13:10
@wanhongqing123
Copy link
Author

How do I format CMakeLists.txt?

@wanhongqing123
Copy link
Author

How do I format CMakeLists.txt? @PatTheMav

@Fenrirthviti
Copy link
Member

This, again, appears to have been submitted prematurely. Please do not use the main repo of a project as a staging ground for your work. PRs should be feature complete, compliable, and functional before they are opened.

Additionally, as mentioned in #12817, this fundamental approach has the same issues and the feedback there was not addressed. A d3d12 renderer should be written from scratch and not just be a modification of d3d11. I suggest looking at what was done with the Metal renderer for an idea on how this should be implemented.

Since this is a major addition to the project that you are asking us to accept maintenance for, I would recommend reaching out to have conversations with us first before continuing work.

This PR is not likely to be accepted without a complete change of approach.

@wanhongqing123

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants