-
-
Notifications
You must be signed in to change notification settings - Fork 172
Retire surface output #2780
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
Retire surface output #2780
Conversation
Nice @GranMinigun 👍🏻
So who will test it? 🤔 |
Dunno. It doesn't let me. Says surface is deprecated or something. Maybe users should? I heard Microsoft successfully utilizes that strategy in their products. |
Ok, so I've done some testing 😎 Works well when you set But there's a regression compared to main. If you start with
Prior to this you could switch back and forth between texture and OpenGL in the command line indefinitely. So something went wrong here. Tested on macOS. |
Reproduced: "The specified window isn't an OpenGL window" Just to be sure we're having the same error: diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp
index 576370596..fe87b8d5a 100644
--- a/src/gui/sdlmain.cpp
+++ b/src/gui/sdlmain.cpp
@@ -3284,7 +3284,7 @@ static void set_output(Section* sec, const bool wants_aspect_ratio_correction)
} else {
sdl.opengl.context = SDL_GL_CreateContext(sdl.window);
if (sdl.opengl.context == nullptr) {
- LOG_WARNING("Could not create OpenGL context, switching back to texture");
+ LOG_WARNING("Could not create OpenGL context, switching back to texture; error message: %s", SDL_GetError());
sdl.desktop.want_type = SCREEN_TEXTURE;
}
} |
Moving to draft for now. Too many things broke for visibly no reason:
|
12941e2
to
62fb162
Compare
I can't read. Ready for additional testing and review. (Just realized output switching is still borked. Sorry, |
62fb162
to
a0dd002
Compare
Will test & review tomorrow then, when you think you're done 😄 |
b0fa54c
to
4b1d7ad
Compare
4b1d7ad
to
d8c773d
Compare
Let me know when this is ready fro review and another round of testig @GranMinigun. |
Unless you can comment on the things I pointed out in the first post, it was ready for a review for about a week. Just needs a rebase. |
d8c773d
to
dec4bfd
Compare
include/video.h
Outdated
Bitu GFX_GetBestMode(Bitu flags); | ||
Bitu GFX_GetRGB(uint8_t red,uint8_t green,uint8_t blue); | ||
uint8_t GFX_GetBestMode(uint8_t flags); | ||
uint32_t GFX_GetRGB(uint8_t red, uint8_t green, uint8_t blue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make the args const?
src/gui/sdlmain.cpp
Outdated
@@ -1316,29 +1280,19 @@ static void check_and_handle_dpi_change(SDL_Window* sdl_window, | |||
} | |||
|
|||
static SDL_Window* SetWindowMode(SCREEN_TYPES screen_type, int width, | |||
int height, bool fullscreen, bool resizable, | |||
bool allow_highdpi = true) | |||
int height, bool fullscreen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make them const while we're at it?
src/gui/sdlmain.cpp
Outdated
// Surface update & presentation | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
static void update_frame_surface([[maybe_unused]] const uint16_t *changedLines) | ||
uint32_t GFX_GetRGB(uint8_t red, uint8_t green, uint8_t blue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const args?
Ok,
Doesn't seem right that I'm getting an OpenGL related error in |
No. It won't compile on Ubuntu 20.xx (and readme mentions support for SDL 2.0.5), and Wiped event filter completely, it only fights with SDL's window handling. macOS freezes output during window resize anyway. Should be ready for another round of testing. |
dec4bfd
to
55969d8
Compare
55969d8
to
76d7ed3
Compare
Thanks that was my point; it seemed completely unnecessary. |
Testing is producing good results, @GranMinigun. I'm seeing a minor but inconsequential functional difference versus On macOS (only) and in fullscreen mode, when manually flipping between
Note: my 5-button PC mouse cursor tends to "go behind the scene" in all branches regularly, so please disregard that aspect; it's nothing to w/ this branch. This window behavior appears to entirely be driven by SDL re-using its window but getting a new renderer - instead of our old hamfisted "rebuild everything from scratch" including blowing away the old SDL window, context, renderer, etc.. I'm quite OK with this, but wanted to mention it. No doubt we might see more of these slight functional changes as the "old and wrong" ways are jettisoned in favour of doing things more correctly per SDL (and OpenGL)'s APIs. |
@johnnovak -> thanks for the heads up on this. I also get this in the |
Sounds good @kcgen. Talking about VFR, man, that thing keeps giving 😅 On my fixed 60 Hz monitor the default VFR mode with vsync off now works reliably in the sense that no frames are lost when the video output is only infrequently updated, but because the duping now happens at 1/10th of the host rate or something, you get visible tearing that "resolves itself" after around 60-80 ms. That very visible and it's not an authentic experience, to put it mildly. As we have established, this can happen in any graphics or text mode; just text mode apps are the ones that tend to update the screen only sporadically, but I'm getting it all the time in the Quake video options menu, for example. So you can have a look at some pont if you have capacity, otherwise I will because I find this pretty jarring. It even manifests at a simple command prompt; the blinking of the cursor and a normal typing rate is not enough to trigger new frames at a sufficiently high FPS to prevent this from happening 100% of the time. I don't quite get it why the previous "dupe at the rate of the DOS mode" thing had to be removed. |
No, it's still recreated, that's the only way to ensure the window has all necessary flags for whatever renderer is chosen. Why it goes maximized instead of fullscreen, I can't tell right now. I think Burrito noticed that behaviour in my sdlpain cleanup PR as well. Something's fishy. |
I'm not seeing the PR changing or resetting the fullscreen boolean value, and combined with the fact that it switches to a /maximized/ window points to some state being partially lost or maybe the window manager doesn't let us go full screen the instant after the renderer is created (maybe there's some kind of host-side "settle-out" delay we need to wait before kicking in full screen, or something like that). |
Right. It should follow up at least with the next dupe frame as fast as possible (that is, at the negotiated rate: if throttled, that's the host rate ie: 60 Hz, or if full VFR at the DOS rate). |
@GranMinigun, should we merge this and then punt this very corner-case "full screen falls back to max-window on output change" for the future? To me, the code maintainability improvement here is more valuable than this non-showstopping small functional difference. |
Well, it definitely doesn't do that 😄
Yeah, I just use CFR myself, usually with vsync disabled because it doesn't make much of a difference for the stuff I'm interested in, or with vsync enabled with demos but then I need to set my custom tweaked 70 Hz mode. That works like a dream, though; butter-smooth scrolling in Pinball Dreams and similar 100% synced to 70 Hz games. I'm more worried about people using the defaults getting VFR and thus a questionable experience.
🚀 |
Yup! I meant, it's the functionality we want. (what it currently does is follow up with dupe frames at about 10 fps) |
Right okay 😄 I read it as: "this is how it should work, but I'm actually surprised to learn it's buggy" 😅 All clear now! |
@GranMinigun - "Properly retaining fullscreen state, I'd say that's out of scope. Can't think immediately which change broke it, but will definitely be addressed in the subsequent PR(s)" Agree here as well. Looking at the PR's purpose, you've nailed it then some (by eliminating the crashy callback). Let's get this down the chute. 🚀 |
I don't like that
goto
insideGFX_SetSize()
.GFX_GetBestMode()
seems to be redundant. PVS didn't likeget_rendered_output_from_backbuffer()
, but perhaps a switch would fit there better. Smart ideas are welcome.Oh, and it's completely untested.
Closes #433.