TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.18k stars 382 forks source link

There is no "true" fullscreen #825

Open Vykori opened 7 years ago

Vykori commented 7 years ago

Apologies if this isn't the correct place to post something like this. This is more of a suggestion/enhancement.

I'm using BizHawk version 1.12.0, on Windows 10

There are 2 reasons I'd like to have fullscreen. One reason is for lower latency (fullscreen programs avoid Windows' vsync with aero enabled), and the other reason is a little silly...
I have a monitor with Nvidia G-sync support, which synchronizes the refresh rate of your monitor to the FPS of whatever fullscreen program is running. The NES runs at slightly below 60fps, and I'd like to use G-sync with BizHawk to avoid small framerate hitches caused by the NES framerate not matching my monitor refresh rate.
Within Nvidia control panel, there is a setting to enable G-sync for fullscreen as well as windowed programs. But even with that enabled, I've had no success getting my monitor to sync with bizhawk.

In BizHawk's display configuration, within the "Window" tab, there's a setting called "Enable Windows Fullscreen Hacks", and a description that explains that it prevents the program from going into "actual fullscreen". Even with that setting enabled or disabled, I still can't achieve real fullscreen.

zeromus commented 7 years ago

Bizhawk will probably never have a true fullscreen option. However, it might if I can confirm that it's needed to make gsync or freesync work. I don't have a monitor supporting either so I haven't researched it yet. I wonder how nvidia knows which program to pay attention to when enabling gsync for windowed programs? What if you run two programs at once windowed?

But it doesn't matter: In bizhawk you can fix scrolling hiccups by choosing "vsync throttle". However, vsync is broken by many GPUs so I don't know how well it works in any particular case.

Note that you will NOT want vsync throttle enabled if youre trying to get gsync or freesync to work. That's my understanding anyway, but I don't have an encyclopedic knowledge of the chess moves required to defeat the GPU driver like PC gamers do.

Vykori commented 7 years ago

well I can't speak for freesync but I'd be happy to test any gsync stuff for you

about your question with what would happen with 2 windowed games running at the same time, gsync just syncs to whatever program is currently in focus. that has always worked fine, but usually gsync won't activate on "normal" programs (notepad or chrome, for example), probably to prevent the monitor from dipping to the minimum supported refreshrate (I think 12hz in my case) when the program isn't updating anything. I don't know what triggers gsync to enable or not. I always just assumed if the current program was using directX or openGL or something, then it's considered a "game" and gsync turns on, but that doesn't seem to be the case.

I just quickly tested, and gsync still doesn't want to turn on when I switch bizhawk to openGL or GDI+ mode.

in directX mode, vsync throttle (with vsync enabled or disabled) just causes the game to run at 144fps, which is my monitor refreshrate when G-sync isn't active. (in openGL or GDI+, it just goes unthrottled and shoots off to some hundreds of FPS. I assume that means it doesn't work). I could set my monitor to 60hz to actually be able to play with vsync throttle on, but the NES won't be running quite at native speed (only 0.164% difference, but still) and it'd be a bother to change back and forth from 60hz to [my normal setting]hz every time I want to use bizhawk

so yes, frame syncing works with vsync throttle, however it's really more of a workaround to get frame syncing working on my gsync monitor, which at this point is acting as a perfectly typical monitor without gsync.

I don't know why gsync won't activate for bizhawk, but usually anything fullscreen will turn on gsync. currently the only program I've ever seen that doesn't enable gsync in fullscreen is FCEUX, which is weird because it works in windowed mode. but for example minecraft won't trigger gsync until I put it in fullscreen mode, and euro truck sim 2 and most other games will run with gsync windowed or fullscreen no problem. I just tested everything I said to double check. if you want me to test preview builds or anything like that, I'd love to help :D

zeromus commented 7 years ago

can you force gsync on for a particular application in the nvidia control panel? I dont want to play chess against nvidia's heuristics. it could even be a whitelist by .exe name for all we know.

I said vsync throttle WILL NOT work with g-sync. You should pick audio throttle in theory (but since that doesn't seem to work [? ?] pick clock throttle)

Vykori commented 7 years ago

well in the application-specific settings, you can set "monitor technology" to be G-sync or fixed-refresh, but if your global setting is already G-sync this doesn't change anything. Nvidia still chooses if g-sync is currently active or not. so really, you can only force gsync off. I just tried anyway to be sure, and yeah my monitor is still saying it's receiving a locked 144 fps while the game is playing at ~60fps

I know you said vsync throttle won't help with getting gsync to work. I agree with that idea. sorry for my strange wording in my previous comment. I was just explaining how using vsync throttle instead of gsync isn't a perfect replacement.

and audio throttle seems to work just fine for me... I'm not sure if you misunderstood my wording or if that's an issue other people are having and I'm not, or something else. I figured clock sync and audio sync would effectively be identical. is one more accurate than the other?

zeromus commented 7 years ago

audio sync was grayed out for me. dunno why, dont care. anyway, if audio throttle works (at all) then it should work with g-sync. As far as I know, a programmer uses gsync just by issuing frames and not waiting for vsync (make sure you also have vsync disabled, of course). If that doesn't work, then you need to ask nvidia, whose bank contains your money, why your g-sync doesn't work with (edited:) a gdi+ winforms direct3d9 application that is creating the device on an offscreen window, and manually presenting (with interval immediate) to a window via a separate swap chain.

(edit): Note that the way we do things is basically like a letter to nvidia pleading them to treat bizhawk like a biz application and not a game

Vykori commented 7 years ago

well, I suppose I should be contacting nvidia about this sure. I just have zero expectation for them to be able to change anything, or for them to reply as quickly or as well as you have been.

you said much earlier bizhawk probably won't have fullscreen unless it's needed for gsync/freesync. what's your motivation behind not supporting true fullscreen? I just see it as another feature some people may desire for their particular reasons.

zeromus commented 7 years ago

because the way bizhawk is engineered, it's like grafting an elephant trunk onto a human. Since some video cards (AMD I think?) have the hacks to enable fullscreen when the application tries to make windowed fullscreen, maybe you can find some registry or control panel hacks for nvidia to do the same. Maybe NVAPI can do it? DOn't immediately see how.

Margen67 commented 7 years ago

@zeromus I searched for a way to force exclusive fullscreen and all I found from Google was unrelated and/or doesn't apply.

I tried DxWnd but it doesn't do anything, and killing the DWM process which disables window composition/vsync causes problems since it's meant to always be running in Windows 8+. You can only disable it natively in Windows 7.

Nicholas-Steel commented 6 years ago

When you enable G-Sync in the global profile for the Nvidia Control Panel you sometimes have to reboot the computer for it to go in to effect globally (ie: if your monitor doesn't switch mode, reboot the PC). It's a little buggy sometimes on whether or not G-Sync will actually trigger, in my very limited personal experience with the technology (I returned my display for a refund after observing backlight flickering issues).

CasualPokePlayer commented 11 months ago

In modern Windows, it seems the proper way is to either use a DXGI swapchain and call SetFullscreenState (D3D11/12 only), or use VkSurfaceFullScreenExclusiveInfoEXT with Vulkan.

With D3D9, it seems the only option is to explicitly (re-)create the swapchain with fullscreen, which also means specifying the resolution and refresh rate and other junk. Very annoying and garbage and creating a D3D11/12 backend would be better.

OpenGL does not actually have any proper way to do this, other than hope OpenGL drivers do some "make windowed fullscreen actually exclusive fullscreen" optimization (the drivers on my laptop do this it seems, and it works fine other than VSync is needed to avoid a screen tearing mess, but that's understandable), or drivers possibly have some extension to allow just using some DXGI swapchain (lol).

In practice, a lot of this doesn't particularly matter, as exclusive fullscreen is no longer an actual thing in Windows (since Win 10), as Windows will just force exclusive fullscreen apps to actually be in a quasi windowed fullscreen mode that has the DWM give near total control to the application when it thinks that only the application is on screen. "To improve Alt+Tab" and also so they can shove their Xbox gamebar stuff onto games.

Alceris commented 9 months ago

Exclusive fullscreen is still a thing, at least in Windows 10, if you go to the exe's properties and under Compatibility check on Disable fullscreen optimizations.

CasualPokePlayer commented 5 months ago

use a DXGI swapchain and call SetFullscreenState (D3D11/12 only)

Nevermind, this cannot be done, as it's apparently not allowed for child windows.

Nicholas-Steel commented 5 months ago

Exclusive fullscreen is still a thing, at least in Windows 10, if you go to the exe's properties and under Compatibility check on Disable fullscreen optimizations.

Right, but not for DX 12 (which has never had FSE). I am just adding more clarity and am not correcting you.