joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.78k stars 381 forks source link

Opengl output problem when using windows vsync and svga. #2994

Open guitarman89 opened 3 years ago

guitarman89 commented 3 years ago

Code of Conduct & Contributing Guidelines

Have you checked that no other similar feature request(s) already exists?

Is your feature request related to a problem? Please describe.

I have noticed that the OpenGL of Dosbox-X is not as accurate in the FPS of some games as in the original Dosbox 0.74, I have noticed it especially in the game Jazz Jackrabbit 1 both in Dosbox 0.74 and Dosbox-X and Dosbox 0.74 keeps all the I spent the 60FPS of the game without any slight lag when moving from one side of the level to the other, which with Dosbox-X I have noticed that it does have small lag jerks from time to time.

My configuration on both the original Dosbox 0.74 and Dosbox-X is all from the factory except these options when I play Jazz Jackrabbit among others:

fullscreen = true fullresolution = desktop (I have noticed that fullresolution in 1280x800 is corrected to a real full screen without having black bands above and below in Jazz Jackrabbit)

machine = svga_s3 output = opengl

frameskip = 0 aspect = false doublescan = false scaler = 2xsai

cputype = auto cycles = auto or 12000

vsync = off

With this configuration I can get all the power of svga and opengl in games but I also have VSYNC activated on my Nvidia graphics card from Windows so that both Dosbox 0.74 and X get vsync, but I have noticed that Jazz Jackrabbit in the original Dosbox 0.74 with the Same configuration, when I move the character from one side of the game to the other, Dosbox 0.74 does not give any lag and the FPS remains fixed at 60FPS or so it seems, however I have tested it in Dosbox-X with the same configuration and Jazz Jackrabbit It gives some small lag in the FPS, I have made several configurations choosing other scalers and other different machines, the same problem and in the end the only one that seems to give the problem is the opengl output.

Jazz Jackrrabit 1 in Dosbox 0.74 with svga_s3, opengl and my Nvidia graphics card with vsync activated in Windows, it always handles it at a fixed 60FPS automatically and without any lag when you move from one side to the other of the game level, but in Dosbox -X in the same configuration does not handle fixed or stable 60FPS and having vsync activated from windows, doing it in Dosbox-X gives some small lags, but I have discovered that it is due to the handling of the opengl output, Dosbox 0.74 can do it well no lags having vsync but in Dosbox-X with opengl and vsync in Windows it gives small lags that in Dosbox 0.74 do not occur, due to the programming of the opengl output in Dosbox-X, Dosbox-X seems not to be exactly the same opengl as the of the original Dosbox 0.74 and it should be fixed, when used with graphics cards with vsync, there is no fixed and stable vsync in Dosbox-X and it should be fixed and adopt the same opengl of Dosbox 0.74 in Dosbox-X because the FPS is fixed and stable.

What you want

The solution to this should be to implement the same opengl output from Dosbox 0.74 in Dosbox-X, because they don't seem to be the same opengl and it doesn't handle FPS as well as the original Dosbox 0.74 does.

Another solution could be to add a built-in Dosbox vsync and disable Windows vsync in Dosbox and it could solve it like this, in this way Dosbox could handle its own vsync by software without the need to do it by hardware or by windows and it could fix the lag problems in games or it would be much more stable to do it by software vsync.

In this modified version of Dosbox called SVN r4019.3 Pixel-perfect/Savestates/VSYNC an option for internal software vsync was added instead of handling the one of the windows graphics card by hardware, they made it internal managed by software with an option called borderless=true: https://github.com/bladeSk/DOSBox-pixel-perfect/releases

I have tested it in games even having the windows vsync disabled from the graphics card and the vsync of this Dosbox works perfect, the borderless option of this Dosbox SVN4019.3 Pixel-Perfect makes a perfect vsync through software instead of hardware and fixes FPS problems and even fixes audio slowdown problems by having the borderless = true, so I think that the borderless=true option should also be implemented for Dosbox-X by calling it vsync = true in its Instead, the opengl output from the original Dosbox 0.74 should also be implemented in the Dosbox-X since with 0.74 the Jazz Jackrabbit having windows vsync does not give lag when moving, co sa that in Dosbox-X I have noticed that yes and the opengl output that was in Dosbox 0.74 should be implemented in Dosbox-X, and Dosbox-X should also implement the borderless=true of Dosbox SVN r4019.3 Pixel-perfect, this would solve many problems with vsync achieving it by software instead of hardware and it would avoid lags and audio slowdowns in adlib, also the current option forcerate could be replaced by the one of vsyncrate, since currently they do not have much utility and it would be a great advance and a great improvement for Dosbox-X.

Describe alternatives you've considered

Add to Dosbox-X the option of borderless = true of a modified version called Dosbox SVN r4019.3 Pixel-perfect/Savestates/VSYNC, since it would add a much more current and functional internal vsync support than the old vsync=true of the Dosbox SVN Daum, perhaps adding the borderless=true as vsync=true.

I have also noticed that the opengl output of the original Dosbox 0.74-3 is better and with Jazz Jackrabbit the windows vsync makes it perfect and maintains 60FPS without lag, which in Dosbox-X there is some lag with Windows vsync when moving around the level of the game in the screen movement, but in Dosbox 0.74-3 it has no lag and is 60FPS fixed and automatically and I think that the opengl output of the original Dosbox 0.74-3 works better and should also be added in Dosbox-X to the same as borderless = true, with these 2 implementations in Dosbox-X there would be better stability in the FPS and 0 lag, and it would be a great advance for Dosbox-X, it is the only thing that Dosbox-X lacks to be really stable in FPS in games and I hope that this support can be added in Dosbox-X because I also think that it would help to solve the slowdown of adlib audio in some games when using vsync, and there would not be this problem.

I hope this can be done for Dosbox-X also because the svga_s3 machines and support for glide and 3dfx of Dosbox-X do make Dosbox-X much better than the original Dosbox, also the game Fury of the Furries gives problems in blue colors and some textures of some levels with the original Dosbox using svga_s3, which in Dosbox-X with svga_s3 does not happen so Dosbox-X is much better and it would only need to add the borderless = true as internal vsync by software and add the original opengl output that was in Dosbox 0.74-3, with this Dosbox-X would make everything perfect and without lags but with the improvements of Dosbox-X.

Additional context

No response

rebb commented 3 years ago

Does this also happen when you play around with the other vsync related settings in Dosbox-X ? From the example .conf files that come with Dosbox-X :

[vsync]
# vsyncmode: Synchronize vsync timing to the host display. Requires calibration within DOSBox-X.
#              Possible values: off, on, force, host.
# vsyncrate: Vsync rate used if vsync is enabled. Ignored if vsyncmode is set to host (win32).
#              Possible values:.
vsyncmode = off
vsyncrate = 75
guitarman89 commented 3 years ago

Hello, these are my tests together with an improvement that I would like to contribute.

Things I have noticed in Dosbox-X and Dosbox 0.74

Yes, with the vsyncmode and vsyncrate options of the .conf files in Dosbox-X, both in the latest version and in the previous Dosbox-X there is still lag with vsync in the games, I have tried disabling the vertical synchronization of the control panel from nvidia on windows, and use only vsync from Dosbox-X with vsyncmode=on and force and there is still tearing and lag, but I have configured vsyncmode=host and now vsync fixes the screen tearing but then it skips frames and there is still lag, so the vsync of Dosbox-X is not very well optimized or implemented because it skips frames having another problem that is lag, then I tried the same thing but this time activating the vertical synchronization of the Nvidia control panel in Windows and the same thing, it solves the tearing and the split image in the movements, but it continues to skip frames and having the same lag and stutters, vsyncrate=60 should stay at a fixed 60FPS without skipping frames but it skips anyway frames and games are not kept at 60FPS, even with vsyncrate=60. I have tried vsyncrate=75 but 60FPS games become slow as a turtle, I have found that Jazz Jackrabbit 1 is made for 60FPS so with vsyncrate=60 it goes to its correct speed but keeps skipping frames having another problem that is lag and stuttering , and vsync=on and force don't seem to work as vsync, so vsync from Dosbox-X is unusable.

I have also seen that if vertical sync is enabled in the Nvidia control panel in Windows and set to vsyncmode=host, svga_s3 and opengl, the audio in games also slows down when you switch from one screen to another during fade moments animated on the black screens, but when you stay on one screen the audio becomes fast and stable again, the audio slows down only in the moments of going between one screen to another in the black screens of the games. I have also noticed that in games that handle adlib music like Fury of the Furries, the music slows down between black screens but even here it is while you are playing and moving around the game screen, from time to time the adlib music or the opl2 synthesizer will be slows down and out of tune in the music a bit during the movement of the game on the same screen and we return to the same, problem due to vsync or opengl of Dosbox-X, in Dosbox 0.74 all this does not happen, in games that handle soundblaster music they only slow down on black screens when switching from one screen to another, but if I disable vertical sync from the Nvidia control panel in Windows and keep vsyncmode=host the music no longer has any problem and is fast and stable so everything is due to Windows vsync with the Dosbox-X opengl that handles it by hardware and Dosbox vsync is software vsync and the music has no problems while you move, but the image keeps skipping frames.

What I was commenting on in the first post is that I tried Jazz Jackrabbit 1 on the original Dosbox 0.74 with vertical sync turned on in the Nvidia control panel on Windows because the original Dosbox doesn't have vsync, and configured with svga_s3, opengl, and 2xsai with Windows vsync enabled, the game works perfectly and can handle Windows vsync and keeps still frames at 60FPS with no frame skip or motion lag, but with Dosbox-X vsync does slight frame skip and may also slow down music during black screens , the solution is to disable vsync from Nvidia and use Dosbox-X, so music doesn't slow down and black screens don't have audio issues, but vsync on Dosbox-X doesn't do well either because it skips frames and has lag and I think it's because the opengl output of Dosbox-X is not the same as that of Dosbox 0.74 where there with vsync Jazz Jackrabbit 1 does not have lag or skip frames and it goes smooth even with vsync from Nvidia.

The solutions I would like to provide:

I would like to provide a solution that I have known that I think should be in Dosbox-X and it has not been implemented yet, I have seen that there is a modified version called Dosbox SVN r4019.3 Pixel-perfect/Savestates/VSYNC, which incorporates an option called borderless=true which makes the internal vsync of Dosbox by software, I have deactivated the vsync of Nvidia via hardware and I have tested this Dosbox with the option borderless = true to see if this vsync was real and worked the same as that of Nvidia via hardware being by software , and I tried the file called VSYNC.COM to see the movement and vsync looked smooth without split images, so I tried Jazz Jackrabbit 1 on it and there is vsync without skipping frames or lag, so I think a great solution would be to implement this function of borderless=true of this Dosbox in Dosbox-X calling it vsyncmode=true, and the vsyncrate replace it with the new option called forcerate of Dosbox-X, with the forcerate=60 I have made Jazz Jackrabbit not skip frames and go to fixed 60FPS without lag, so I would like to add the option borderless = true also in Dosbox-X replacing vsyncmode with borderless since this vsync does it very well for software, and if you deactivate vsync from Nvidia it adlib music would not go out of tune on motion or black screens would not slow down the audio due to not using Nvidia hardware vsync as it would be a software vsync but very well implemented and borderless=true should be in Dosbox-X a At this point, it is what I have tried and the problems with vsync would be solved being a great solution, the new option called forcerate could also be what vsyncrate does or change forcerate to vsyncrate because it also does it better and the FPS are fixed, I know from the window mode info, adding the borderless=true together with the forcerate would be a great advance for Dosbox-X.

I have also noticed that ddraw and opengl do different things in frames in the original Dosbox 0.74, and if you have vgaonly with 2xsai it only handles it in normal2x and only svga_s3 can handle 2xsai, but in Dosbox-X vgaonly and svga_s3 they seem to be exactly the same thing with 2xsai and vgaonly it seems to be svga when it is vga, the same happens with ddraw and opengl, the 2 do the same thing in Dosbox-X because they both have the same lag and skip frames, but in Dosbox 0.74 they do different things in frames and vsync, so I think that opengl of Dosbox 0.74 is better because it doesn't skip frames and keeps FPS better than Dosbox-X opengl output, they don't seem to be the same opengl or the same svga_s3. The Dosbox 0.74 opengl should be implemented in Dosbox-X and the vgaonly work only in normal2x like the one pixelated vga from real life, or at least that's the way it happens in Dosbox 0.74, that's why I think that vgaonly and svga_s3 should not be the same but in Dosbox-X they seem to do the same in 2xsai and svga.

The main problem with vsync in Dosbox-X seems to be due to the opengl output, the svga_s3 and vgaonly machines have the same lag so I discard the machines, I think that the lag and frame skip is due to Dosbox-X not being the same opengl as Dosbox 0.74, and borderless=true should also be added in Dosbox-X and this would solve all the problems with the games.

I have also seen that with fullresolution = desktop the games are always at the same resolution as Windows but during screen changes and black screens some artifacts appear on black screens that if fullresolution is in a specific resolution, for example fullresolution = 1280x800, between screen changes and during black screens no artifacts appear and the game does not slow down, however Dosbox-X cannot achieve 1280x800 or 640x480 by resizing to full screen, but it becomes small and in the center instead, it would be It is good to be able to specify a specific resolution, since with fullresolution = desktop, in the changes between screen and screen on black screens, it is as if Dosbox-X had to be searching and detecting each time the resolution in each screen change on black screens and It will take longer with artifacts, however when giving a specific and fixed resolution, Dosbox-X always stays fixed at that resolution without having it and go searching during black screens, and the game does not slow down on black screens, with desktop it is as if on each black screen it had to be detecting and looking for resolution again and that is why I think artifacts occur and it slows down a bit the game by entering the next screen.

I hope that all this information and tests help to implement a new vsync and add the borderless option of the Dosbox SVN r4019.3 Pixel-perfect/Savestates/VSYNC as well as improve opengl, be able to choose a lower resolution than desktop rescaling to full screen without leaving a small full screen in the center, I understand that if you want to see in 4: 3 for that there is openglpp, and with this, will improve Dosbox-X in the future updates.

Best regards, Ivan

P.D: Actually I could keep Dosbox 0.74 but this one also has bugs in svga_s3 with the game Fury of the furries, the levels of the 2nd world of Lagoon, the water of the game is seen with glitches and in Dosbox-X with svga_s3 it looks as it should be, Dosbox-X also has better options and more improvements than the original and I have also seen that the music and effects are heard with treble somewhat less strident and less distorted sound in Dosbox-X and it has support for 3dfx voodoo and glide graphics cards and that is why I continue to trust Dosbox -X and only with these improvements would they help it to be the best Dosbox of all.


De: rebb @.> Enviado: viernes, 22 de octubre de 2021 11:18 Para: joncampbell123/dosbox-x @.> Cc: guitarman89 @.>; Author @.> Asunto: Re: [joncampbell123/dosbox-x] Opengl output problem when using windows vsync and svga. (Issue #2994)

Does this also happen when you play around with the other vsync related settings in Dosbox-X ? From the example .conf files that come with Dosbox-X :

[vsync]

vsyncmode: Synchronize vsync timing to the host display. Requires calibration within DOSBox-X.

Possible values: off, on, force, host.

vsyncrate: Vsync rate used if vsync is enabled. Ignored if vsyncmode is set to host (win32).

Possible values:.

vsyncmode = off vsyncrate = 75

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/joncampbell123/dosbox-x/issues/2994#issuecomment-949441685, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWFJYGZOFXMPRW7MQ2N22BLUIET5NANCNFSM5GP5YKUQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.