-
-
Notifications
You must be signed in to change notification settings - Fork 443
SDLWindow: MSAA fallback retry + null-safe CreateWindow #2059
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
base: develop
Are you sure you want to change the base?
Changes from 1 commit
6370d46
cbc833f
1da6efe
16a34b6
c668007
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,6 +160,15 @@ namespace lime { | |
| } | ||
| #endif | ||
|
|
||
| if (!sdlWindow && (flags & (WINDOW_FLAG_HW_AA | WINDOW_FLAG_HW_AA_HIRES))) { | ||
|
|
||
| // Retry without antialiasing — emulators and some devices don't support MSAA | ||
| SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 0); | ||
| SDL_GL_SetAttribute (SDL_GL_MULTISAMPLESAMPLES, 0); | ||
| sdlWindow = SDL_CreateWindow (title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, sdlWindowFlags); | ||
|
|
||
| } | ||
|
|
||
| if (!sdlWindow) { | ||
|
|
||
| printf ("Could not create SDL window: %s.\n", SDL_GetError ()); | ||
|
|
@@ -584,8 +593,8 @@ namespace lime { | |
|
|
||
| int SDLWindow::GetHeight () { | ||
|
|
||
| int width; | ||
| int height; | ||
| int width = 0; | ||
| int height = 0; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can SDL_GetWindowSize actually exit without writing these values? Sdl2 docs don't mention that case: https://wiki.libsdl.org/SDL2/SDL_GetWindowSize
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can, via
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to provide the source: The docs also say:
Which can make the code cleaner and avoid setting the one we don't need to 0. Also as an aside, it looks like in SDL3 we will be able to check the return value of SDL_GetWindowSize to see if it failed: https://wiki.libsdl.org/SDL3/SDL_GetWindowSize
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call — adopted in 16a34b6. |
||
|
|
||
| SDL_GetWindowSize (sdlWindow, &width, &height); | ||
|
|
||
|
|
@@ -667,8 +676,8 @@ namespace lime { | |
|
|
||
| int SDLWindow::GetWidth () { | ||
|
|
||
| int width; | ||
| int height; | ||
| int width = 0; | ||
| int height = 0; | ||
|
|
||
| SDL_GetWindowSize (sdlWindow, &width, &height); | ||
|
|
||
|
|
@@ -1133,7 +1142,16 @@ namespace lime { | |
|
|
||
| Window* CreateWindow (Application* application, int width, int height, int flags, const char* title) { | ||
|
|
||
| return new SDLWindow (application, width, height, flags, title); | ||
| SDLWindow* window = new SDLWindow (application, width, height, flags, title); | ||
|
|
||
| if (!window->sdlWindow) { | ||
|
|
||
| delete window; | ||
| return NULL; | ||
|
|
||
| } | ||
|
|
||
| return window; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to make sure all callers of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done — |
||
|
|
||
| } | ||
|
|
||
|
|
||
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.
Maybe best to remove the emdash as it may cause issues in some editors
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.
Good catch — replaced with an ASCII hyphen in cbc833f.