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
DX12 video backend #3364
DX12 video backend #3364
Conversation
| HINSTANCE hD3DDll12 = nullptr; | ||
| int d3d12_dll_ref = 0; | ||
|
|
||
| namespace D3D |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
With the feature freeze planned for January 7th, whether this is approved for merging or not, I think merging should be off the table until after 5.0... A new experimental backend would be impossible to iron out and test enough to get to stable standards in time. :/ It would be a great post-5.0 feature though! |
| D3DBlob::D3DBlob(unsigned int blob_size, const u8* init_data) : ref(1), size(blob_size), blob(nullptr) | ||
| { | ||
| data = new u8[blob_size]; | ||
| if (init_data) memcpy(data, init_data, size); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Reviewed 3 of 34 files at r8, 5 of 22 files at r9. Source/Core/VideoBackends/D3D12/D3DTexture.cpp, line 134 [r9] (raw file): Comments from the review on Reviewable.io |
|
Review status: 29 of 66 files reviewed at latest revision, 48 unresolved discussions. Source/Core/VideoBackends/D3D12/D3DQueuedCommandList.cpp, line 34 [r7] (raw file): Comments from the review on Reviewable.io |
|
Review status: 29 of 66 files reviewed at latest revision, 48 unresolved discussions. Source/Core/VideoBackends/D3D12/TextureCache.cpp, line 352 [r7] (raw file): Source/Core/VideoBackends/D3D12/TextureCache.cpp, line 662 [r8] (raw file): Source/Core/VideoBackends/D3D12/TextureCache.cpp, line 672 [r8] (raw file): Comments from the review on Reviewable.io |
|
Review status: 29 of 66 files reviewed at latest revision, 48 unresolved discussions. Source/Core/VideoCommon/TextureCacheBase.cpp, line 355 [r7] (raw file): Did notice the parameter is 'lastTexture' in some places instead of 'last_texture', so fixed that locally, will include in next commit. Comments from the review on Reviewable.io |
|
Review status: 29 of 66 files reviewed at latest revision, 48 unresolved discussions. Source/Core/VideoBackends/D3D12/D3DCommandListManager.h, line 37 [r7] (raw file): Source/Core/VideoBackends/D3D12/D3DQueuedCommandList.cpp, line 375 [r7] (raw file): Source/Core/VideoBackends/D3D12/D3DQueuedCommandList.h, line 629 [r8] (raw file): Source/Core/VideoBackends/D3D12/D3DStreamBuffer.cpp, line 136 [r7] (raw file): Source/Core/VideoBackends/D3D12/D3DTexture.cpp, line 134 [r9] (raw file): Source/Core/VideoBackends/D3D12/TextureCache.cpp, line 640 [r8] (raw file): Source/Core/VideoBackends/D3D12/VertexManager.cpp, line 28 [r7] (raw file): Source/Core/VideoBackends/D3D12/VertexManager.cpp, line 54 [r8] (raw file): Source/Core/VideoBackends/D3D12/D3DBlob.h, line 33 [r8] (raw file): Comments from the review on Reviewable.io |
|
Review status: 25 of 66 files reviewed at latest revision, 49 unresolved discussions, some commit checks failed. Source/Core/VideoBackends/D3D12/D3DCommandListManager.h, line 37 [r7] (raw file): Source/Core/VideoBackends/D3D12/D3DStreamBuffer.cpp, line 136 [r7] (raw file): Source/Core/VideoBackends/D3D12/D3DUtil.cpp, line 24 [r7] (raw file): Comments from the review on Reviewable.io |
a1f63e8
to
387d3f8
Compare
|
Reviewed 1 of 34 files at r8, 1 of 22 files at r9. Source/Core/VideoBackends/D3D12/D3DBase.cpp, line 928 [r7] (raw file):
NVIDIA's D3D12 guide (https://developer.nvidia.com/dx12-dos-and-donts) says to use GetFrameLatencyWaitableObject() for this type of thing, which due to the video thread requiring the backbuffer index won't work here (for the same reason the time check is not accurate, ideally the video thread would not have to worry about this state at all) After testing, it seems the only times the framerate will be limited is when Direct Flip is being used, (i.e. the compositor being bypassed, so fullscreen modes where there isn't another window on top), limiting FPS to 90. Windowed does not have this issue. I think it's better to remove the hack, given this is going into a stable release, and drivers may change in the future. If users want to have the game running at above 90fps in current environments, use windowed mode (unless there's another way to bypass direct flip), after all it is an experimental backend. Alternatively, at least bypass it when running in windowed mode. But I'm happy to be convinced otherwise. Source/Core/VideoBackends/D3D12/D3DUtil.cpp, line 24 [r7] (raw file): Comments from the review on Reviewable.io |
|
Review status: 27 of 61 files reviewed at latest revision, 39 unresolved discussions. Source/Core/VideoBackends/D3D12/D3DBase.cpp, line 928 [r7] (raw file):
I'd vote for keeping it for these reasons:
Once this is fixed in the OS/drivers, I'm happy to remove it asap when it's no longer needed.. Source/Core/VideoBackends/D3D12/D3DUtil.cpp, line 24 [r7] (raw file): Comments from the review on Reviewable.io |
|
Touching the texture cache slider causes a lot of textures to flicker/disappear for one frame. Changing IR as well. Turning on XFB (I know it's not supported) causes the screen to black out. When you consider we have INIs that do that, maybe it'd be best to just ignore XFB setting for now? |
|
At lower IRs, DX12's performance is superior, but it really flies at 4x - 8x IR. At 4K resolutions, Super Mario Galaxy 2 was 48% faster on D3D12 vs OpenGL/D3D11 (GTX 760) Stability wise, I (driver) crashed once early on while tabbing. Haven't had a crash since in two days of use. |
|
I noticed under DirectX12 there is more shader stuttering , it tates more time to create shaders...is this a known issue? I'm really excited to test this on my GTX970 SLI. Great job ;). I will try 4K resolutions as @JMC47 said. Keep working. |
|
Shader Generation is about the same for me. It's just that we're usually more aware of it when we're looking for it. |
|
Reviewed 1 of 34 files at r8, 2 of 22 files at r9, 4 of 21 files at r11, 3 of 4 files at r12, 2 of 2 files at r13. Comments from the review on Reviewable.io |
|
Review status: 39 of 61 files reviewed at latest revision, 1 unresolved discussion. Source/Core/VideoBackends/D3D12/D3DBase.cpp, line 928 [r7] (raw file): Comments from the review on Reviewable.io |
This pull request contains a new DX12 video backend, as well as two minor additions to the shared Render interfaces that were needed for performance/cleanliness reasons.
This backend provides decent performance gains on graphics-intensive titles, and is fairly conformant to the existing D3D11 backend (no known issues). Performance results from various people are posted here: https://forums.dolphin-emu.org/Thread-unofficial-dolphin-dx12-backend
This does not yet implement the GPU bounding box, XFB rendering, or performance query features. The only known correctness issue is with multisampling on AMD hardware, this doesn't repro on other hardware or the software Basic Display Driver.
This backend is based off the existing D3D11 backend, and porting changes between them is fairly trivial (this pull request contains all of the recent changes to the D3D11 backend). The main areas of divergence are resource binding and state management. All shaders are identical, maybe these could be factored into D3DCommon?
The backend also contains its own background thread to perform graphics processing. This is actually done automatically by the D3D11 and OpenGL graphics drivers, but is needed to be done manually on D3D12. This is done by writing a class that implements the ID3D12GraphicsCommandList interface (the equivalent of ID3D11DeviceContext in D3D12), so it doesn't 'pollute' any of the renderer code - its use can be disabled via a #define in d3d12base.h.
Interested in any feedback on the code or architecture, thanks. Also please let me know if the pull request should be factored any differently.