Skip to content
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

Runtime bug: vsync is messed up if game resolution doesn't match the desktop resolution that dxx-rebirth was launched at. #670

Open
BryanFRitt opened this issue Oct 18, 2022 · 12 comments
Assignees
Labels

Comments

@BryanFRitt
Copy link

Debian Stable, Debian GNU/Linux 11 (bullseye)
dxx-rebirth_20220929-src compiled
Intel CPU

If d2x-rebirth is run at a resolution that it wasn't started at, vsync will be messed up.
e.g.
If the desktop is 3840x2160 when d2x-rebirth is started and d2x-rebirth is set to 3840x2160, vsync will work fine, but at other resolutions vsnyc will be messed up and a horizontal line will appear on screen. If d2x-rebirth is changed to 3200x1800 vsync won't work properly unless game is exited and restarted again when desktop is 3200x1800.

(note: haven't tested d1x-rebirth with this)

@BryanFRitt BryanFRitt added the bug label Oct 18, 2022
@BryanFRitt BryanFRitt changed the title Runtime bug: vsync is messed up if game resolution doesn't match desktop resolution that the game was launched at. Runtime bug: vsync is messed up if game resolution doesn't match desktop resolution that the dxx-rebirth was launched at. Oct 18, 2022
@BryanFRitt BryanFRitt changed the title Runtime bug: vsync is messed up if game resolution doesn't match desktop resolution that the dxx-rebirth was launched at. Runtime bug: vsync is messed up if game resolution doesn't match desktop resolution that dxx-rebirth was launched at. Oct 18, 2022
@BryanFRitt BryanFRitt changed the title Runtime bug: vsync is messed up if game resolution doesn't match desktop resolution that dxx-rebirth was launched at. Runtime bug: vsync is messed up if game resolution doesn't match the desktop resolution that dxx-rebirth was launched at. Oct 18, 2022
@vLKp
Copy link
Contributor

vLKp commented Oct 19, 2022

I cannot reproduce this here. The game looks fine with vsync enabled, even after changing the display resolution. No visual artifacts appear. Please describe exactly how to reproduce this:

  • Start the game at what display resolution and what game window size? Windowed or full screen?
  • At what game screen(s) should I use xrandr to change the screen resolution?
  • What Rebirth options shall I change after using xrandr to change the screen resolution?
  • On what game screen(s) will I observe the visual artifact?

@BryanFRitt
Copy link
Author

Start the game at what display resolution and what game window size? Windowed or full screen?

Full screen is what I've been trying it with. I don't see the issue happening in windowed mode. This occurs whenever the d2x-rebirth resolution doesn't match whatever the desktop is set to.

If I set d2x-rebirth back to whatever the desktop resolution was the problem goes away.

On what game screen(s) will I observe the visual artifact?

You can see the line by rotating the ship around in a circle like the ship was going around a pole that goes from it's top to bottom. (can be done by holding down the left key, or something like that) Look for a horizontal line somewhere around 1/4 to 1/5 down from the top of the display. [If whatever this is, isn't called a vsync issue, let me know what it's called, and I'll correct myself]

Game resolution can be changed by GAME MENU > (F2) OPTIONS... > GRAPHICS... > SCREEN RESOLUTION... > mouse click on a resolution and press the enter key.
To switch between full screen and window: show a menu then pressing alt+enter to toggle

At what game screen(s) should I use xrandr to change the screen resolution?
What Rebirth options shall I change after using xrandr to change the screen resolution?

[not sure how to best say this]
xrandr can be used to make the desktop match whatever resolution dxx-rebirth will be played at, so the vsync issue won't occur, but doing so seems to cause a bunch of other issues like for subsequent runs dxx-rebirth might exit on the wrong resolution if a new desktop resolution doesn't match the old, full screen sometimes not being right, etc... If xrandr hasn't been used, changing dxx-rebinth's resolution from within the game works fine, except for the vsync issue with resolutions the desktop isn't set to.

For full screen as long as the desktop's resolution and dxx-rebirth's resolution match, there isn't the vsync issue.

In case it matters, I'm using KDE and COMPIZ.

@vLKp
Copy link
Contributor

vLKp commented Oct 20, 2022

I retried this, and I still don't see it.

  • Set monitor to 1920x1080
  • Start program
  • Go to graphics menu
  • Enable "Full Screen" checkbox. Set resolution to 1024x768
  • Dismiss menu
  • Screen resolution updates
  • Enter mission
  • Spin around. Look for the visual error. Nothing is found.

I also tried:

  • Start program in windowed mode, with a window resolution less than my monitor dimensions
  • Enter mission
  • Open Escape menu
  • Use Alt+Enter to toggle full screen mode
  • Screen resolution updates
  • Spin around. Look for the visual error. Nothing is found.

Does the issue occur if you disable desktop compositing?

@BryanFRitt
Copy link
Author

BryanFRitt commented Oct 20, 2022

[If whatever this is, isn't called a vsync issue, let me know what it's called, and I'll correct myself]

I guess I'll call it a horizontal line issue.

Does the issue occur if you disable desktop compositing?

Just tired it without Compiz with just Plasma, as well as a plain xterm xsession, and they all result with this issue, with and without optirun.

I retried this, and I still don't see it.

Set monitor to 1920x1080
Start program
Go to graphics menu
Enable "Full Screen" checkbox. Set resolution to 1024x768
Dismiss menu
Screen resolution updates
Enter mission
Spin around. Look for the visual error. Nothing is found.

That sounds about like what I did.

Also whenever dxx-rebirth's resolution is set back to the desktop's resolution, the line doesn't show up.

I just noticed that the line only shows up when moving, if stationary I don't see it.
UPDATE: Also noticed that the left part of the line goes from top left of the screen at a -45 degree angle, then when in gets to a point, varying to somewhere around 1/5 to 1/3 of the screen, it goes horizontal to the end of the screen.

@vLKp
Copy link
Contributor

vLKp commented Oct 24, 2022

If you run the game in windowed mode, with a window the size of your screen, does the line appear? This mode does not take control of your resolution, and does not set the full screen flag on the SDL window. If yes, what happens if you run in windowed mode with a smaller window, so that some of your desktop is visible? If you move the window such that its top left corner is not the top left of your display, does the line relocate with the window, draw on your desktop, or draw only within the window, but clipped as if its origin were still top left?

Has this always happened, or is it a regression? If you capture a screenshot while the line is visible, is the line in the screenshot? I expect it will be. What does the line look like? Is it very narrow, or broad and obvious even from elsewhere in the room?

Since I cannot reproduce this issue, my ability to debug it is limited. I have no theories as to what part of the Rebirth code, if any, is responsible for this. The general graphics code has not been substantially changed in a very long time, so I would expect other users to have reported this if it occurs on typical systems.

@BryanFRitt
Copy link
Author

When tried to take screenshots when this what happening, the game briefly froze without the error showing, and the screenshots it took didn't show the error.

Tried running simple screen recorder while playing a game. Looks like having simple screen recorder on, does something with vsync, so I don't see this error. On quick glance it looks like when playing looks like vsync was off, but the recording looks like vsync was on. Neither one shows the horizontal line issue described.

Next I tried using cheese and an external webcam, and I got the line issue to show up on the webcam by spinning around at the start of the 1st level. This is a video frame from of a video recorded when the game was fullscreen at 3200x1800 on a 3840x2160 desktop taken with a 1920x1080 webcam. [I can try other resolution combinations if needed] You can see the ~-45degree line and the horizontal line(s) that comes after it. The two blue circle parts near the middle/center are reflections from the webcam lights that show that it's recording. [ note: not 100% sure, but I think '4X MULTISAMPLING' was probably off ]

Descent II - Line Issue Image

@BryanFRitt
Copy link
Author

BryanFRitt commented Oct 25, 2022

If you run the game in windowed mode, with a window the size of your screen, does the line appear?

Nope, bug only occurs in fullscreen modes that don't match desktop resolution.

Has this always happened, or is it a regression?

I never really tried this out with other versions, so I don't know.

If you capture a screenshot while the line is visible, is the line in the screenshot? I expect it will be. What does the line look like? Is it very narrow, or broad and obvious even from elsewhere in the room?

See other post for attempts to get a screenshot of it notes. It looks like the diagonal line is per pixel, and the distance between horizontal lines are several pixels.

Also, Bug also doesn't show up when a menu is displayed.

@BryanFRitt
Copy link
Author

Thought I'd do another screenshot. This time on a 3840x2160 desktop, 1920x1080 webcam, game at 1920x1080 fullscreen, only 'VSYNC' and 'FPS COUNTER' 'GRAPHICS OPTIONS'.

Descent II - Line Issue Image - Screenshot 2

@BryanFRitt
Copy link
Author

BryanFRitt commented Oct 25, 2022

Tried playing again this time 960x540, and this time the diagonal part was not there, and the bug was just a horizontal line all the way across the screen. On another resolution it was a little horizontal line a -45° diagonal then a horizontal line the rest of the way.

@vLKp
Copy link
Contributor

vLKp commented Oct 30, 2022

I see the graphical anomaly in your webcam image. I have no guesses as to its cause, but find it interesting that it does not occur when using windowed mode. Note that when using SDL1, with Full Screen checked, SDL will change your monitor's resolution to the requested window dimensions.

Do you also see this problem when using SDL2? Its full screen mode is implemented differently.


It is unlikely that I can do anything to fix this:

@BryanFRitt
Copy link
Author

It is unlikely that I can do anything to fix this

I guess one of us(or both?) could fill in bug report(s) with supporting libraries. I don't know much about them to know what/how they do whatever it is they do, or whatever they are supposed to do is. (Didn't mean to annoy you on anything)

Do you also see this problem when using SDL2? Its full screen mode is implemented differently.

Compile with this?
scons d2x=sdl2 sdl2_sdl2=1

Tried this, can't reproduce the error, not because this issue is gone, but because it no longer changes the full screen resolution. For example: have desktop at 3840x2160, and set game to 800x600. Windowed mode will be 800x600, but full screen still will be 3840x2160, or 3840x2160 with a smaller window the size of 800x600.

p.s. The bold markup for this makes it look like filtering out of a curse word, **it :)

@Brunnis
Copy link

Brunnis commented Jan 25, 2023

This issue seems to also be present on the Raspberry Pi. I'm running Raspberry Pi 4 on Pi OS 64-bit with kernel 6.1.7 and Mesa 22.2.5. Using a 2560x1440 monitor, any in-game resolution other than 2560x1440 results in very visible tearing. Obviously, 2560x1440 leads to low framerate even on a Pi 4, so as it stands there's unfortunately no way of running dxx-rebirth tear free on the Pi.

This issue is perhaps most easily noticed in 640x480, where the tearline consistently ends up near the top of the display and stays there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants