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
D3D: Add exclusive fullscreen support. #506
Conversation
|
this should fix gsync in D3D |
|
The only thing the previous "3D Vision" option did was enable exclusive fullscreen and apply a hack: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/FramebufferManagerBase.cpp#L234 I suspect the hack was necessary due to the hacky implementation of exclusive fullscreen. I'm pretty sure this PR fully restores the 3D Vision functionality in Dolphin. |
|
Currently this PR deadlocks while the GUI thread is waiting for the EmuThread to shut down, which is waiting for the VideoBackend to shut down, which in turn is waiting for the GUI thread to respond. Having this kind of synchronisation between the GUI thread and the VideoBackend will cause deadlocks when using exclusive fullscreen according to the DXGI documentation. |
|
The code looks good to me. I'll try to test this later today on Linux to make sure it doesn't break anything. @JMC47 can you do some testing on Windows? Especially stuff like render to main window, making sure GL/SW aren't broken, etc. |
|
I think it should definitely be an option, because some people may prefer the old behaviour which is more responsive when you're often switching between windows. I am in favor of turning it on by default though. Should such an option also affect the "confirm stop" behaviour which was changed in d6e9e13? This commit was necessary, because you might end up with a black screen if you don't fully exit exclusive fullscreen first. |
|
Hey, I try this with 3D Vision, but the full screen results in a small window within a huge black border, I've tried setting internal resolution to 1920x1080, Auto, Aspect Ratio to all of the available settings and unable to get a FULL screen. |
|
@SirBaron Thanks for reporting that, it must be an issue with the wrong display mode being selected by DXGI when going to fullscreen. I thought I solved it already, I'll provide a better solution tomorrow. |
|
Just incase my wording was poor. It does go into Exclusive Full screen and trigger the 3D Vision to work, but it's just a tiny portion of the screen is the actual game. This only happens with this build, old builds of Dolphin the screen goes full screen, but that was the DirectX 9 builds. |
|
@SirBaron I think I understood it correctly the first time. It's selecting a resolution that is too low right? Though most displays would automatically stretch the image. Are you able to move your cursor into the black border? |
|
No I am unable to move the mouse cursor into the black border. |
|
Then that confirms that an incorrect display mode is being selected, I will fix it tomorrow. |
|
Hmmm might have been a false bug, deleting a prior profile from nvidia inspector and restarting the PC fixed it. Sorry! ¬_¬ |
| @@ -44,6 +44,8 @@ static u32 s_LastAA = 0; | |||
|
|
|||
| static Television s_television; | |||
|
|
|||
| static bool s_LastFS = false; | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
I've made changes based on feedback and also fixed two more bugs. I'm now doing some more testing to try and find more issues. After I'm done testing I will make an option in the video settings that allows you to turn this fullscreen behaviour on/off. @JMC47 Reported that when spamming the fullscreen hotkey there is a race condition that causes the render window to cover the entire screen. Solving this problem would make the hack used in 1aa515a significantly more complex, time would be better invested in trying to get rid of it entirely. I think it's an acceptable down-side right now, I will do my best to eventually get rid of the hack. I've also included all information I have about the problem in the comments. But I'd rather not make this fullscreen behaviour the default as long as unreliable hacks are still being used. |
|
@dolphin-emu-bot rebuild |
| // as soon as the window is resized. However since the timing | ||
| // for it is very difficult to get right and would increase | ||
| // coupling with the interface, we apply a hack instead. | ||
| // http://msdn.microsoft.com/en-us/library/windows/desktop/ee417025%28v=vs.85%29.aspx#full-screen_issues |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Addressed one more issue based on tester feedback, still waiting on confirmation that the issue is fixed. |
Also have the renderer remember its own fullscreen state. This is done to prevent a case where we exit exclusive fullscreen through the configuration and a focus shift at the same time. In this case the renderer would fail to detect that the fullscreen state was changed.
|
@dolphin-emu-bot rebuild |
|
All issues outstanding issues have been addressed, ready for review. One commit was added since the branch was last discussed on IRC. Switching to fullscreen while paused will have the emulator correctly enter fullscreen, but the user won't be able to exit fullscreen since the renderer is unable to tell the UI whether it is safe to do so. In the case where the user is already in exclusive fullscreen switching out of exclusive fullscreen is never safe anyway. Therefore commit 8a221da prevents fullscreen switches in paused state when exclusive fullscreen is enabled to prevent unexpected behaviour. Allowing the renderer to respond to fullscreen switches while paused would properly fix this issue, however that is outside of the scope of this PR. |
| ToggleDisplayMode(fullscreen); | ||
| if (m_RenderFrame != nullptr) | ||
| m_RenderFrame->ShowFullScreen(fullscreen); | ||
| if (m_confirmStop) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
The hack was needed because the Nvidia 3D Vision heuristics are documented to only support surfaces that are the same size as the backbuffer. This would be the case if you enabled the hack and selected the "Auto (Window Size)" internal resolution. However, on recent drivers the same effect is achieved by selecting the "Auto (Multiple)" internal resolution. Therefore the hack is no longer required.
|
Implemented changes based on feedback. Also amended bd9953d to remove some remnants from the 3D Vision hack. |
|
Fixed a Mac OS X build error, ready for review. |
|
@Armada651: This comment grants you the permission to merge this pull request whenever you think it is ready. After addressing the remaining comments, click this link to merge. LGTM. Feel free to squash whatever you think should be squashed. @dolphin-emu-bot allowmerge |
D3D: Add exclusive fullscreen support.
This PR adds support for exclusive fullscreen when "Render to Main Window" is disabled. Please test it out and provide me with some feedback so I can polish things were necessary.
Build available at: https://dl.dolphin-emu.org/prs/pr-506-dolphin-latest-x64.7z
Changes
To-do
Considerations
Will exclusive fullscreen be an option or always on? Would such an option will be the default or optional?
At this moment I consider support for OpenGL or "Render to Main Window" outside of the scope of this PR, unless such support is considered essential before adding this feature.
Fixed issues
Issue 6713 and 7334 should be fixed by this change.
3D vision support is restored in DX11 with a much cleaner implementation which fixes issues 3979, 4726, 4732 and 5990.
It may also help Nvidia Optimus detect Dolphin as an application that requires high performance, can anyone test that?