-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding DX12 support to OpenSubdiv #938
base: dev
Are you sure you want to change the base?
Conversation
Adds basic d3d12 support for OpenSubdiv. This includes: * D3D12 port of the D3D11 backend osd code * Pooled allocation of command lists and command allocators * Deferred deletion of resources based on fence tracking * Shaders modified to use structured buffers if USE_STRUCTURED_BUFFERS macro is true. This allows the d3d12 implementation to use root views * CMake files modified to grab the Win10 SDK Adding missing FindDX12SDK.cmake Using descriptor tables instead of root views, fixing synchronization bug Adding D3D12VertexBuffer files that were dropped in last commit Removing defaulting of the d3d12/dxgi debug layer and CMake fixes Adding 11on12 to interop with 12 OSD implementation Enabling DXViewer to switch between using DX11 and DX11on12 Additionally fixing DX11 implementation device leaks and removing unnecessary dx12 files Fixing several refcount leaks that were causing issues when transitioning in and out of d3d12 Fixing a missed rebase conflict Cleaning up debug code and other dxviewer cleanup Reverting garbage that came with my last commit First Iteration of adding D3D12 backend to OpenSubdiv Cleaning up hlsl First Iteration of adding D3D12 backend to OpenSubdiv Fixing DXViewer to compile with NODX12 flag First Iteration of adding D3D12 backend to OpenSubdiv
One other note, I'd highly recommend moving the D3D11 code to using CComPtr or some type of RAII structure. I went the route of manually releasing since CComPtr's don't seem to be the coding style, but it's incredibly difficult to avoid regressions if you rely on manual release's. If this sounds interesting, I'd be happy to take a look at this in a separate PR. |
Thanks! Taking a look through the PR this evening. |
The AppVeyor build failure can be fixed by changing: |
Will play around with this more tomorrow, it's correctly finding the directory I'd expect d3d12.h to live in (C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/um), but somehow still not finding d3d12.h itself. Any idea on how I can find out more about the build environment AppVeyor uses to try and repro this break myself? |
CMake is finding the Windows 10 SDK here: With the updates to your branch, I'm able to build locally without errors... |
Hah, silly cmake issue. I suspect it was building locally because Visual Studio sometimes automagically adds the Windows 10 SDK includes, AppVeyor was catching a legitimate issue. |
Talked briefly with David at SIGGRAPH, I'm going move the 11on12 implementation to instead just use pure D3D12 which will be cleaner and more performant, at the cost of partially duplicating a lot of the existing DX11 logic (GUI/DXViewer code). |
Filed as internal issue #151992. |
I wanted to ask how the progress with this is. Since DirectX is now out since 6 years I guess one can even discuss to replace the DirectX11 backend with a DirectX12 backend. As far as I understand what is blocking this was the code duplication caused by DirectX 11/12 coexistence. IMHO those who want to use DirectX11 can use the current release. I don't see a good reason to support DirectX 11 forever and not DirectX 12. At least for new software DirectX 11 is deprecated. |
Hi, we've been working on this along with looking into improving support for the other current APIs like Vulkan and Metal, though unfortunately we don't have a timeline to share at the moment for this work. One concern here isn't so much about DX11 vs DX12 and instead about taking into consideration some of the other issues called out in the notes above, e.g. async compute, and staged buffer allocation and data transfers, etc. which are important for efficiency and good performance. The outcome will probably be quite different that what is represented in this pull request. |
At a high-level, this change includes:
Please do ask away if you have any questions!
DX12 Back End:
The DX12 implementation is ported from the existing DX11 code, and is overall similar in design. Regarding DX12 specific details:
DXViewer:
Performance:
Note: Performance is not a completely fair test since DXViewer with DX12 is using DX11on12 which is an emulation layer and slightly slower on both the CPU & GPU. A full DX12 port of DXViewer would be required for complete data. Nonetheless, I've put some GPU frames times of workloads (all at Lv 10 tessellation) to give a gist of the perf. Data was taken on a NVidia GTX 760:
------------------------------------ DX11 -------------- DX12
catmark_car ---------------------- 3.9ms ------------- 3.7ms
catmark_bishop ------------------ 2.2ms ------------- 2.0ms
catmark_nonman_qualpole360 - 70.0ms ------------72.0ms
Future Optimizations